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

Loaded WindowModal window is not embedded into parent window on macOS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.7.1, 5.8.0 RC
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      macOS 10.12.2
      Qt 5.8
    • Platform/s:
      macOS

      Description

      Consider the following code:

      ModalWindow.qml

      import QtQuick 2.0
      import QtQuick.Window 2.2
      
      Window {
          width: 100
          height: 100
          modality: Qt.WindowModal
          visible: true
      
          Rectangle {
              anchors.fill: parent
              color: "#1f1f1f"
          }
      
          Text {
              anchors.centerIn: parent
              text: "Modal Window"
              color: "#ffffff"
          }
      }
      

      main.qml

      import QtQuick 2.0
      import QtQuick.Window 2.2
      
      Window {
          id: rootWindow
      
          visible: true
          width: 640
          height: 480
          title: "Root Window"
      
          ModalWindow {}
      }
      

      WindowModal windows on macOS look as if they were embedded into their parent windows (see WindowModal.jpg in attachment). If you create another instance of ModalWindow.qml as

          Component.onCompleted: {
              var windowComponent = Qt.createComponent("ModalWindow.qml")
              var window = windowComponent.createObject(rootWindow.contentItem)
          }
      

      it will look the same.
      Now, if you use Loader to instantiate it

          Loader {
              anchors.fill: parent
              source: "ModalWindow.qml"
          }
      

      ModalWindow will be created as a separate window (see WindowModalBroken.jpg in attachment) which is incorrect.
      I found this during of debugging QTBUG-56166

        Attachments

        1. WindowModal.jpg
          WindowModal.jpg
          322 kB
        2. WindowModalBroken.jpg
          WindowModalBroken.jpg
          334 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              w00t Robin Burchell
              Reporter:
              wearyinside Oleg Yadrov
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes