Screen class properties problem in QML documents
-
Hi,
after a set of tests with the debug on simulator and a couple of Symbian^3 devices over a Windows 7 platform I have found a Issue in the Screen class of the last Qt SDK package.
The development environment is the following: Qt SDK 1.1.3 + Qt 4.7.4 + Qt Creator 2.3.0:
@
Window {
id: window// Test point - one of the following two lines alternate. width: Screen.width
// width: Screen.displayWidth
PageStack { id: pageStack anchors { left: parent.left; right: parent.right; top: parent.top bottom: parent.bottom } } Component.onCompleted: { pageStack.push(Qt.resolvedUrl("MainPage.qml")) }
}
@
The assignement of the value results always 0. width and height are shown as type real and these Screen properties in the documentation are shown as type int (I think compatible values). There are no errors at runtime but the value is always 0.About Screen.height (and relative width property) the documentation reports:
bq. The screen height in pixels. The value changes when the orientation changes: in the portrait mode the height is bigger than width and in the landscape mode vice versa.
About Screen.displayHeight (and relative displayWidth property) the documetation reports:
bq. The native height of the display, that is, the height of the screen when rotation returns zero.
There are not notes about these values if they can't be assigned explicitly to the size of an object. In the axample above I have used the Window element of the main.qml page but I have applied the same assignation to other Page QML documents with the same result. Same results also when using these values to check the actual width / height of a object to resize some elments in it depending by the actual device orientation.
It seems that these four values are always 0 in all cases. Is there something that I missed?
-
keeping more unreadable the means of this class there is the code snipped example in the same Screen element documentation:
bq. You can use the property to lock the screen to a certain orientation. The following code example locks the screen to the landscape orientation.
@
function lockToLandscape() {
screen.allowedOrientation = Screen.Landscape
}
@What is and where should be defined the screen element that the function uses assigning to it the Screen.Landscape property ?
-
Posted the bug report "#QTCOMPONENTS-1082":https://bugreports.qt.nokia.com/browse/QTCOMPONENTS-1082. Now wait that it find an answer.