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

Loaded WindowModal window is not embedded into parent window on macOS

    XMLWordPrintable

Details

    • Bug
    • Status: Reported
    • P3: Somewhat important
    • Resolution: Unresolved
    • 5.7.1, 5.8.0 RC
    • None
    • None
    • macOS 10.12.2
      Qt 5.8
    • 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
          322 kB
          Oleg Yadrov
        2. WindowModalBroken.jpg
          334 kB
          Oleg Yadrov

        Issue Links

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

          Activity

            People

              w00t Robin Burchell
              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