![]() |
Qt 6.x
The Qt SDK
|
The QScreen class is used to query screen properties. \inmodule QtGui. More...
#include <qscreen.h>
Signals | |
void | geometryChanged (const QRect &geometry) |
void | availableGeometryChanged (const QRect &geometry) |
void | physicalSizeChanged (const QSizeF &size) |
void | physicalDotsPerInchChanged (qreal dpi) |
void | logicalDotsPerInchChanged (qreal dpi) |
void | virtualGeometryChanged (const QRect &rect) |
void | primaryOrientationChanged (Qt::ScreenOrientation orientation) |
This signal is emitted when the primary orientation of the screen changes with orientation as an argument. | |
void | orientationChanged (Qt::ScreenOrientation orientation) |
This signal is emitted when the orientation of the screen changes with orientation as an argument. | |
void | refreshRateChanged (qreal refreshRate) |
![]() | |
void | destroyed (QObject *=nullptr) |
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
This signal is emitted after the object's name has been changed. | |
Public Member Functions | |
~QScreen () | |
Destroys the screen. | |
QPlatformScreen * | handle () const |
Get the platform screen handle. | |
QString | name () const |
QString | manufacturer () const |
QString | model () const |
QString | serialNumber () const |
int | depth () const |
QSize | size () const |
QRect | geometry () const |
QSizeF | physicalSize () const |
qreal | physicalDotsPerInchX () const |
qreal | physicalDotsPerInchY () const |
qreal | physicalDotsPerInch () const |
qreal | logicalDotsPerInchX () const |
qreal | logicalDotsPerInchY () const |
qreal | logicalDotsPerInch () const |
qreal | devicePixelRatio () const |
QSize | availableSize () const |
QRect | availableGeometry () const |
QList< QScreen * > | virtualSiblings () const |
Get the screen's virtual siblings. | |
QScreen * | virtualSiblingAt (QPoint point) |
Returns the screen at point within the set of \l QScreen::virtualSiblings(), or nullptr if outside of any screen. | |
QSize | virtualSize () const |
QRect | virtualGeometry () const |
QSize | availableVirtualSize () const |
QRect | availableVirtualGeometry () const |
Qt::ScreenOrientation | primaryOrientation () const |
Qt::ScreenOrientation | orientation () const |
Qt::ScreenOrientation | nativeOrientation () const |
int | angleBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b) const |
Convenience function to compute the angle of rotation to get from rotation a to rotation b. | |
QTransform | transformBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const |
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. | |
QRect | mapBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const |
Maps the rect between two screen orientations. | |
bool | isPortrait (Qt::ScreenOrientation orientation) const |
Convenience function that returns true if o is either portrait or inverted portrait; otherwise returns false . | |
bool | isLandscape (Qt::ScreenOrientation orientation) const |
Convenience function that returns true if o is either landscape or inverted landscape; otherwise returns false . | |
QPixmap | grabWindow (WId window=0, int x=0, int y=0, int w=-1, int h=-1) |
Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by QRect(x, y, width, height). | |
qreal | refreshRate () const |
![]() | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
template<typename T > | |
T | findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T > | |
QList< T > | findChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T > | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
Properties | |
QString | name |
a user presentable string representing the screen | |
QString | manufacturer |
the manufacturer of the screen | |
QString | model |
the model of the screen | |
QString | serialNumber |
the serial number of the screen | |
int | depth |
the color depth of the screen | |
QSize | size |
the pixel resolution of the screen | |
QSize | availableSize |
the screen's available size in pixels | |
QSize | virtualSize |
the pixel size of the virtual desktop to which this screen belongs | |
QSize | availableVirtualSize |
the available size of the virtual desktop to which this screen belongs | |
QRect | geometry |
the screen's geometry in pixels | |
QRect | availableGeometry |
the screen's available geometry in pixels | |
QRect | virtualGeometry |
the pixel geometry of the virtual desktop to which this screen belongs | |
QRect | availableVirtualGeometry |
the available geometry of the virtual desktop to which this screen belongs | |
QSizeF | physicalSize |
the screen's physical size (in millimeters) | |
qreal | physicalDotsPerInchX |
the number of physical dots or pixels per inch in the horizontal direction | |
qreal | physicalDotsPerInchY |
the number of physical dots or pixels per inch in the vertical direction | |
qreal | physicalDotsPerInch |
the number of physical dots or pixels per inch | |
qreal | logicalDotsPerInchX |
the number of logical dots or pixels per inch in the horizontal direction | |
qreal | logicalDotsPerInchY |
the number of logical dots or pixels per inch in the vertical direction | |
qreal | logicalDotsPerInch |
the number of logical dots or pixels per inch | |
qreal | devicePixelRatio |
the screen's ratio between physical pixels and device-independent pixels | |
Qt::ScreenOrientation | primaryOrientation |
the primary screen orientation | |
Qt::ScreenOrientation | orientation |
the screen orientation | |
Qt::ScreenOrientation | nativeOrientation |
the native screen orientation | |
qreal | refreshRate |
the approximate vertical refresh rate of the screen in Hz | |
![]() | |
QString | objectName |
the name of this object | |
Friends | |
class | QGuiApplicationPrivate |
class | QPlatformIntegration |
class | QPlatformScreen |
class | QHighDpiScaling |
class | QWindowSystemInterface |
Additional Inherited Members | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
![]() | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
The QScreen class is used to query screen properties. \inmodule QtGui.
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.
\inmodule QtGui
QScreen::~QScreen | ( | ) |
Destroys the screen.
Definition at line 72 of file qscreen.cpp.
References contains(), Q_ASSERT_X, and QGuiApplicationPrivate::screen_list.
int QScreen::angleBetween | ( | Qt::ScreenOrientation | a, |
Qt::ScreenOrientation | b | ||
) | const |
Convenience function to compute 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().
Definition at line 519 of file qscreen.cpp.
References QPlatformScreen::angleBetween(), Qt::PrimaryOrientation, and primaryOrientation.
Referenced by QQnxScreen::QQnxScreen(), QQuickScreenAttached::angleBetween(), and overview_viewfinder_orientation().
QRect QScreen::availableGeometry | ( | ) | const |
Definition at line 344 of file qscreen.cpp.
References d.
Referenced by QScreenPrivate::UpdateEmitter::~UpdateEmitter().
QSize QScreen::availableSize | ( | ) | const |
Definition at line 314 of file qscreen.cpp.
References d.
QRect QScreen::availableVirtualGeometry | ( | ) | const |
Definition at line 430 of file qscreen.cpp.
References availableGeometry, screen, and virtualSiblings().
QSize QScreen::availableVirtualSize | ( | ) | const |
Definition at line 415 of file qscreen.cpp.
References availableVirtualGeometry, and QRect::size().
int QScreen::depth | ( | ) | const |
Definition at line 146 of file qscreen.cpp.
References d.
qreal QScreen::devicePixelRatio | ( | ) | const |
Definition at line 285 of file qscreen.cpp.
References d, and QHighDpiScaling::factor().
QRect QScreen::geometry | ( | ) | const |
Definition at line 327 of file qscreen.cpp.
References d.
Referenced by QScreenPrivate::UpdateEmitter::~UpdateEmitter().
QPixmap QScreen::grabWindow | ( | WId | window = 0 , |
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).
If window is 0, then the entire screen will be grabbed.
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, the function copies everything to the bottom of the window.
The offset and size arguments are specified in device independent pixels. The returned pixmap may be larger than the requested size when grabbing from a high-DPI screen. Call QPixmap::devicePixelRatio() to determine if this is the case.
The window system identifier (WId
) can be retrieved using the QWidget::winId() function. The rationale for using a window identifier and not a QWidget, is to enable grabbing of windows that are not part of the application, window system frames, and so on.
The grabWindow() 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.
Note on X11 that if the given 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 get pixels from the overlying window. The contents of the obscured areas in the pixmap will be undefined and 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.
Definition at line 685 of file qscreen.cpp.
References QHighDpiScaling::factor(), QPlatformScreen::grabWindow(), handle(), QSize::height(), QSize::isValid(), qFuzzyCompare(), qWarning, QPixmap::setDevicePixelRatio(), QHighDpi::toNative(), QSize::width(), window(), QPoint::x(), and QPoint::y().
Referenced by QGrabWindowSurfaceCapture::Grabber::grabFrame(), QColorDialogPrivate::grabScreenColor(), grabScreenColor(), and QAlphaWidget::run().
QPlatformScreen * QScreen::handle | ( | ) | const |
Get the platform screen handle.
Definition at line 83 of file qscreen.cpp.
References d.
Referenced by QFbBackingStore::QFbBackingStore(), QQnxWindow::QQnxWindow(), QXcbBackingStore::QXcbBackingStore(), QScreenPrivate::UpdateEmitter::UpdateEmitter(), Vsp2HardwareLayerIntegration::Vsp2HardwareLayerIntegration(), QIOSIntegration::~QIOSIntegration(), QWindowPrivate::applyCursor(), applyCursor(), applyOverrideCursor(), QXcbIntegration::beep(), calcPosition(), clearOverrideCursor(), QCocoaWindow::createNSWindow(), QEglFSIntegration::createPlatformOffscreenSurface(), QXcbEglIntegration::createPlatformOffscreenSurface(), QXcbIntegration::createPlatformOffscreenSurface(), defaultCursor(), findScreenForVirtualDesktop(), QCocoaScreen::get(), QCocoaScreen::get(), QWasmScreen::get(), grabWindow(), QWindowSystemInterface::handleScreenRemoved(), QQnxWindow::initWindow(), QHighDpiScaling::logicalDpi(), QDockWidgetPrivate::mouseMoveEvent(), QQC2::QWindowsStylePrivate::nativeMetricScaleFactor(), QEglFSKmsIntegration::nativeResourceForScreen(), QQnxNativeInterface::nativeResourceForScreen(), QWindowsNativeInterface::nativeResourceForScreen(), QXcbNativeInterface::nativeResourceForScreen(), QtWaylandClient::QWaylandNativeInterface::nativeResourceForScreen(), QTipLabel::placeTip(), QFbWindow::platformScreen(), QAndroidPlatformWindow::platformScreen(), QWasmWindow::platformScreen(), QCursor::pos(), QCocoaScreen::primaryScreen(), QGuiApplicationPrivate::processMouseEvent(), qtPlatformScreenFor(), QGLXContext::queryDummyContext(), QXcbBackingStoreImage::resize(), QMinimalBackingStore::resize(), QOffscreenBackingStore::resize(), QVkKhrDisplayBackingStore::resize(), QHighDpiScaling::scaleAndOrigin(), QPlatformOffscreenSurface::screen(), QPlatformWindow::screen(), QEglFSDeviceIntegration::screenDestroy(), screenForDeviceName(), QXcbNativeInterface::setAppTime(), QXcbNativeInterface::setAppUserTime(), QCursor::setPos(), QIOSMessageDialog::show(), QCocoaMenu::showPopup(), subpixelAntialiasingTypeHint(), QRasterPlatformPixmap::systemNativeFormat(), QQmlPreviewPosition::takePosition(), unsetCursor(), QHighDpiScaling::updateHighDpiScaling(), QXcbXSettingsPropertyValue::updateValue(), QPlatformPlaceholderScreen::virtualSiblings(), and QCocoaScreen::virtualSiblings().
bool QScreen::isLandscape | ( | Qt::ScreenOrientation | o | ) | const |
Convenience function that returns true
if o is either landscape or inverted landscape; otherwise returns false
.
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
Definition at line 591 of file qscreen.cpp.
References Qt::InvertedLandscapeOrientation, Qt::LandscapeOrientation, o, Qt::PrimaryOrientation, and primaryOrientation.
bool QScreen::isPortrait | ( | Qt::ScreenOrientation | o | ) | const |
Convenience function that returns true
if o is either portrait or inverted portrait; otherwise returns false
.
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
Definition at line 579 of file qscreen.cpp.
References Qt::InvertedPortraitOrientation, o, Qt::PortraitOrientation, Qt::PrimaryOrientation, and primaryOrientation.
qreal QScreen::logicalDotsPerInch | ( | ) | const |
Definition at line 266 of file qscreen.cpp.
References d, QHighDpiScaling::isActive(), and QHighDpiScaling::logicalDpi().
Referenced by QScreenPrivate::UpdateEmitter::~UpdateEmitter().
qreal QScreen::logicalDotsPerInchX | ( | ) | const |
Definition at line 230 of file qscreen.cpp.
References d, QHighDpiScaling::isActive(), and QHighDpiScaling::logicalDpi().
qreal QScreen::logicalDotsPerInchY | ( | ) | const |
Definition at line 246 of file qscreen.cpp.
References d, QHighDpiScaling::isActive(), and QHighDpiScaling::logicalDpi().
QString QScreen::manufacturer | ( | ) | const |
Definition at line 112 of file qscreen.cpp.
References d.
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().
Definition at line 562 of file qscreen.cpp.
References QPlatformScreen::mapBetween(), Qt::PrimaryOrientation, primaryOrientation, and rect.
QString QScreen::model | ( | ) | const |
Definition at line 124 of file qscreen.cpp.
References d.
QString QScreen::name | ( | ) | const |
Definition at line 100 of file qscreen.cpp.
References d.
Qt::ScreenOrientation QScreen::nativeOrientation | ( | ) | const |
Definition at line 505 of file qscreen.cpp.
References d.
Qt::ScreenOrientation QScreen::orientation | ( | ) | const |
Definition at line 454 of file qscreen.cpp.
References d.
|
signal |
This signal is emitted when the orientation of the screen changes with orientation as an argument.
Referenced by QAndroidCameraSession::QAndroidCameraSession().
qreal QScreen::physicalDotsPerInch | ( | ) | const |
Definition at line 215 of file qscreen.cpp.
References QSize::height(), QSizeF::height(), physicalSize, size, QSize::width(), and QSizeF::width().
Referenced by QScreenPrivate::UpdateEmitter::~UpdateEmitter().
qreal QScreen::physicalDotsPerInchX | ( | ) | const |
Definition at line 175 of file qscreen.cpp.
References physicalSize, size, QSize::width(), and QSizeF::width().
qreal QScreen::physicalDotsPerInchY | ( | ) | const |
Definition at line 193 of file qscreen.cpp.
References QSize::height(), QSizeF::height(), physicalSize, and size.
QSizeF QScreen::physicalSize | ( | ) | const |
Definition at line 301 of file qscreen.cpp.
References d.
Qt::ScreenOrientation QScreen::primaryOrientation | ( | ) | const |
Definition at line 488 of file qscreen.cpp.
References d.
|
signal |
This signal is emitted when the primary orientation of the screen changes with orientation as an argument.
Referenced by QScreenPrivate::UpdateEmitter::~UpdateEmitter().
qreal QScreen::refreshRate | ( | ) | const |
Definition at line 469 of file qscreen.cpp.
References d.
QString QScreen::serialNumber | ( | ) | const |
Definition at line 136 of file qscreen.cpp.
References d.
QSize QScreen::size | ( | ) | const |
Definition at line 156 of file qscreen.cpp.
References d.
QTransform QScreen::transformBetween | ( | Qt::ScreenOrientation | a, |
Qt::ScreenOrientation | b, | ||
const QRect & | target | ||
) | const |
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.
Example, 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).
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
Definition at line 542 of file qscreen.cpp.
References Qt::PrimaryOrientation, primaryOrientation, and QPlatformScreen::transformBetween().
QRect QScreen::virtualGeometry | ( | ) | const |
Definition at line 396 of file qscreen.cpp.
References geometry, screen, and virtualSiblings().
Returns the screen at point within the set of \l QScreen::virtualSiblings(), or nullptr
if outside of any screen.
The point is in relation to the virtualGeometry() of each set of virtual siblings.
Definition at line 629 of file qscreen.cpp.
References virtualSiblings().
Referenced by QTipLabel::getTipScreen(), QMenuBarPrivate::popupAction(), QWidgetPrivate::screen(), and QCursor::setPos().
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.
Definition at line 357 of file qscreen.cpp.
References d, QList< T >::reserve(), QPlatformScreen::screen(), and QList< T >::size().
Referenced by QScreenPrivate::UpdateEmitter::~UpdateEmitter(), availableVirtualGeometry(), calcPosition(), effectiveScreen(), QGuiApplication::screenAt(), screenForDeviceName(), QWindowPrivate::screenForGeometry(), QComboBox::showPopup(), virtualGeometry(), QWindowsScreen::virtualGeometry(), virtualSiblingAt(), and QWindowPrivate::windowRecreationRequired().
QSize QScreen::virtualSize | ( | ) | const |
Definition at line 381 of file qscreen.cpp.
References QRect::size(), and virtualGeometry.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
read |
the screen's available geometry in pixels
The available geometry is the geometry excluding window manager reserved areas such as task bars and system menus.
Note, on X11 this will return the true available geometry only on systems with one monitor and if window manager has set _NET_WORKAREA atom. In all other cases this is equal to geometry(). This is a limitation in X11 window manager specification.
Definition at line 148 of file qscreen.h.
Referenced by QScreenPrivate::UpdateEmitter::UpdateEmitter(), QScreenPrivate::UpdateEmitter::~UpdateEmitter(), QDialog::adjustPosition(), QWidgetPrivate::availableScreenGeometry(), availableVirtualGeometry(), QColorDialogPrivate::initWidgets(), operator<<(), operator<<(), QMenuPrivate::popupGeometry(), QDateTimeEditPrivate::positionCalendarPopup(), QPlatformScreen::resizeMaximizedWindows(), QWidget::restoreGeometry(), QCompleterPrivate::showPopup(), and windowPlacementOffset().
|
read |
|
read |
the available geometry of the virtual desktop to which this screen belongs
Returns the available geometry of the virtual desktop corresponding to this screen.
This is the union of the virtual siblings' individual available geometries.
Definition at line 148 of file qscreen.h.
Referenced by availableVirtualSize(), QDockWidget::event(), QSizeGrip::mousePressEvent(), and QQuickScreenInfo::setWrappedScreen().
|
read |
the available size of the virtual desktop to which this screen belongs
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.
Definition at line 148 of file qscreen.h.
Referenced by QQuickScreenInfo::desktopAvailableHeight(), QQuickScreenInfo::desktopAvailableWidth(), and QCocoaMenu::showPopup().
|
read |
the color depth of the screen
Definition at line 148 of file qscreen.h.
Referenced by QXcbColormap::initialize(), QColormap::initialize(), QWidget::metric(), operator<<(), and QBlittablePlatformPixmap::resize().
|
read |
the screen's ratio between physical pixels and device-independent pixels
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.
Definition at line 148 of file qscreen.h.
Referenced by QGuiApplication::devicePixelRatio(), QQuickScreenInfo::devicePixelRatio(), QWindowPrivate::init(), QWidget::metric(), operator<<(), operator<<(), and QQuickScreenInfo::setWrappedScreen().
|
read |
the screen's geometry in pixels
As an example this might return QRect(0, 0, 1280, 1024), or in a virtual desktop setting QRect(1280, 0, 1280, 1024).
Definition at line 148 of file qscreen.h.
Referenced by QScreenPrivate::UpdateEmitter::UpdateEmitter(), QScreenPrivate::UpdateEmitter::~UpdateEmitter(), QWidgetPrivate::adjustedSize(), QWasmScreen::clipPoint(), QDockAreaLayout::constrainedRect(), WindowCreationData::create(), QCocoaWindow::createNSWindow(), QIBusPlatformInputContext::cursorRectChanged(), QColorDialogPrivate::grabScreenColor(), grabScreenColor(), initScreensData(), QCocoaScreen::mapFromNative(), QCocoaScreen::mapFromNative(), QCocoaScreen::mapToNative(), QCocoaScreen::mapToNative(), QPaintDeviceWindow::metric(), QWidget::metric(), QOpenGLWidget::metric(), moveToVirtualScreen(), operator<<(), operator<<(), QTipLabel::placeTip(), QMenuBarPrivate::popupAction(), QMenuPrivate::popupGeometry(), QEvdevTabletData::report(), QPlatformScreen::resizeMaximizedWindows(), QWidget::restoreGeometry(), QWhatsThisPrivate::say(), QWindowPrivate::screenForGeometry(), QPlatformScreen::screenForPosition(), QEvdevTouchScreenData::screenGeometry(), QWidgetPrivate::screenGeometry(), QQuickScreenInfo::setWrappedScreen(), QWindowsMouseHandler::translateTouchEvent(), QTipLabel::updateSize(), updateWindow(), virtualGeometry(), QQuickScreenInfo::virtualX(), QQuickScreenInfo::virtualY(), and windowPlacementOffset().
|
read |
the number of logical dots or pixels per inch
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.
Definition at line 148 of file qscreen.h.
Referenced by QScreenPrivate::UpdateEmitter::~UpdateEmitter(), QQuickScreenInfo::logicalPixelDensity(), and QQuickScreenInfo::setWrappedScreen().
|
read |
the number of logical dots or pixels per inch in the horizontal direction
This value is used to convert font point sizes to pixel sizes.
Definition at line 148 of file qscreen.h.
Referenced by QScreenPrivate::UpdateEmitter::UpdateEmitter(), QScreenPrivate::UpdateEmitter::~UpdateEmitter(), QX11Info::appDpiX(), QPaintDeviceWindow::metric(), QWidget::metric(), QOpenGLWidget::metric(), operator<<(), and qt_defaultDpiX().
|
read |
the number of logical dots or pixels per inch in the vertical direction
This value is used to convert font point sizes to pixel sizes.
Definition at line 148 of file qscreen.h.
Referenced by QScreenPrivate::UpdateEmitter::UpdateEmitter(), QScreenPrivate::UpdateEmitter::~UpdateEmitter(), QX11Info::appDpiY(), QPaintDeviceWindow::metric(), QWidget::metric(), QOpenGLWidget::metric(), operator<<(), and qt_defaultDpiY().
|
read |
the manufacturer of the screen
Definition at line 148 of file qscreen.h.
Referenced by QQuickScreenInfo::manufacturer(), and QQuickScreenInfo::setWrappedScreen().
|
read |
the model of the screen
Definition at line 148 of file qscreen.h.
Referenced by QQuickScreenInfo::model(), and QQuickScreenInfo::setWrappedScreen().
|
read |
a user presentable string representing the screen
For example, on X11 these correspond to the XRandr screen names, typically "VGA1", "HDMI1", etc.
Definition at line 148 of file qscreen.h.
Referenced by QXcbNativeInterface::dumpConnectionNativeWindows(), findScreen(), findScreen(), initScreensData(), QQuickScreenInfo::name(), operator<<(), operator<<(), operator<<(), QHighDpiScaling::setScreenFactor(), QQuickScreenInfo::setWrappedScreen(), QQmlPreviewPosition::takePosition(), and QHighDpiScaling::updateHighDpiScaling().
|
read |
the native screen orientation
The native orientation of the screen is the orientation where the logo sticker of the device appears the right way up, or Qt::PrimaryOrientation if the platform does not support this functionality.
The native orientation is a property of the hardware, and does not change.
Definition at line 148 of file qscreen.h.
Referenced by overview_viewfinder_orientation().
|
read |
the screen orientation
The orientation
property tells the orientation of the screen from the window system perspective.
Most mobile devices and tablet computers contain accelerometer sensors. The Qt Sensors module provides the ability to read this sensor directly. However, the windowing system may rotate the entire screen automatically based on how it is being held; in that case, this orientation
property will change.
Definition at line 148 of file qscreen.h.
Referenced by QVideoOutputOrientationHandler::QVideoOutputOrientationHandler(), QAndroidCameraSession::currentCameraRotation(), operator<<(), operator<<(), QQuickScreenInfo::orientation(), QIOSScreen::orientation(), overview_viewfinder_orientation(), and QQuickScreenInfo::setWrappedScreen().
|
read |
the number of physical dots or pixels per inch
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's simply the average of the physicalDotsPerInchX and physicalDotsPerInchY properties.
Definition at line 148 of file qscreen.h.
Referenced by QScreenPrivate::UpdateEmitter::~UpdateEmitter(), QQuickScreenInfo::pixelDensity(), QQuickScreenInfo::setWrappedScreen(), and QAndroidPlatformTheme::themeHint().
|
read |
the number of physical dots or pixels per inch in the horizontal direction
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.
Definition at line 148 of file qscreen.h.
Referenced by QPaintDeviceWindow::metric(), QWidget::metric(), QOpenGLWidget::metric(), operator<<(), and QScrollerPrivate::setDpiFromWidget().
|
read |
the number of physical dots or pixels per inch in the vertical direction
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.
Definition at line 148 of file qscreen.h.
Referenced by QPaintDeviceWindow::metric(), QWidget::metric(), QOpenGLWidget::metric(), operator<<(), and QScrollerPrivate::setDpiFromWidget().
|
read |
the screen's physical size (in millimeters)
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.
Definition at line 148 of file qscreen.h.
Referenced by QPaintDeviceWindow::metric(), QWidget::metric(), QOpenGLWidget::metric(), operator<<(), operator<<(), physicalDotsPerInch(), physicalDotsPerInchX(), and physicalDotsPerInchY().
|
read |
the primary screen orientation
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 (i.e. when the display is rotated). The behavior is however platform dependent and can often be specified in an application manifest file.
Definition at line 148 of file qscreen.h.
Referenced by QScreenPrivate::UpdateEmitter::UpdateEmitter(), QScreenPrivate::UpdateEmitter::~UpdateEmitter(), angleBetween(), QCocoaWindow::createNSWindow(), QAndroidCameraSession::currentCameraRotation(), isLandscape(), isPortrait(), mapBetween(), QQuickScreenInfo::primaryOrientation(), QQuickScreenInfo::setWrappedScreen(), QWaylandSurfacePrivate::surface_set_buffer_transform(), and transformBetween().
|
read |
the approximate vertical refresh rate of the screen in Hz
Definition at line 148 of file qscreen.h.
Referenced by QAVFScreenCapture::Grabber::Grabber(), QCGWindowCapture::Grabber::Grabber(), QFFmpegScreenCaptureDxgi::Grabber::Grabber(), QSGAnimationDriver::QSGAnimationDriver(), QGrabWindowSurfaceCapture::Grabber::grabFrame(), QWaylandOutputPrivate::handleWindowPixelSizeChanged(), operator<<(), and qsgrl_animation_interval().
|
read |
the serial number of the screen
Definition at line 148 of file qscreen.h.
Referenced by QQuickScreenInfo::serialNumber(), and QQuickScreenInfo::setWrappedScreen().
|
read |
the pixel resolution of the screen
Definition at line 148 of file qscreen.h.
Referenced by QQuickScreenInfo::height(), operator<<(), physicalDotsPerInch(), physicalDotsPerInchX(), physicalDotsPerInchY(), QQuickScreenInfo::setWrappedScreen(), and QQuickScreenInfo::width().
|
read |
the pixel geometry of the virtual desktop to which this screen belongs
Returns the pixel geometry of the virtual desktop corresponding to this screen.
This is the union of the virtual siblings' individual geometries.
Definition at line 148 of file qscreen.h.
Referenced by QWhatsThat::QWhatsThat(), QColorDialogPrivate::initWidgets(), QWidgetResizeHandler::keyPressEvent(), QMenuBar::minimumSizeHint(), QLibInputPointer::processAbsMotion(), QLibInputPointer::processMotion(), QLibInputPointer::setPos(), QMenuBar::sizeHint(), QTabWidget::sizeHint(), and virtualSize().
|
read |
the pixel size of the virtual desktop to which this screen belongs
Returns the pixel size of the virtual desktop corresponding to this screen.
This is the combined size of the virtual siblings' individual geometries.
Definition at line 148 of file qscreen.h.
Referenced by QTabWidget::heightForWidth(), and QMdiArea::sizeHint().