Hiding/unhiding parent dialogs affects mouse handling
-
Newish to PyQt5.
I launch a dialog from a button on a window. From that dialog I launch another dialog from a button on the first dialog.
What I would like to do is on launching the second dialog, hide the first dialog then on dismissing the second dialog unhide the first dialog. I tried this and the hide/unhide works but a side effect appears to be that a mouse release handler on the window subsequently fails to trigger.
def mouseReleaseEvent(self, event): print("mouseReleaseEvent")In the init in the second dialog I use:
self.parentDialog = parent self.parentDialog.setHidden(True)And then in the close logic I call:
self.parentDialog.setHidden(False)Can anyone speculate whats going on? I cant provide the full code and it would take an amount of time to create a mockup of this.
-
do you have to launch two dialogs? Can not you use QStackedWidget to toggle the contents of these two dialogs if they have the same size?
@JoeCFD Yes that would be one way of doing it .. they are completely diff sizes. Its more about me understanding whats going on .. why the mouse handler gets disabled/blocked ?
-
@JoeCFD Yes that would be one way of doing it .. they are completely diff sizes. Its more about me understanding whats going on .. why the mouse handler gets disabled/blocked ?
@Captain-Haddock You can resize it in the toggle. But you are right it is better to know where the problem is.
You need to tell your Qt version and OS to let people here help you. -
@Captain-Haddock You can resize it in the toggle. But you are right it is better to know where the problem is.
You need to tell your Qt version and OS to let people here help you.@JoeCFD PyQt5-5.15.7 running on Ubuntu 22.04LTS
-
Newish to PyQt5.
I launch a dialog from a button on a window. From that dialog I launch another dialog from a button on the first dialog.
What I would like to do is on launching the second dialog, hide the first dialog then on dismissing the second dialog unhide the first dialog. I tried this and the hide/unhide works but a side effect appears to be that a mouse release handler on the window subsequently fails to trigger.
def mouseReleaseEvent(self, event): print("mouseReleaseEvent")In the init in the second dialog I use:
self.parentDialog = parent self.parentDialog.setHidden(True)And then in the close logic I call:
self.parentDialog.setHidden(False)Can anyone speculate whats going on? I cant provide the full code and it would take an amount of time to create a mockup of this.
@Captain-Haddock said in Hiding/unhiding parent dialogs affects mouse handling:
I tried this and the hide/unhide works but a side effect appears to be that a mouse release handler on the window subsequently fails to trigger
MouseRelease in what class?
Side-note: Your "window" only gets the event, if no other child widget consumes it. Any mouseRelease on child widgets of your window doesnt triggerWindow::mouseReleaseEvent.
Events are propagated up the object tree until one widget takes it.