Obsolete Members for Screen

The following members of QML type Screen 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

附加特性

附加特性文档编制

[read-only] Screen.desktopAvailableHeight : int

This contains the available height of the collection of screens which make up the virtual desktop, in pixels, excluding window manager reserved areas such as task bars and system menus. If you want to position a Window at the bottom of the desktop, you can bind to it like this:

y: Screen.desktopAvailableHeight - height
						

该特性在 Qt 5.1 引入。

[read-only] Screen.desktopAvailableWidth : int

This contains the available width of the collection of screens which make up the virtual desktop, in pixels, excluding window manager reserved areas such as task bars and system menus. If you want to position a Window at the right of the desktop, you can bind to it like this:

x: Screen.desktopAvailableWidth - width
							

该特性在 Qt 5.1 引入。

[read-only] Screen.devicePixelRatio : real

The ratio between physical pixels and device-independent pixels for the screen.

Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.

该特性在 Qt 5.4 引入。

[read-only] Screen.height : int

This contains the height of the screen in pixels.

[read-only] Screen.manufacturer : string

The manufacturer of the screen.

该特性在 Qt 5.10 引入。

[read-only] Screen.model : string

The model of the screen.

该特性在 Qt 5.10 引入。

[read-only] Screen.name : string

The name of the screen.

该特性在 Qt 5.1 引入。

[read-only] Screen.orientation : Qt::ScreenOrientation

This contains the current orientation of the screen, from the accelerometer (if any). On a desktop computer, this value typically does not change.

primaryOrientation == orientation, it means that the screen automatically rotates all content which is displayed, depending on how you hold it. But if orientation changes while primaryOrientation does NOT change, then probably you are using a device which does not rotate its own display. In that case you may need to use Item.rotation or Item.transform to rotate your content.

注意: This property does not update unless a Screen::orientationUpdateMask is set to a value other than 0 .

Screen.orientationUpdateMask : Qt::ScreenOrientations

This contains the update mask for the orientation. Screen::orientation only emits changes for the screen orientations matching this mask.

By default it is set to the value of the QScreen that the window uses.

该特性在 Qt 5.4 引入。

[read-only] Screen.pixelDensity : real

The number of physical pixels per millimeter.

该特性在 Qt 5.2 引入。

[read-only] Screen.primaryOrientation : Qt::ScreenOrientation

This contains the primary orientation of the screen. If the screen's height is greater than its width, then the orientation is Qt.PortraitOrientation; otherwise it is Qt.LandscapeOrientation.

If you are designing an application which changes its layout depending on device orientation, you probably want to use primaryOrientation to determine the layout. That is because on a desktop computer, you can expect primaryOrientation to change when the user rotates the screen via the operating system's control panel, even if the computer does not contain an accelerometer. Likewise on most handheld computers which do have accelerometers, the operating system will rotate the whole screen automatically, so again you will see the primaryOrientation change.

[read-only] Screen.serialNumber : string

The serial number of the screen.

该特性在 Qt 5.10 引入。

[read-only] Screen.virtualX : int

The x coordinate of the screen within the virtual desktop.

该特性在 Qt 5.9 引入。

[read-only] Screen.virtualY : int

The y coordinate of the screen within the virtual desktop.

该特性在 Qt 5.9 引入。

[read-only] Screen.width : int

This contains the width of the screen in pixels.