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

Incorrect positioning of Popup elements (and its descendants) when using multiple monitors and Windows display scaling

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.4
    • Quick: Controls 2
    • OS Windows 11 Pro
      Processor 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz 2.80 GHz
      Installed RAM 32,0 GB (31,7 GB usable)
      System type 64-bit operating system, x64-based processor

    • Windows

    Description

      Incorrect positioning of Popup elements (and its descendants) when using multiple monitors and Windows display scaling

      I have a laptop connected to an external monitor. Notebook display resolution 1920x1080, external monitor display resolution 1920x1080. In the display settings of Windows 11, for the built-in display of the laptop, scaling is set to 125%, for the external display, scaling is set to 100% (i.e. actually disabled). The desktop extension mode is set to the right side of the external monitor display.

      Next, I create a new Qt Quick Application project in Qt Creator (version 7.0.2). Here is the content of the main.qml file:

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
          width: 800
          height: 600
          visible: true
          title: qsTr("Hello World")
      
          MouseArea {
              anchors.fill: parent
      
              onClicked: {
                  contextMenu.popup()
              }
      
              Menu {
                  id: contextMenu
                 
                  MenuItem { text: "Cut" }
                  MenuItem { text: "Copy" }
                  MenuItem { text: "Paste" }
              }
          }
      }
      
      

      Now let's run this application. If the application window is displayed entirely on one display, then when clicking on the window area, the upper left corner of the pop-up menu is displayed near the mouse pointer (if the click coordinates, the dimensions of the main window and the dimensions of the pop-up menu are such that when the upper left corner of the pop-up menu is displayed near the mouse pointer, it does not fit into the application window, then the pop-up menu rests on the bottom or right edge of the main window.). This describes the expected behavior.

      The desktop extension mode is set to the right side of the external monitor display.

      Now let's try to move the application window to the right partially to the second display. At some point, when most of the window is on the second display, the second display's scaling (which is specified as 100%) will be applied to it, i.e. the application window scaling will be changed from 125% to 100%. As soon as the new scaling is applied, stop moving the application window and try to make a few clicks on the part of the window that remains on the main display (laptop display). Now the pop-up menu is displayed not at all next to the mouse pointer, the pop-up menu is displayed above and to the left of the mouse pointer at some distance from it (except for clicks near the left and top borders of the window).

      Attachments

        1. Error_behavior.mp4
          2.14 MB
        2. Ok_behavior.mp4
          362 kB

        Issue Links

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              rumgot rumgot
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: