QScreenclass is used to query screen properties. 更多 …
def
angleBetween
(a, b)
def
availableGeometry
()
def
availableSize
()
def
availableVirtualGeometry
()
def
availableVirtualSize
()
def
depth
()
def
devicePixelRatio
()
def
geometry
()
def
grabWindow
(window[, x=0[, y=0[, w=-1[, h=-1]]]])
def
isLandscape
(orientation)
def
isPortrait
(orientation)
def
logicalDotsPerInch
()
def
logicalDotsPerInchX
()
def
logicalDotsPerInchY
()
def
manufacturer
()
def
mapBetween
(a, b, rect)
def
model
()
def
name
()
def
nativeOrientation
()
def
orientation
()
def
orientationUpdateMask
()
def
physicalDotsPerInch
()
def
physicalDotsPerInchX
()
def
physicalDotsPerInchY
()
def
physicalSize
()
def
primaryOrientation
()
def
refreshRate
()
def
serialNumber
()
def
setOrientationUpdateMask
(mask)
def
size
()
def
transformBetween
(a, b, target)
def
virtualGeometry
()
def
virtualSiblingAt
(point)
def
virtualSiblings
()
def
virtualSize
()
def
availableGeometryChanged
(geometry)
def
geometryChanged
(geometry)
def
logicalDotsPerInchChanged
(dpi)
def
orientationChanged
(orientation)
def
physicalDotsPerInchChanged
(dpi)
def
physicalSizeChanged
(size)
def
primaryOrientationChanged
(orientation)
def
refreshRateChanged
(refreshRate)
def
virtualGeometryChanged
(rect)
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
创建并返回通过抓取内容构造的像素图,为给定
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
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