Screen is a class that gives you physical information about the display of the device and its orientation. More...
This element was introduced in qt-components 4.7.
This class provides access to the screen properties, like the resolution, the orientation and the dpi.
Screen is exposed as a context property called "screen". It is not possible to instantiate a Screen object in QML, but the screen must be accessed through the context property.
allowSwipe : bool |
MeeGo 1.2 Harmattan-specific property
Allows to switch off the swipe gesture. As a result the user won’t be able to close the application and he won't be able to push it to the background.
Caution: This feature should not be used unless there are very good reasons: The swipe gesture is an essential gesture that the user can rely on. Therefore switching it off is usually a bad idea.
In case of use (e.g. for games) please regard the following guidelines:
allowedOrientations : enumeration |
The allowed orientations for the screen. The property accepts any combination of Screen::Orientations flags.
The property is used for locking the screen to a certain orientation, like this:
function lockToLandscape() { screen.allowedOrientation = Screen.Landscape }
Or it can be used for letting the orientation change freely according to the actual physical orientation of the device, like this:
function setAutomaticOrientation() { screen.allowedOrientation = Screen.All // equals to: // screen.allowedOrientation = Screen.Portrait | Screen.Landscape | // Screen.PortraitInverted | Screen.LandscapeInverted }
Notice that typically orientation is controlled by the Page component. This property should be used explicitly only if Page is not used at all, or if Page::orientationLock property is set to PageOrientation.Manual.
See also currentOrientation and Page::orientationLock.
covered : bool |
MeeGo 1.2 Harmattan-specific property
Returns true if the screen is covered.
currentOrientation : enumeration |
The current orientation of the screen. The possible values are:
The actual possible values may depend on hardware. For instance, some devices support only one orientation, or some devices do not support inverted orientations.
Notice that this is a read-only property. For setting the orientation use allowedProperties or Page::orientationLock
See also allowedOrientations and Page::orientationLock.
density : enumeration |
Screen classification based on the dpi value of the screen.
Illustration of density mappings
See also displayCategory.
displayCategory : enumeration |
Screen classification based on the physical size (diagonal) of the screen.
This property can be used for example for selecting different top level layouts for different display categories:
Page { Loader { source: (screen.displayCategory == Screen.Small) ? "SmallView.qml" : "NormalView.qml" ... } }
Illustration of displayCategory mappings
See also density.
displayHeight : int |
The native height of the display in pixels, that is the height of the screen when rotation returns zero.
See also rotation.
displayWidth : int |
The native width of the display in pixels, that is the width of the screen when rotation returns zero.
See also rotation.
dpi : qreal |
The dots per inch value of the screen. It is assumed that the pixels are square, so in theory the value might not be 100% accurate.
keyboardOpen : bool |
MeeGo 1.2 Harmattan-specific property
Returns true if the virtual keyboard is shown on the screen.
minimized : bool |
MeeGo 1.2 Harmattan-specific property
Returns true if the application is minimized to the switcher.
orientationString : string |
MeeGo 1.2 Harmattan-specific property
Returns the current orientation as a String ("Portrait", "Landscape", "PortraitInverted" or "LandscapeInverted").
rotation : int |
The rotation angle of the (logical content of the) screen, measured counter-clockwise relative to the native orientation of the device. If the rotation is zero it means that the screen is in the native orientation of the device.
The value is always non-negative. The actual possible values may depend on hardware.
See also displayWidth and displayHeight.
MeeGo 1.2 Harmattan-specific property
An object giving various informations about the state of the windowState.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.