![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QPlatformScreen class provides an abstraction for visual displays. More...
#include <qplatformscreen.h>
Classes | |
| struct | Mode |
Public Types | |
| enum | SubpixelAntialiasingType { Subpixel_None , Subpixel_RGB , Subpixel_BGR , Subpixel_VRGB , Subpixel_VBGR } |
| enum | PowerState { PowerStateOn , PowerStateStandby , PowerStateSuspend , PowerStateOff } |
Public Member Functions | |
| QPlatformScreen () | |
| virtual | ~QPlatformScreen () |
| virtual bool | isPlaceholder () const |
| virtual QPixmap | grabWindow (WId window, int x, int y, int width, int height) const |
| This function is called when Qt needs to be able to grab the content of a window. | |
| virtual QRect | geometry () const =0 |
| Reimplement in subclass to return the pixel geometry of the screen. | |
| virtual QRect | availableGeometry () const |
| Reimplement in subclass to return the pixel geometry of the available space This normally is the desktop screen minus the task manager, global menubar etc. | |
| virtual int | depth () const =0 |
| Reimplement in subclass to return current depth of the screen. | |
| virtual QImage::Format | format () const =0 |
| Reimplement in subclass to return the image format which corresponds to the screen format. | |
| virtual QColorSpace | colorSpace () const |
| virtual QSizeF | physicalSize () const |
| Reimplement this function in subclass to return the physical size of the screen, in millimeters. | |
| virtual QDpi | logicalDpi () const |
| Reimplement this function in subclass to return the logical horizontal and vertical dots per inch metrics of the screen. | |
| virtual QDpi | logicalBaseDpi () const |
| Reimplement to return the base logical DPI for the platform. | |
| virtual qreal | devicePixelRatio () const |
| Reimplement this function in subclass to return the device pixel ratio for the screen. | |
| virtual qreal | refreshRate () const |
| Reimplement this function in subclass to return the vertical refresh rate of the screen, in Hz. | |
| virtual Qt::ScreenOrientation | nativeOrientation () const |
| Reimplement this function in subclass to return the native orientation of the screen, e.g. | |
| virtual Qt::ScreenOrientation | orientation () const |
| Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation. | |
| virtual QWindow * | topLevelAt (const QPoint &point) const |
| Return the given top level window for a given position. | |
| QWindowList | windows () const |
| Return all windows residing on this screen. | |
| virtual QList< QPlatformScreen * > | virtualSiblings () const |
| Returns a list of all the platform screens that are part of the same virtual desktop. | |
| const QPlatformScreen * | screenForPosition (const QPoint &point) const |
| Find the sibling screen corresponding to globalPos. | |
| QScreen * | screen () const |
| virtual QString | name () const |
| virtual QString | manufacturer () const |
| Reimplement this function in subclass to return the manufacturer of this screen. | |
| virtual QString | model () const |
| Reimplement this function in subclass to return the model of this screen. | |
| virtual QString | serialNumber () const |
| Reimplement this function in subclass to return the serial number of this screen. | |
| virtual QPlatformCursor * | cursor () const |
| Reimplement this function in subclass to return the cursor of the screen. | |
| virtual SubpixelAntialiasingType | subpixelAntialiasingTypeHint () const |
| Returns a hint about this screen's subpixel layout structure. | |
| virtual PowerState | powerState () const |
| Returns the current power state. | |
| virtual void | setPowerState (PowerState state) |
| Sets the power state for this screen. | |
| virtual QList< Mode > | modes () const |
| Reimplement this function in subclass to return the list of modes for this screen. | |
| virtual int | currentMode () const |
| Reimplement this function in subclass to return the index of the current mode from the modes list. | |
| virtual int | preferredMode () const |
| Reimplement this function in subclass to return the preferred mode index from the modes list. | |
Static Public Member Functions | |
| static QPlatformScreen * | platformScreenForWindow (const QWindow *window) |
| static int | angleBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b) |
| static QTransform | transformBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) |
| static QRect | mapBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) |
| static QDpi | overrideDpi (const QDpi &in) |
Protected Member Functions | |
| void | resizeMaximizedWindows () |
| Convenience method to resize all the maximized and fullscreen windows of this platform screen. | |
Protected Attributes | |
| QScopedPointer< QPlatformScreenPrivate > | d_ptr |
Friends | |
| class | QScreen |
The QPlatformScreen class provides an abstraction for visual displays.
\preliminary
Many window systems has support for retrieving information on the attached displays. To be able to query the display QPA uses QPlatformScreen. Qt its self is most dependent on the physicalSize() function, since this is the function it uses to calculate the dpi to use when converting point sizes to pixels sizes. However, this is unfortunate on some systems, as the native system fakes its dpi size.
Definition at line 44 of file qplatformscreen.h.
| Enumerator | |
|---|---|
| PowerStateOn | |
| PowerStateStandby | |
| PowerStateSuspend | |
| PowerStateOff | |
Definition at line 60 of file qplatformscreen.h.
| Enumerator | |
|---|---|
| Subpixel_None | |
| Subpixel_RGB | |
| Subpixel_BGR | |
| Subpixel_VRGB | |
| Subpixel_VBGR | |
Definition at line 52 of file qplatformscreen.h.
| QT_BEGIN_NAMESPACE QPlatformScreen::QPlatformScreen | ( | ) |
Definition at line 19 of file qplatformscreen.cpp.
|
virtual |
Definition at line 26 of file qplatformscreen.cpp.
|
static |
Definition at line 366 of file qplatformscreen.cpp.
|
inlinevirtual |
Reimplement in subclass to return the pixel geometry of the available space This normally is the desktop screen minus the task manager, global menubar etc.
Reimplemented in QAndroidPlatformScreen, QCocoaScreen, QIOSScreen, QPlatformPlaceholderScreen, QQnxScreen, QWindowsScreen, and QXcbScreen.
Definition at line 80 of file qplatformscreen.h.
|
inlinevirtual |
Reimplemented in QCocoaScreen, and QXcbScreen.
Definition at line 84 of file qplatformscreen.h.
|
virtual |
Reimplement this function in subclass to return the index of the current mode from the modes list.
The default implementation returns 0.
Reimplemented in QAndroidPlatformScreen, and QEglFSKmsScreen.
Definition at line 512 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the cursor of the screen.
The default implementation returns \nullptr.
Reimplemented in QCocoaScreen, QDirectFbScreen, QEglFSKmsEglDeviceScreen, QEglFSKmsGbmScreen, QEglFSScreen, QFbScreen, QHaikuScreen, QOffscreenScreen, QQnxScreen, QVncScreen, QWasmScreen, QWindowsScreen, and QXcbScreen.
Definition at line 310 of file qplatformscreen.cpp.
|
pure virtual |
Reimplement in subclass to return current depth of the screen.
Implemented in QAndroidPlatformScreen, QCocoaScreen, QDirectFbScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QEglFSScreen, QFbScreen, QHaikuScreen, QIOSScreen, QMinimalEglScreen, QMinimalScreen, QOffscreenScreen, QPlatformPlaceholderScreen, QQnxScreen, QtWaylandClient::QWaylandScreen, QVkKhrDisplayScreen, QVkKhrDisplayScreen, QWasmScreen, QWindowsScreen, and QXcbScreen.
|
virtual |
Reimplement this function in subclass to return the device pixel ratio for the screen.
This is the ratio between physical pixels and the device-independent pixels of the windowing system. The default implementation returns 1.0.
Reimplemented in QCocoaScreen, QIOSScreen, QOffscreenScreen, QtWaylandClient::QWaylandScreen, QWasmScreen, and QWindowsScreen.
Definition at line 184 of file qplatformscreen.cpp.
|
pure virtual |
Reimplement in subclass to return the image format which corresponds to the screen format.
Implemented in QAndroidPlatformScreen, QCocoaScreen, QDirectFbScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QEglFSScreen, QFbScreen, QHaikuScreen, QIOSScreen, QMinimalEglScreen, QMinimalScreen, QOffscreenScreen, QPlatformPlaceholderScreen, QQnxScreen, QtWaylandClient::QWaylandScreen, QVkKhrDisplayScreen, QVkKhrDisplayScreen, QWasmScreen, QWindowsScreen, and QXcbScreen.
|
pure virtual |
Reimplement in subclass to return the pixel geometry of the screen.
Implemented in QAndroidPlatformScreen, QCocoaScreen, QDirectFbScreen, QEglFSEmulatorScreen, QEglFSScreen, QFbScreen, QHaikuScreen, QIOSScreen, QMinimalEglScreen, QMinimalScreen, QOffscreenScreen, QPlatformPlaceholderScreen, QQnxScreen, QtWaylandClient::QWaylandScreen, QVkKhrDisplayScreen, QVkKhrDisplayScreen, QWasmScreen, QWindowsScreen, and QXcbScreen.
|
virtual |
This function is called when Qt needs to be able to grab the content of a window.
Returns the content of the window specified with the WId handle within the boundaries of QRect(x,y,width,height).
Reimplemented in QBsdFbScreen, QCocoaScreen, QEglFSScreen, QHaikuScreen, QIntegrityFbScreen, QIOSScreen, QLinuxFbDrmScreen, QLinuxFbScreen, QOffscreenScreen, QQnxScreen, QVncScreen, QWindowsScreen, and QXcbScreen.
Definition at line 39 of file qplatformscreen.cpp.
|
inlinevirtual |
Reimplemented in QPlatformPlaceholderScreen.
Definition at line 75 of file qplatformscreen.h.
|
virtual |
Reimplement to return the base logical DPI for the platform.
This DPI value should correspond to a standard-DPI (1x) display. The default implementation returns 96.
QtGui will use this value (together with logicalDpi) to compute the scale factor when high-DPI scaling is enabled, as follows: factor = logicalDPI / baseDPI
Reimplemented in QAndroidPlatformScreen, QCocoaScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QEglFSScreen, QIOSScreen, QOffscreenScreen, QWindowsScreen, and QXcbScreen.
Definition at line 171 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch metrics of the screen.
The logical dots per inch metrics are used by Qt to scale the user interface.
The default implementation returns logicalBaseDpi(), which results in a UI scale factor of 1.0.
Reimplemented in QAndroidPlatformScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QEglFSScreen, QOffscreenScreen, QtWaylandClient::QWaylandScreen, QWasmScreen, QWindowsScreen, and QXcbScreen.
Definition at line 149 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the manufacturer of this screen.
The default implementation returns an empty string.
Reimplemented in QEglFSKmsScreen, QtWaylandClient::QWaylandScreen, QWindowsScreen, and QXcbScreen.
Definition at line 241 of file qplatformscreen.cpp.
|
static |
Definition at line 419 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the model of this screen.
The default implementation returns an empty string.
Reimplemented in QEglFSKmsScreen, QtWaylandClient::QWaylandScreen, QWindowsScreen, and QXcbScreen.
Definition at line 254 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the list of modes for this screen.
The default implementation returns a list with only one mode from the current screen size and refresh rate.
Reimplemented in QAndroidPlatformScreen, and QEglFSKmsScreen.
Definition at line 495 of file qplatformscreen.cpp.
|
inlinevirtual |
Reimplemented in QAndroidPlatformScreen, QCocoaScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QIOSScreen, QOffscreenScreen, QQnxScreen, QtWaylandClient::QWaylandScreen, QWasmScreen, QWindowsScreen, and QXcbScreen.
Definition at line 108 of file qplatformscreen.h.
|
virtual |
Reimplement this function in subclass to return the native orientation of the screen, e.g.
the orientation where the logo sticker of the device appears the right way up.
The default implementation returns Qt::PrimaryOrientation.
Reimplemented in QAndroidPlatformScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QEglFSScreen, QIOSScreen, and QQnxScreen.
Definition at line 207 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation.
The default implementation returns Qt::PrimaryOrientation.
Reimplemented in QAndroidPlatformScreen, QCocoaScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QEglFSScreen, QIOSScreen, QQnxScreen, QtWaylandClient::QWaylandScreen, QWindowsScreen, and QXcbScreen.
Definition at line 219 of file qplatformscreen.cpp.
Definition at line 156 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
The physical size represents the actual physical dimensions of the display.
The default implementation takes the pixel size of the screen, considers a resolution of 100 dots per inch, and returns the calculated physical size. A device with a screen that has different resolutions will need to be supported by a suitable reimplementation of this function.
Reimplemented in QAndroidPlatformScreen, QCocoaScreen, QDirectFbScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QEglFSScreen, QFbScreen, QIOSScreen, QQnxScreen, QtWaylandClient::QWaylandScreen, QWindowsScreen, and QXcbScreen.
Definition at line 132 of file qplatformscreen.cpp.
|
static |
Definition at line 224 of file qplatformscreen.cpp.
|
virtual |
Returns the current power state.
The default implementation always returns PowerStateOn.
Reimplemented in QEglFSKmsScreen.
Definition at line 470 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the preferred mode index from the modes list.
The default implementation returns 0.
Reimplemented in QAndroidPlatformScreen, and QEglFSKmsScreen.
Definition at line 527 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the vertical refresh rate of the screen, in Hz.
The default returns 60, a sensible default for modern displays.
Reimplemented in QAndroidPlatformScreen, QCocoaScreen, QEglFSEmulatorScreen, QEglFSKmsScreen, QEglFSScreen, QIOSScreen, QQnxScreen, QtWaylandClient::QWaylandScreen, QWindowsScreen, and QXcbScreen.
Definition at line 195 of file qplatformscreen.cpp.
|
protected |
Convenience method to resize all the maximized and fullscreen windows of this platform screen.
Definition at line 319 of file qplatformscreen.cpp.
| QScreen * QPlatformScreen::screen | ( | ) | const |
Definition at line 114 of file qplatformscreen.cpp.
| const QPlatformScreen * QPlatformScreen::screenForPosition | ( | const QPoint & | point | ) | const |
Find the sibling screen corresponding to globalPos.
Returns this screen if no suitable screen is found at the position.
Definition at line 87 of file qplatformscreen.cpp.
|
virtual |
Reimplement this function in subclass to return the serial number of this screen.
The default implementation returns an empty string.
Reimplemented in QEglFSKmsScreen, QWindowsScreen, and QXcbScreen.
Definition at line 267 of file qplatformscreen.cpp.
|
virtual |
Sets the power state for this screen.
Reimplemented in QEglFSKmsScreen.
Definition at line 478 of file qplatformscreen.cpp.
|
virtual |
Returns a hint about this screen's subpixel layout structure.
The default implementation queries the {QT_SUBPIXEL_AA_TYPE} env variable. This is just a hint because most platforms don't have a way to retrieve the correct value from hardware and instead rely on font configurations.
Reimplemented in QCocoaScreen, QEglFSKmsScreen, QtWaylandClient::QWaylandScreen, and QWindowsScreen.
Definition at line 445 of file qplatformscreen.cpp.
Return the given top level window for a given position.
Default implementation retrieves a list of all top level windows and finds the first window which contains point pos
Reimplemented in QAndroidPlatformScreen, QCocoaScreen, QEglFSScreen, QFbScreen, QQnxScreen, QWasmScreen, QWindowsScreen, and QXcbScreen.
Definition at line 55 of file qplatformscreen.cpp.
|
static |
Definition at line 388 of file qplatformscreen.cpp.
|
virtual |
Returns a list of all the platform screens that are part of the same virtual desktop.
Screens part of the same virtual desktop share a common coordinate system, and windows can be freely moved between them.
Reimplemented in QCocoaScreen, QEglFSKmsScreen, QOffscreenScreen, QPlatformPlaceholderScreen, QtWaylandClient::QWaylandScreen, QWindowsScreen, and QXcbScreen.
Definition at line 107 of file qplatformscreen.cpp.
| QWindowList QPlatformScreen::windows | ( | ) | const |
Return all windows residing on this screen.
Definition at line 71 of file qplatformscreen.cpp.
|
friend |
Definition at line 137 of file qplatformscreen.h.
|
protected |
Definition at line 134 of file qplatformscreen.h.