QScreen Class
The QScreen class is used to query screen properties. More…
| Header | #include <QScreen> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Gui) |
| Module | Nt GUI C++ Classes |
| Inherits | QObject |
List of all members, including inherited members
Public Functions
| ~QScreen() | |
| QString | name() const |
| int | depth() const |
| QSize | size() const |
| QRect | geometry() const |
| QRect | availableGeometry() const |
| QSizeF | physicalSize() const |
| qreal | logicalDotsPerInchX() const |
| qreal | logicalDotsPerInchY() const |
| qreal | logicalDotsPerInch() const |
| qreal | physicalDotsPerInch() const |
| qreal | devicePixelRatio() const |
Signals
| void | geometryChanged(const QRect &geometry) |
Detailed Description
A screen is a monitor. QGuiApplication::primaryScreen() returns the main one and QGuiApplication::screens() all of them. Windows are created on a screen.
See also QGuiApplication and QWindow.
Differences from Qt
Only the geometry, depth and resolution are available. There is no orientation, refresh rate, manufacturer, virtual siblings or grabWindow(). The device pixel ratio is always 1.
Member Function Documentation
QScreen::~QScreen()
Destroys the screen object.
QRect QScreen::availableGeometry() const
Returns the part of the screen that windows can use, which excludes panels and docks when the platform reports them.
See also geometry().
int QScreen::depth() const
Returns the number of bits per pixel.
qreal QScreen::devicePixelRatio() const
Returns the number of pixels of the screen that one unit of window coordinates covers. It is 1 on an ordinary screen and 2 on one with twice the usual density. The xcb platform takes it from the Xft.dpi resource, or from the QT_SCALE_FACTOR environment variable.
A QWindow, a QScreen and a QWidget measure in these units, whereas a QImage counts pixels.
QRect QScreen::geometry() const
Returns the geometry of the screen in pixels.
See also size() and availableGeometry().
void QScreen::geometryChanged(const QRect &geometry)
This signal is emitted when the geometry of the screen changes to geometry.
qreal QScreen::logicalDotsPerInch() const
Returns the average of the horizontal and vertical logical dots per inch.
qreal QScreen::logicalDotsPerInchX() const
Returns the number of logical dots per inch in the horizontal direction.
See also logicalDotsPerInch().
qreal QScreen::logicalDotsPerInchY() const
Returns the number of logical dots per inch in the vertical direction.
See also logicalDotsPerInch().
QString QScreen::name() const
Returns the name of the screen, such as "DP-1".
qreal QScreen::physicalDotsPerInch() const
Returns the number of physical dots per inch, computed from the size in pixels and in millimeters.
QSizeF QScreen::physicalSize() const
Returns the size of the screen in millimeters.
QSize QScreen::size() const
Returns the size of the screen in pixels.
See also geometry().