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

QPlatformWindow::initialGeometry() vs. QGuiApplication::screenAt()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.3.1, 6.6.1
    • GUI: Window management
    • None
    • Windows 10
      macOS 13
    • macOS, Windows

    Description

      When, for example, I have a 1500x1500 screen with 150% UI scaling factor connected to my Windows box, then QPlatformWindow::initialGeometry() fails to find the right screen in some cases.

      With the 150% factor, the widget's coordinate space is 0..999 in my example, while the native coordinates are 0..1499.
      The argument of  QPlatformWindow::initialGeometry() is expected (and given) in native coordinates 0..1499, whereas QGuiApplication::screenAt() expects coordinates in the range 0..999.

      Hence I believe either of the following changes should be applied:

      1. either QGuiApplication::screenAt(QHighDpi::fromNativePixels(initialGeometry.center(), w)) i.s.o. just QGuiApplication::screenAt(initialGeometry.center(), w)
      2. or the initialization of deviceIndependentRect moved upwards and then QGuiApplication::screenAt(deviceIndependentRect.center(), w) used

      Attachments

        Activity

          People

            vestbo Tor Arne Vestbø
            jan.patera Jan Patera
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: