Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.0.0 Beta2
-
None
Description
I noticed when writing QML that Creator syntax completion was offering me ScreenInfo, and tried to figure out why. Screen is the attached property of interest, e.g. you can do something like
Text { text: "DPR " + Screen.devicePixelRatio + " pixelDensity " + Screen.pixelDensity.toFixed(2) + " size " + Screen.width + "x" + Screen.height }
and it will stay up-to-date when you drag that window onto a different screen. Creator lets you write ScreenInfo instead, and it runs, but those properties are undefined, so it's not useful.
At one time we had qtdeclarative/examples/quick/window/ScreenInfo.qml and an instance was created by declaring ScreenInfo { } in that example only. Then that was changed in https://codereview.qt-project.org/c/qt/qtdeclarative/+/171816. As of https://codereview.qt-project.org/c/qt/qtdeclarative/+/273410 we had
QML_UNCREATABLE("ScreenInfo can only be used via the attached property.")
and it's true that QQuickScreenInfo is the C++ class behind the Screen attached property, but I don't think we ever meant to make it possible to use ScreenInfo as its QML name, did we? But that's where we seem to have ended up, and I think it's redundant (but maybe I'm missing something?)