内容表

上一话题

QResizeEvent

下一话题

QScrollEvent

QScreen

QScreen class is used to query screen properties. 更多

Inheritance diagram of PySide2.QtGui.QScreen

详细描述

A note on logical vs physical dots per inch: physical DPI is based on the actual physical pixel sizes when available, and is useful for print preview and other cases where it’s desirable to know the exact physical dimensions of screen displayed contents.

Logical dots per inch are used to convert font and user interface elements from point sizes to pixel sizes, and might be different from the physical dots per inch. The logical dots per inch are sometimes user-settable in the desktop environment’s settings panel, to let the user globally control UI and font sizes in different applications.

PySide2.QtGui.QScreen. angleBetween ( a , b )
参数
  • a ScreenOrientation

  • b ScreenOrientation

返回类型

int

Convenience function to compute the angle of rotation to get from rotation a to rotation b .

结果会是 0、90、180 或 270。

PrimaryOrientation is interpreted as the screen’s primaryOrientation() .

PySide2.QtGui.QScreen. availableGeometry ( )
返回类型

QRect

PySide2.QtGui.QScreen. availableGeometryChanged ( geometry )
参数

geometry QRect

PySide2.QtGui.QScreen. availableSize ( )
返回类型

QSize

PySide2.QtGui.QScreen. availableVirtualGeometry ( )
返回类型

QRect

PySide2.QtGui.QScreen. availableVirtualSize ( )
返回类型

QSize

PySide2.QtGui.QScreen. depth ( )
返回类型

int

PySide2.QtGui.QScreen. devicePixelRatio ( )
返回类型

qreal

PySide2.QtGui.QScreen. geometry ( )
返回类型

QRect

PySide2.QtGui.QScreen. geometryChanged ( geometry )
参数

geometry QRect

PySide2.QtGui.QScreen. grabWindow ( window [ , x=0 [ , y=0 [ , w=-1 [ , h=-1 ] ] ] ] )
参数
  • window WId

  • x int

  • y int

  • w int

  • h int

返回类型

QPixmap

创建并返回通过抓取内容构造的像素图,为给定 window 限定通过 QRect ( x , y , width , height ).

自变量 ( x , y ) 指定窗口偏移,而 ( width , height ) 指定要拷贝区域。若 width 为负,则函数把所有内容拷贝到窗口右边界。若 height 为负,则函数把所有内容拷贝到窗口底部。

偏移和尺寸自变量采用与设备无关的像素为单位进行指定。返回像素图可能大于请求尺寸,当抓取高 DPI 屏幕时。调用 devicePixelRatio() to determine if this is the case.

窗口系统标识符 ( WId ) 可以被检索使用 winId() function. The rationale for using a window identifier and not a QWidget ,允许抓取不属于应用程序的窗口、窗口系统框架、等等。

警告

抓取不属于应用程序的窗口在 iOS 系统不被支持,sandboxing/security 阻止读取应用程序不拥有的窗口像素。

The function grabs pixels from the screen, not from the window, i.e. if there is another window partially or entirely over the one you grab, you get pixels from the overlying window, too. The mouse cursor is generally not grabbed.

注意:在 X11 若给定 window doesn’t have the same depth as the root window, and another window partially or entirely obscures the one you grab, you will not 获取上方窗口的像素。像素图遮盖区域的内容将是未定义和未初始化的。

在 Windows Vista 及更高版本抓取分层窗口,其被创建通过设置 WA_TranslucentBackground 属性, 会不工作。相反,抓取桌面 Widget 应该工作。

警告

通常,抓住屏幕外区域是不安全的。这取决于底层窗口系统。

PySide2.QtGui.QScreen. isLandscape ( orientation )
参数

orientation ScreenOrientation

返回类型

bool

便利函数,返回 true if o 为横向或倒置横向;否则返回 false .

PrimaryOrientation is interpreted as the screen’s primaryOrientation() .

PySide2.QtGui.QScreen. isPortrait ( orientation )
参数

orientation ScreenOrientation

返回类型

bool

便利函数,返回 true if o 为纵向或倒置纵向;否则返回 false .

PrimaryOrientation is interpreted as the screen’s primaryOrientation() .

PySide2.QtGui.QScreen. logicalDotsPerInch ( )
返回类型

qreal

PySide2.QtGui.QScreen. logicalDotsPerInchChanged ( dpi )
参数

dpi qreal

PySide2.QtGui.QScreen. logicalDotsPerInchX ( )
返回类型

qreal

PySide2.QtGui.QScreen. logicalDotsPerInchY ( )
返回类型

qreal

PySide2.QtGui.QScreen. manufacturer ( )
返回类型

unicode

PySide2.QtGui.QScreen. mapBetween ( a , b , rect )
参数
  • a ScreenOrientation

  • b ScreenOrientation

  • rect QRect

返回类型

QRect

在 2 屏幕取向之间映射 rect 矩形。

This will flip the x and y dimensions of the rectangle rect if the orientation a is PortraitOrientation or InvertedPortraitOrientation and orientation b is LandscapeOrientation or InvertedLandscapeOrientation , or vice versa.

PrimaryOrientation is interpreted as the screen’s primaryOrientation() .

PySide2.QtGui.QScreen. model ( )
返回类型

unicode

PySide2.QtGui.QScreen. name ( )
返回类型

unicode

PySide2.QtGui.QScreen. nativeOrientation ( )
返回类型

ScreenOrientation

PySide2.QtGui.QScreen. orientation ( )
返回类型

ScreenOrientation

PySide2.QtGui.QScreen. orientationChanged ( orientation )
参数

orientation ScreenOrientation

PySide2.QtGui.QScreen. orientationUpdateMask ( )
返回类型

ScreenOrientations

Returns the currently set orientation update mask.

PySide2.QtGui.QScreen. physicalDotsPerInch ( )
返回类型

qreal

PySide2.QtGui.QScreen. physicalDotsPerInchChanged ( dpi )
参数

dpi qreal

PySide2.QtGui.QScreen. physicalDotsPerInchX ( )
返回类型

qreal

PySide2.QtGui.QScreen. physicalDotsPerInchY ( )
返回类型

qreal

PySide2.QtGui.QScreen. physicalSize ( )
返回类型

QSizeF

PySide2.QtGui.QScreen. physicalSizeChanged ( size )
参数

size QSizeF

PySide2.QtGui.QScreen. primaryOrientation ( )
返回类型

ScreenOrientation

PySide2.QtGui.QScreen. primaryOrientationChanged ( orientation )
参数

orientation ScreenOrientation

PySide2.QtGui.QScreen. refreshRate ( )
返回类型

qreal

PySide2.QtGui.QScreen. refreshRateChanged ( refreshRate )
参数

refreshRate qreal

PySide2.QtGui.QScreen. serialNumber ( )
返回类型

unicode

PySide2.QtGui.QScreen. setOrientationUpdateMask ( mask )
参数

mask ScreenOrientations

Sets the orientations that the application is interested in receiving updates for in conjunction with this screen.

For example, to receive orientation() updates and thus have orientationChanged() signals being emitted for LandscapeOrientation and InvertedLandscapeOrientation, call with mask 设为 LandscapeOrientation | InvertedLandscapeOrientation .

The default, 0, means no orientationChanged() signals are fired.

PySide2.QtGui.QScreen. size ( )
返回类型

QSize

PySide2.QtGui.QScreen. transformBetween ( a , b , target )
参数
  • a ScreenOrientation

  • b ScreenOrientation

  • target QRect

返回类型

QTransform

Convenience function to compute a transform that maps from the coordinate system defined by orientation a into the coordinate system defined by orientation b and target dimensions target .

范例, a is Qt::Landscape, b is Qt::Portrait, and target is QRect (0, 0, w, h) the resulting transform will be such that the point QPoint (0, 0) is mapped to QPoint (0, w), and QPoint (h, w) is mapped to QPoint (0, h). Thus, the landscape coordinate system QRect (0, 0, h, w) is mapped (with a 90 degree rotation) into the portrait coordinate system QRect (0, 0, w, h).

PrimaryOrientation is interpreted as the screen’s primaryOrientation() .

PySide2.QtGui.QScreen. virtualGeometry ( )
返回类型

QRect

PySide2.QtGui.QScreen. virtualGeometryChanged ( rect )
参数

rect QRect

PySide2.QtGui.QScreen. virtualSiblingAt ( point )
参数

point QPoint

返回类型

QScreen

返回屏幕,位于 point within the set of virtualSiblings() ,或 nullptr 若在任何屏幕之外。

point is in relation to the virtualGeometry() of each set of virtual siblings.

PySide2.QtGui.QScreen. virtualSiblings ( )
返回类型

Get the screen’s virtual siblings.

The virtual siblings are the screen instances sharing the same virtual desktop. They share a common coordinate system, and windows can freely be moved or positioned across them without having to be re-created.

PySide2.QtGui.QScreen. virtualSize ( )
返回类型

QSize