Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Cannot set QDialog modal
Qt 6.11 is out! See what's new in the release blog

Cannot set QDialog modal

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 3 Posters 264 Views 1 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.
  • O Offline
    O Offline
    oldbrad
    wrote last edited by oldbrad
    #1

    Running PySide6 under Ubuntu Linux
    In my class Dialog(QtDialog) init I call self.setWindowModality(Qt.WindowModal)
    and then print(self.windowModality())) which reports: 'WindowModality.WindowModal', but the dialog does NOT stay on top.

    I can force modal by checking 'Always on Top' in the panel icon.

    What did I miss?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      friedemannkleint
      wrote last edited by
      #2

      Most likely, a parent widget.. What Desktop/Windowing system is this?

      O 1 Reply Last reply
      1
      • F friedemannkleint

        Most likely, a parent widget.. What Desktop/Windowing system is this?

        O Offline
        O Offline
        oldbrad
        wrote last edited by
        #3

        @friedemannkleint said in Cannot set QDialog modal:

        What Desktop/Windowing system is this?

        $ echo $XDG_SESSION_TYPE
        x11

        But I think your implication is that a Dialog without a parent and cannot go modal over other application windows?

        JonBJ 1 Reply Last reply
        0
        • O oldbrad

          @friedemannkleint said in Cannot set QDialog modal:

          What Desktop/Windowing system is this?

          $ echo $XDG_SESSION_TYPE
          x11

          But I think your implication is that a Dialog without a parent and cannot go modal over other application windows?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote last edited by
          #4

          @oldbrad
          So far as I recall, you should have no trouble having a modal dialog on top of all/any other windows in an application, certainly under Xorg if maybe not under Wayland, and without setting Always on Top. But I think your choice of self.setWindowModality(Qt.WindowModal) is wrong, that is looking for one parent to be modal to and you are not passing any. As per https://doc.qt.io/qt-6/qt.html#WindowModality-enum you should use Qt::ApplicationModal if you are not going to set a parent window for it to be modal against.

          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