[Interest] Place a QWidget below a button (and follow it!)
senseiwa at gmail.com
Thu Jun 13 17:51:07 CEST 2013
I am trying to "attach" a widget to a button inside a main window,
making it follow any movement of the entire window.
In details, I have a widget that will display a floating window when the
user clicks on a QToolButton. This floating widget must be placed below
the button that summoned its soul, and if the main window moves, the
floating window must be positioned in the same place.
In other words, I'd like to place this widget *relative* to another
widget (inside a main window). This placement should follow every
movement of the main window.
The entire hierarchy (pertinent to my problem) is as follows:
QWidget <------- My custom widget
QWidget <---- The floating window
Erroneously, I imagined that it could be sufficient to reimplement
moveEvent in my custom widget, but what I did find? That it isn't
actually called, instead I should, probably, reimplement the moveEvent
in the QMainWindow and propagate the event to the custom widget (which
in turn will move the floating window).
However, this is quite contorted and probably unnecessary.
Thanks & Cheers!
More information about the Interest