CopperSpice API
1.9.2
|
The QScreen class is used to query screen properties. More...
Public Signals | |
void | availableGeometryChanged (const QRect &geometry) |
void | geometryChanged (const QRect &geometry) |
void | logicalDotsPerInchChanged (qreal dpi) |
void | orientationChanged (Qt::ScreenOrientation orientation) |
void | physicalDotsPerInchChanged (qreal dpi) |
void | physicalSizeChanged (const QSizeF &size) |
void | primaryOrientationChanged (Qt::ScreenOrientation orientation) |
void | refreshRateChanged (qreal refreshRate) |
void | virtualGeometryChanged (const QRect &rect) |
Public Signals inherited from QObject | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Public Methods | |
~QScreen () | |
int | angleBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b) const |
QRect | availableGeometry () const |
QSize | availableSize () const |
QRect | availableVirtualGeometry () const |
QSize | availableVirtualSize () const |
int | depth () const |
qreal | devicePixelRatio () const |
QRect | geometry () const |
QPixmap | grabWindow (WId window, int x=0, int y=0, int width=-1, int height=-1) |
QPlatformScreen * | handle () const |
bool | isLandscape (Qt::ScreenOrientation orientation) const |
bool | isPortrait (Qt::ScreenOrientation orientation) const |
qreal | logicalDotsPerInch () const |
qreal | logicalDotsPerInchX () const |
qreal | logicalDotsPerInchY () const |
QRect | mapBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const |
QString | name () const |
Qt::ScreenOrientation | nativeOrientation () const |
Qt::ScreenOrientation | orientation () const |
Qt::ScreenOrientations | orientationUpdateMask () const |
qreal | physicalDotsPerInch () const |
qreal | physicalDotsPerInchX () const |
qreal | physicalDotsPerInchY () const |
QSizeF | physicalSize () const |
Qt::ScreenOrientation | primaryOrientation () const |
qreal | refreshRate () const |
void | setOrientationUpdateMask (Qt::ScreenOrientations mask) |
QSize | size () const |
QTransform | transformBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const |
QRect | virtualGeometry () const |
QList< QScreen * > | virtualSiblings () const |
QSize | virtualSize () const |
Public Methods inherited from QObject | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
Properties | |
availableGeometry | |
Screen's available geometry in pixels. More... | |
availableSize | |
Screen's available size in pixels. More... | |
availableVirtualGeometry | |
Available geometry of the virtual desktop to which this screen belongs. More... | |
availableVirtualSize | |
Available size of the virtual desktop to which this screen belongs. More... | |
depth | |
Color depth of the screen. More... | |
devicePixelRatio | |
Screen's ratio between physical pixels and device-independent pixels. More... | |
geometry | |
Screen's geometry in pixels. More... | |
logicalDotsPerInch | |
Number of logical dots or pixels per inch. More... | |
logicalDotsPerInchX | |
Number of logical dots or pixels per inch in the horizontal direction. More... | |
logicalDotsPerInchY | |
Number of logical dots or pixels per inch in the vertical direction. More... | |
name | |
User presentable string representing the screen. More... | |
nativeOrientation | |
Native screen orientation. More... | |
orientation | |
Screen orientation. More... | |
physicalDotsPerInch | |
Number of physical dots or pixels per inch. More... | |
physicalDotsPerInchX | |
Number of physical dots or pixels per inch in the horizontal direction. More... | |
physicalDotsPerInchY | |
Number of physical dots or pixels per inch in the vertical direction. More... | |
physicalSize | |
Screen's physical size (in millimeters) More... | |
primaryOrientation | |
Primary screen orientation. More... | |
refreshRate | |
Approximate vertical refresh rate of the screen in Hz. More... | |
size | |
virtualGeometry | |
the pixel geometry of the virtual desktop to which this screen belongs More... | |
virtualSize | |
Pixel size of the virtual desktop to which this screen belongs. More... | |
Properties inherited from QObject | |
objectName | |
Friends | |
class | QPlatformIntegration |
class | QPlatformScreen |
Additional Inherited Members | |
Public Slots inherited from QObject | |
void | deleteLater () |
Static Public Methods inherited from QObject | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Protected Methods inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
The QScreen class is used to query screen properties.
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 is 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.
QScreen::~QScreen | ( | ) |
Destroys the screen.
int QScreen::angleBetween | ( | Qt::ScreenOrientation | a, |
Qt::ScreenOrientation | b | ||
) | const |
Computes the angle of rotation to get from rotation a to rotation b. The result will be 0, 90, 180, or 270. Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
QRect QScreen::availableGeometry | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the value of the property changes. The specified geometry represents the updated value.
QSize QScreen::availableSize | ( | ) | const |
Returns the value of the property.
QRect QScreen::availableVirtualGeometry | ( | ) | const |
Returns the value of the property.
QSize QScreen::availableVirtualSize | ( | ) | const |
Returns the value of the property.
int QScreen::depth | ( | ) | const |
Returns the value of the property.
qreal QScreen::devicePixelRatio | ( | ) | const |
Returns the value of the property.
QRect QScreen::geometry | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the value of the property changes. The specified geometry represents the updated value.
QPixmap QScreen::grabWindow | ( | WId | window, |
int | x = 0 , |
||
int | y = 0 , |
||
int | width = -1 , |
||
int | height = -1 |
||
) |
Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by QRect(x, y, width, height).
The arguments (x, y) specify the offset in the window, whereas (width, height) specify the area to be copied. If width is negative, the function copies everything to the right border of the window. If height is negative this method copies everything to the bottom of the window.
The window system identifier (WId) can be retrieved calling QWidget::winId(). The rationale for using a window identifier and not a QWidget is to enable grabbing of windows which are not part of the application. This method grabs pixels from the screen, not from the window. If there is another window overlapping pixels from the other window will be part of the grab. The mouse cursor is generally not grabbed.
On X11 if the given window does not have the same depth as the root window, and another window partially or entirely obscures the one you grab, you will not get pixels from the overlying window. The contents of the obscured areas in the pixmap will be uninitialized.
On Windows Vista and above grabbing a layered window, which is created by setting the Qt::WA_TranslucentBackground attribute, will not work. Instead grabbing the desktop widget should work.
QPlatformScreen * QScreen::handle | ( | ) | const |
Get the platform screen handle.
bool QScreen::isLandscape | ( | Qt::ScreenOrientation | orientation | ) | const |
Returns true if orientation is either landscape or inverted landscape, otherwise returns false. Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
bool QScreen::isPortrait | ( | Qt::ScreenOrientation | orientation | ) | const |
Returns true if orientation is either portrait or inverted portrait, otherwise returns false. Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
qreal QScreen::logicalDotsPerInch | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the value of the property changes. The specified dpi represents the updated value.
qreal QScreen::logicalDotsPerInchX | ( | ) | const |
Returns the value of the property.
qreal QScreen::logicalDotsPerInchY | ( | ) | const |
Returns the value of the property.
QRect QScreen::mapBetween | ( | Qt::ScreenOrientation | a, |
Qt::ScreenOrientation | b, | ||
const QRect & | rect | ||
) | const |
Maps the rect between two screen orientations.
This will flip the x and y dimensions of the rectangle rect if the orientation a is Qt::PortraitOrientation or Qt::InvertedPortraitOrientation and orientation b is Qt::LandscapeOrientation or Qt::InvertedLandscapeOrientation, or vice versa.
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
QString QScreen::name | ( | ) | const |
Returns the value of the property.
Qt::ScreenOrientation QScreen::nativeOrientation | ( | ) | const |
Returns the value of the property.
Qt::ScreenOrientation QScreen::orientation | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the orientation of the screen changes with orientation as an argument.
Qt::ScreenOrientations QScreen::orientationUpdateMask | ( | ) | const |
Returns the currently set orientation update mask.
qreal QScreen::physicalDotsPerInch | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the value of the property changes. The specified dpi represents the updated value.
qreal QScreen::physicalDotsPerInchX | ( | ) | const |
Returns the value of the property.
qreal QScreen::physicalDotsPerInchY | ( | ) | const |
Returns the value of the property.
QSizeF QScreen::physicalSize | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the value of the property changes. The specified size represents the updated value.
Qt::ScreenOrientation QScreen::primaryOrientation | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the primary orientation of the screen changes with orientation as an argument.
qreal QScreen::refreshRate | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the value of the property changes. The specified refreshRate represents the updated value.
void QScreen::setOrientationUpdateMask | ( | Qt::ScreenOrientations | mask | ) |
Sets the orientations that the application is interested in receiving updates for in conjunction with this screen.
As an example, to receive orientation() updates and thus have orientationChanged() signals being emitted for LandscapeOrientation and InvertedLandscapeOrientation, call setOrientationUpdateMask() with mask set to Qt::LandscapeOrientation | Qt::InvertedLandscapeOrientation.
The default of 0 means no orientationChanged() signals are emitted.
QSize QScreen::size | ( | ) | const |
Returns the value of the property.
QTransform QScreen::transformBetween | ( | Qt::ScreenOrientation | a, |
Qt::ScreenOrientation | b, | ||
const QRect & | target | ||
) | const |
Computes a transform that maps from the coordinate system defined by orientation a into the coordinate system defined by orientation b and target dimensions target.
As an example, the value for a is Qt::Landscape, the value for b is Qt::Portrait, and the value for target is QRect(0, 0, w, h). The resulting transform will place the point QPoint(0, 0) at 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).
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
QRect QScreen::virtualGeometry | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the value of the property changes. The specified rect represents the updated value.
QList< QScreen * > QScreen::virtualSiblings | ( | ) | const |
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 recreated.
QSize QScreen::virtualSize | ( | ) | const |
Returns the value of the property.
|
The available geometry is the geometry excluding window manager reserved areas such as task bars and system menus.
Properties | Class Methods |
---|---|
read | availableGeometry |
notify | availableGeometryChanged |
|
The available size is the size excluding window manager reserved areas such as task bars and system menus.
Properties | Class Methods |
---|---|
read | availableSize |
notify | availableGeometryChanged |
|
Returns the available geometry of the virtual desktop corresponding to this screen. This is the union of the virtual siblings' individual available geometries.
Properties | Class Methods |
---|---|
read | availableVirtualGeometry |
notify | virtualGeometryChanged |
|
Returns the available pixel size of the virtual desktop corresponding to this screen. This is the combined size of the virtual siblings' individual available geometries.
Properties | Class Methods |
---|---|
read | availableVirtualSize |
notify | virtualGeometryChanged |
|
Color depth of the screen.
Properties | Class Methods |
---|---|
read | depth |
constant | true |
|
Returns the ratio between physical pixels and device-independent pixels for the screen. Common values are 1.0 on normal displays and 2.0 on "retina" displays. Higher values are also possible.
Properties | Class Methods |
---|---|
read | devicePixelRatio |
notify | physicalDotsPerInchChanged |
|
As an example this might return QRect(0, 0, 1280, 1024), or in a virtual desktop setting QRect(1280, 0, 1280, 1024).
Properties | Class Methods |
---|---|
read | geometry |
notify | geometryChanged |
|
This value can be used to convert font point sizes to pixel sizes. This is a convenience property that's simply the average of the logicalDotsPerInchX and logicalDotsPerInchY properties.
Properties | Class Methods |
---|---|
read | logicalDotsPerInch |
notify | logicalDotsPerInchChanged |
|
This value is used to convert font point sizes to pixel sizes.
Properties | Class Methods |
---|---|
read | logicalDotsPerInchX |
notify | logicalDotsPerInchChanged |
|
This value is used to convert font point sizes to pixel sizes.
Properties | Class Methods |
---|---|
read | logicalDotsPerInchY |
notify | logicalDotsPerInchChanged |
|
For example on X11 these correspond to the XRandr screen names, typically "VGA1", "HDMI1", etc.
Properties | Class Methods |
---|---|
read | name |
constant | true |
|
The native orientation of the screen is the orientation where the logo sticker of the device appears the right way up, or Qt::Primary Orientation if the platform does not support this functionality.
The native orientation is a property of the hardware, and does not change.
Properties | Class Methods |
---|---|
read | nativeOrientation |
|
The screen orientation represents the physical orientation of the display. For example, the screen orientation of a mobile device will change based on how it is being held. A change to the orientation might or might not trigger a change to the primary orientation of the screen.
Changes to this property will be filtered by orientationUpdateMask(), so in order to receive orientation updates the application must first call setOrientationUpdateMask() with a mask of the orientations it wants to receive.
Qt::PrimaryOrientation is never returned.
Properties | Class Methods |
---|---|
read | orientation |
notify | orientationChanged |
|
This value represents the pixel density on the screen's display. Depending on what information the underlying system provides the value might not be entirely accurate.
This is a convenience property that is the average of the physicalDotsPerInchX and physicalDotsPerInchY properties.
Properties | Class Methods |
---|---|
read | physicalDotsPerInch |
notify | physicalDotsPerInchChanged |
|
This value represents the actual horizontal pixel density on the screen's display. Depending on what information the underlying system provides the value might not be entirely accurate.
Properties | Class Methods |
---|---|
read | physicalDotsPerInchX |
notify | physicalDotsPerInchChanged |
|
This value represents the actual vertical pixel density on the screen's display. Depending on what information the underlying system provides the value might not be entirely accurate.
Properties | Class Methods |
---|---|
read | physicalDotsPerInchY |
notify | physicalDotsPerInchChanged |
|
The physical size represents the actual physical dimensions of the screen's display. Depending on what information the underlying system provides the value might not be entirely accurate.
Properties | Class Methods |
---|---|
read | physicalSize |
notify | physicalSizeChanged |
|
The primary screen orientation is Qt::LandscapeOrientation if the screen geometry's width is greater than or equal to its height, or Qt::PortraitOrientation otherwise. This property might change when the screen orientation was changed for example when the display is rotated.
The behavior is however platform dependent and can often be specified in an application manifest file.
Properties | Class Methods |
---|---|
read | primaryOrientation |
notify | primaryOrientationChanged |
|
Approximate vertical refresh rate of the screen in Hz.
Properties | Class Methods |
---|---|
read | refreshRate |
notify | refreshRateChanged |
|
This property holds the pixel resolution of the screen.
Properties | Class Methods |
---|---|
read | size |
notify | geometryChanged |
|
Returns the pixel geometry of the virtual desktop corresponding to this screen. This is the union of the virtual siblings' individual geometries.
Properties | Class Methods |
---|---|
read | virtualGeometry |
notify | virtualGeometryChanged |
|
Returns the pixel size of the virtual desktop corresponding to this screen. This is the combined size of the virtual siblings' individual geometries.
Properties | Class Methods |
---|---|
read | virtualSize |
notify | virtualGeometryChanged |