Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Solved Subclassed QDialog, exec() calls after the first one, don't raise the dialog!

    General and Desktop
    qdialog exec raise
    2
    3
    611
    Loading More Posts
    • 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.
    • enjoysmath
      enjoysmath last edited by

      I have a working custom QDialog in PyQt5, python 3.5.2. There is a main window, that invokes the dialogs. The first invokation (using exec_()) succeeds. But calling exec_() again fails to put the dialog on top. It's present in the task bar only, so I have to go and click on it. But I need it to raise to the top every time!

      Is this because I'm not using the parent parameter of the QDialog constructor? I'll test that out...

      https://github.com/enjoysmath
      https://math.stackexchange.com/users/26327/exercisingmathematician

      1 Reply Last reply Reply Quote 0
      • enjoysmath
        enjoysmath last edited by

        This fixes it:

        self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)

        https://github.com/enjoysmath
        https://math.stackexchange.com/users/26327/exercisingmathematician

        JonB 1 Reply Last reply Reply Quote 0
        • JonB
          JonB @enjoysmath last edited by JonB

          @enjoysmath
          I wouldn't expect to need to use that, and would have thought it could lead to other problems. A dialog should be on top anyway. Did you try just passing the main window as the parent?

          1 Reply Last reply Reply Quote 2
          • First post
            Last post