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 891 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.
  • E Offline
    E Offline
    enjoysmath
    wrote on 23 Sept 2018, 19:35 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
    • E Offline
      E Offline
      enjoysmath
      wrote on 23 Sept 2018, 19:38 last edited by
      #2

      This fixes it:

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

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

      J 1 Reply Last reply 23 Sept 2018, 19:43
      0
      • E enjoysmath
        23 Sept 2018, 19:38

        This fixes it:

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

        J Offline
        J Offline
        JonB
        wrote on 23 Sept 2018, 19:43 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

        2/3

        23 Sept 2018, 19:38

        • Login

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