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

Setting Window.contentOrientation breaks Popup on regular desktop

    XMLWordPrintable

Details

    • a1a024194 (dev), a11c89c16 (6.6), eb653882a (dev), af30efb07 (6.6), 07e269f62 (tqtc/lts-6.5), 79474b087 (dev), d8a4fda90 (6.6), d0fcada55 (dev), 084d28781 (tqtc/lts-6.5), c61525f3a (dev), a4a5d63fa (6.7), 61fa31707 (6.6), 7169e3f1f (dev), b8c8a438c (6.7)

    Description

      Code

      https://doc.qt.io/qt-6/qml-qtquick-window.html#contentOrientation-prop says, "The recommended orientation is Screen.orientation" so we expect this code to work fine:

      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
          id: window
          width: 640
          height: 480
          visible: true
          contentOrientation: Screen.orientation
      
          Button {
              text: "Open"
              onClicked: popup.open()
          }
      
          Popup {
              id: popup
              anchors.centerIn: parent
              width: 320
              height: 240
              modal: true
              focus: true
              closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
          }
      }
      

       

      Expected outcome when clicking the Button

      Popup has Landscape orientation, just like the Window. The dimming Overlay completely covers the Window at all times.

       

      Actual outcome when clicking the Button

      The Popup is rotated 90 degrees, and the dimming Overlay's width is determined by the window's height.

       

      Platform comparisons
      Here are some more detailed tests on 3 desktop platforms, using Qt 6.5.3 on a "normal" landscape desktop screen.

      • "Looks good" means the Overlay fully covers the Window and the Popup has landscape orientation
      • Red text means unexpected result
      • Notice that Screen.orientation behaves differently on macOS compared to Windows/Linux

       

      contentOrientation value Looks good on Windows Looks good on Linux Looks good on macOS
      Qt.PrimaryOrientation Yes Yes Yes
      Qt.LandscapeOrientation No No No
      Qt.PortraitOrientation Yes Yes (Looks normal with -platform xcb, whole window rotated with -platform wayland) Yes
      Screen.orientation No No Yes

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-115536
          # Subject Branch Project Status CR V

          Activity