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

Cannot compare screen property of Window

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.2, 6.0 (Next Major Release)
    • Fix Version/s: None
    • Labels:
      None

      Description

      It's not possible to compare the screen property of a Window with a screen from e.g. the Qt.application.screens array.

      To reproduce, run the following example and move the window between two screens.

      import QtQuick 2.12
      import QtQuick.Controls 2.12
      import QtQuick.Window 2.12
      
      ApplicationWindow {
          id: window
          width: 400
          height: 400
          visible: true
          onScreenChanged: print(screen, Qt.application.screens[0])
      }
      

      Even though they are the same screens, the QQuickScreenInfo objects are different. A workaround is to compare the names of the screen.

      In addition, the screen property returns a new QQuickScreenInfo object each time it's called, which seems wasteful.

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes