API Documentation

Documentation for developing SailfishOS applications

Sailfish.Silica.Screen QML Type

Provides device display attributes More...

Import Statement: import Sailfish.Silica 1.0

Properties

Detailed Description

The Screen object exposes attributes of the device display. This is a singleton object; the Screen type cannot be instantiated.

For example, the window below uses the Screen object to show a different starting page depending on the size of the screen:

 import QtQuick 2.2
 import Sailfish.Silica 1.0

 ApplicationWindow {
     initialPage: Screen.sizeCategory >= Screen.Large
                  ? Qt.resolvedUrl("SplitViewPage.qml")
                  : Qt.resolvedUrl("ListViewPage.qml")
 }

Property Documentation

height : int

The larger of the screen dimensions. For example with a 540x960 display the height would return 960. The value is static and does not follow the device orientation.


sizeCategory : enumeration

The physical size of the screen categorized into size groups.

The value of the property may be one of:

  • Screen.Small
  • Screen.Medium
  • Screen.Large
  • Screen.ExtraLarge

Typical phone and tablet devices are in Screen.Medium and Screen.Large categories, respectively.


width : int

The smaller of the screen dimensions. For example with a 540x960 display the width would return 540. The value is static and does not follow the device orientation.


widthRatio : qreal

The width ratio relative to the 540 pixels wide qHD display. The value is 1.33 for 720 pixel wide HD display, 2.0 for 1080 pixel wide Full HD display and so on. The ratio is useful for scaling UI geometry parameters relative to the display size. For most content items you want to scale the dimensions based on Theme.pixelRatio (that roughly follows DPI) instead to be able show more content on larger displays, but there are some billboard style titles and graphic banners that should follow the growth of display's physical dimensions.


We use cookies to improve your user experience and to help us to develop our services. By continuing to browse the site, you approve of our use of cookies.