[Interest] Struggling with moveEvent()

Murphy, Sean smurphy at walbro.com
Mon Oct 1 20:11:51 CEST 2018


My basic question is how do child widgets get moved or repainted when some ancestor of theirs moves? 

Here's the more detailed issue, first the widget hierarchy:
QMainWindow
   CustomerHeaderTable (inherits from QTableWidget)
       CustomTableHeader (inherits from QHeaderView, allows you to put widgets in the header sections)
           dataConfigWidget (inherits from QWidget)
               QPushButton 
               captionPopupMenu (inherits from QWidget, starts out hidden)

What I'm trying to accomplish is when the user presses the QPushButton, that a custom popup menu (the captionPopupMenu) appears aligned to the pushbutton. Right now I've got the initial alignment working just fine. The issue is when the popup is visible, if the user then grabs the application title bar and moves the entire main window around, the popup isn't moving with the application. So I figured I just need to update the captionPopupMenu's position in dataConfigWidget's moveEvent() to keep it positioned correctly. But it appears when the main window moves around, the dataConfigWidget's moveEvent() is never called - I put some qDebug() statements in there to verify. Same goes for paintEvent() - my child widgets aren't getting called when the ancestors move. 

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.
Sean



This message has been scanned for malware by Forcepoint. www.forcepoint.com



More information about the Interest mailing list