Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104905

Window modal not blocking ancestor window interaction on Mac

    XMLWordPrintable

Details

    • macOS
    • 1bde20360 (dev), 7a3a94099 (6.5), fb70893dd (dev), 57f44282b (tqtc/lts-6.2), e02758cbf (6.5), 4a16e51bc (dev), ed1def47a (6.6), 4115060fc (tqtc/lts-6.5)

    Description

      Run the attached example on Mac. The main window has a child window which again has a child. The last child is Window modal, so it should not be possible to interact with anything but that child[*].

      Unfortunately it is possible to click the main window and close it by pressing the (red) 'x' in the corner. When that happens the Window is even closed without a close event being delivered (and neither is the virtual QMainWindow::setVisible function called). This can cause programs to end up in unexpected "impossible" states (e.g where no windows are visible but program still running).

      This works on e.g Windows (and likely Linux)

      [*] See https://doc.qt.io/qt-6/qt.html#WindowModality-enum
      Qt::WindowModal (1): The window is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows.

      Attachments

        1. main.cpp
          1 kB
        2. WindowModalNotWorking.pro
          0.2 kB
        For Gerrit Dashboard: QTBUG-104905
        # Subject Branch Project Status CR V

        Activity

          People

            vestbo Tor Arne Vestbø
            tmartsum Thorbjørn Lund Martsum
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: