[Interest] Struggling with moveEvent()
smurphy at walbro.com
Tue Oct 2 14:27:26 CEST 2018
> > So I'm not sure what I need to trigger off from to detect when I need to
> reposition the menu. I feel like I'm missing something really obvious, but not
> seeing it on a Monday apparently.
> I don't think you're missing anything -- if a widget doesn't move, but
> its parent does, only the parent gets a move event, not the widget.
Yeah, I was starting to come to this realization after I posted, by heading back
to the docs and reading what a QMoveEvent object actually is
(http://doc.qt.io/qt-5/qmoveevent.html), specifically the
line: Move events are sent to widgets that have been moved to a new
position relative to their parent.
> As a result, for your use case, I believe you need to track move events
> on the whole parent/child chain starting at the window up to your
> widget. I guess you can install event filters for this.
I might have to, but I definitely don't really like this solution since it breaks
encapsulation. What I'm looking at now is since the widget I'm popping up
is supposed to behave somewhat similar to a popup menu, that I should
probably just hide it whenever focus leaves it. That's probably more what
users would expect to happen, and makes it easier on me anyways.
This message has been scanned for malware by Forcepoint. www.forcepoint.com
More information about the Interest