Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Hiding/unhiding parent dialogs affects mouse handling
Forum Updated to NodeBB v4.3 + New Features

Hiding/unhiding parent dialogs affects mouse handling

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 407 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Captain Haddock
    wrote on last edited by
    #1

    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.

    Pl45m4P 1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      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?

      C 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        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?

        C Offline
        C Offline
        Captain Haddock
        wrote on last edited by
        #3

        @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 ?

        JoeCFDJ 1 Reply Last reply
        0
        • C Captain Haddock

          @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 ?

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by
          #4

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

          C 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

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

            C Offline
            C Offline
            Captain Haddock
            wrote on last edited by
            #5

            @JoeCFD PyQt5-5.15.7 running on Ubuntu 22.04LTS

            1 Reply Last reply
            0
            • C Captain Haddock

              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.

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by Pl45m4
              #6

              @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 trigger Window::mouseReleaseEvent.
              Events are propagated up the object tree until one widget takes it.


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved