ComServant
10th January 2015, 03:56
Recently, my Qt application has stopped repainting widgets when they are hovered over, so no visual changes occur to buttons or other widgets when they are hovered. I don't think the buttons even know they are getting hovered at all, but they are receiving mouse clicks, which is triggering the proper signals and reaching the connected slots. This behavior changes the first time the window gets resized - suddenly, even widget can be hovered with visual changes again, for the rest of the application's lifetime.
Since it's a relatively large application, and it wasn't happening a week or so ago, likely I'm just overriding some virtual event func and forgetting to propagate it, but I've double-checked some of the likelier culprits (like the main window) to make sure they are forwarding the events to its base class.
Not only are they not getting hover events, but they aren't receiving paint events - even when calling repaint()!
Based on the behavior, it seems like there is an invisible pop-up window that has focus, until the window is resized and regains focus. Clicks "outside" of the popup are received by the application, but mouse movement is stolen by the popup, and the widgets in the background don't get repainted because of the popup (just using their cached appearances).
I've printed out the objectnames of all these, but I'm not seeing anything odd.
//These two are the same: The main window
QWidget *activeWindow = qApp->activeWindow();
QWindow *focusWindow = qApp->focusWindow();
//Basically the most recent interactive widget I clicked on.
QWidget *focusWidget = qApp->focusWidget();
//These four are null.
QWidget *mouseGrabber = QWidget::mouseGrabber();
QWidget *keyboardGrabber = QWidget::keyboardGrabber();
QWidget *activePopup = qApp->activePopupWidget();
QWidget *activeModal = qApp->activeModalWidget();
So to recap: Buttons and other widgets are receiving clicks, but not mouse-movement events (even widgets that have mouse-tracking enabled). They are drawing once, but not repainting themselves when they are supposed to.
Tomorrow I'll be checking my diffs over the past few repository commits to try to figure out what changes I've made, but if anyone has any thoughts or tips for debugging this, I'd really really appreciate it.
I'm using Qt5.4.
Since it's a relatively large application, and it wasn't happening a week or so ago, likely I'm just overriding some virtual event func and forgetting to propagate it, but I've double-checked some of the likelier culprits (like the main window) to make sure they are forwarding the events to its base class.
Not only are they not getting hover events, but they aren't receiving paint events - even when calling repaint()!
Based on the behavior, it seems like there is an invisible pop-up window that has focus, until the window is resized and regains focus. Clicks "outside" of the popup are received by the application, but mouse movement is stolen by the popup, and the widgets in the background don't get repainted because of the popup (just using their cached appearances).
I've printed out the objectnames of all these, but I'm not seeing anything odd.
//These two are the same: The main window
QWidget *activeWindow = qApp->activeWindow();
QWindow *focusWindow = qApp->focusWindow();
//Basically the most recent interactive widget I clicked on.
QWidget *focusWidget = qApp->focusWidget();
//These four are null.
QWidget *mouseGrabber = QWidget::mouseGrabber();
QWidget *keyboardGrabber = QWidget::keyboardGrabber();
QWidget *activePopup = qApp->activePopupWidget();
QWidget *activeModal = qApp->activeModalWidget();
So to recap: Buttons and other widgets are receiving clicks, but not mouse-movement events (even widgets that have mouse-tracking enabled). They are drawing once, but not repainting themselves when they are supposed to.
Tomorrow I'll be checking my diffs over the past few repository commits to try to figure out what changes I've made, but if anyone has any thoughts or tips for debugging this, I'd really really appreciate it.
I'm using Qt5.4.