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. Subclassed QDialog, exec() calls after the first one, don't raise the dialog!

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

Scheduled Pinned Locked Moved Solved General and Desktop
qdialogexecraise
3 Posts 2 Posters 894 Views
  • 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.
  • enjoysmathE Offline
    enjoysmathE Offline
    enjoysmath
    wrote on last edited by
    #1

    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
    0
    • enjoysmathE Offline
      enjoysmathE Offline
      enjoysmath
      wrote on last edited by
      #2

      This fixes it:

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

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

      JonBJ 1 Reply Last reply
      0
      • enjoysmathE enjoysmath

        This fixes it:

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

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

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

        • Login

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