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

The cached device pixel ratio value was stale on window expose.

    XMLWordPrintable

Details

    • Windows

    Description

      A minimal reproducer attached. Screen specs can be collected in 4 ways:
      1. A property "theScreen" whose "onTheScreenChanged" is implemented
      2. A function "getSpecs" that acts on "theScreen"
      3. "onScreenChanged" slot for Window
      4. Manual request on Button click

      To reproduce the issue, one needs dual monitors setup (2 monitors are better to have different specs, I have 1920x1200@125% as primary and 3840x2160@150% as secondary). To start with, press Win + P and select one monitor only mode, e.g. PC screen only.

      Then one can run the reproducer, and it will output correct screen specs from "onTheScreenChanged" and "getSpecs". Clicking the button, and one can also see the correct specs. In my case, the output is:

      qml: From Window.onTheScreenChanged: Current screen size: 1536x960; DPR: 1.25
      qml: From getSpecs: Current screen size: 1536x960; DPR: 1.25
      qml: From Button click, Window.screen: Current screen size: 1536x960; DPR: 1.25
      qml: From Button click, Window.theScreen: Current screen size: 1536x960; DPR: 1.25
      

      Those are the correct specs for my primary screen, and most of the behaviors are expected. Although I am not sure if it is expected that "onScreenChanged" is not triggered.

      The next step is to press Win + P again and switch to "Second screen only". This time, only "getSpecs" is triggered. The output is

      qml: From getSpecs: Current screen size: 2560x1440; DPR: 1.5
      qml: From getSpecs: Current screen size: 2560x1440; DPR: 1.5
      

      Although the specs are correct, it is little weird that the function is triggered twice. Also, "onTheScreenChanged" is not triggered either. "onScreenChanged" is still not triggered. Clicking the button, one can still read the correct specs though.

      Then switch back to "PC screen only". The behavior is quite similar but with a warning:

      The cached device pixel ratio value was stale on window expose.  Please file a QTBUG which explains how to reproduce.
      qml: From getSpecs: Current screen size: 1536x960; DPR: 1.25
      qml: From getSpecs: Current screen size: 1536x960; DPR: 1.25
      

      The warning is the main concern of this bug report. And no other signals except for "getSpecs" are triggered as before. Requesting specs from clicking button is still accurate.

      So in short, among the 4 methods, only "getSpecs" and manual request by clicking work as expected. The others are more or less "staled". And there is the warning message about this issue, although I am not sure which "stale" it refers to.

      Attachments

        1. QTBUG-134724.7z
          2 kB
          Luqiao Chen
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            owolff Oliver Wolff
            luqiaochen Luqiao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes