1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSCREEN_H
5#define QSCREEN_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/QList>
9#include <QtCore/QObject>
10#include <QtCore/QRect>
11#include <QtCore/QSize>
12#include <QtCore/QSizeF>
13
14#include <QtGui/QTransform>
15
16#include <QtCore/qnamespace.h>
17#include <QtCore/qnativeinterface.h>
18
19QT_BEGIN_NAMESPACE
20
21
22class QPlatformScreen;
23class QScreenPrivate;
24class QWindow;
25class QRect;
26class QPixmap;
27#ifndef QT_NO_DEBUG_STREAM
28class QDebug;
29#endif
30
31class Q_GUI_EXPORT QScreen : public QObject
32{
33 Q_OBJECT
34 Q_DECLARE_PRIVATE(QScreen)
35
36 Q_PROPERTY(QString name READ name CONSTANT)
37 Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
38 Q_PROPERTY(QString model READ model CONSTANT)
39 Q_PROPERTY(QString serialNumber READ serialNumber CONSTANT)
40 Q_PROPERTY(int depth READ depth CONSTANT)
41 Q_PROPERTY(QSize size READ size NOTIFY geometryChanged)
42 Q_PROPERTY(QSize availableSize READ availableSize NOTIFY availableGeometryChanged)
43 Q_PROPERTY(QSize virtualSize READ virtualSize NOTIFY virtualGeometryChanged)
44 Q_PROPERTY(QSize availableVirtualSize READ availableVirtualSize NOTIFY virtualGeometryChanged)
45 Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
46 Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
47 Q_PROPERTY(QRect virtualGeometry READ virtualGeometry NOTIFY virtualGeometryChanged)
48 Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry
49 NOTIFY virtualGeometryChanged)
50 Q_PROPERTY(QSizeF physicalSize READ physicalSize NOTIFY physicalSizeChanged)
51 Q_PROPERTY(qreal physicalDotsPerInchX READ physicalDotsPerInchX
52 NOTIFY physicalDotsPerInchChanged)
53 Q_PROPERTY(qreal physicalDotsPerInchY READ physicalDotsPerInchY
54 NOTIFY physicalDotsPerInchChanged)
55 Q_PROPERTY(qreal physicalDotsPerInch READ physicalDotsPerInch NOTIFY physicalDotsPerInchChanged)
56 Q_PROPERTY(qreal logicalDotsPerInchX READ logicalDotsPerInchX NOTIFY logicalDotsPerInchChanged)
57 Q_PROPERTY(qreal logicalDotsPerInchY READ logicalDotsPerInchY NOTIFY logicalDotsPerInchChanged)
58 Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
59 Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY physicalDotsPerInchChanged)
60 Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation
61 NOTIFY primaryOrientationChanged)
62 Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
63 Q_PROPERTY(Qt::ScreenOrientation nativeOrientation READ nativeOrientation)
64 Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged)
65
66public:
67 ~QScreen();
68 QPlatformScreen *handle() const;
69
70 QString name() const;
71
72 QString manufacturer() const;
73 QString model() const;
74 QString serialNumber() const;
75
76 int depth() const;
77
78 QSize size() const;
79 QRect geometry() const;
80
81 QSizeF physicalSize() const;
82
83 qreal physicalDotsPerInchX() const;
84 qreal physicalDotsPerInchY() const;
85 qreal physicalDotsPerInch() const;
86
87 qreal logicalDotsPerInchX() const;
88 qreal logicalDotsPerInchY() const;
89 qreal logicalDotsPerInch() const;
90
91 qreal devicePixelRatio() const;
92
93 QSize availableSize() const;
94 QRect availableGeometry() const;
95
96 QList<QScreen *> virtualSiblings() const;
97 QScreen *virtualSiblingAt(QPoint point);
98
99 QSize virtualSize() const;
100 QRect virtualGeometry() const;
101
102 QSize availableVirtualSize() const;
103 QRect availableVirtualGeometry() const;
104
105 Qt::ScreenOrientation primaryOrientation() const;
106 Qt::ScreenOrientation orientation() const;
107 Qt::ScreenOrientation nativeOrientation() const;
108
109 int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const;
110 QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const;
111 QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const;
112
113 bool isPortrait(Qt::ScreenOrientation orientation) const;
114 bool isLandscape(Qt::ScreenOrientation orientation) const;
115
116 QPixmap grabWindow(WId window = 0, int x = 0, int y = 0, int w = -1, int h = -1);
117
118 qreal refreshRate() const;
119
120 QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QScreen)
121
122Q_SIGNALS:
123 void geometryChanged(const QRect &geometry);
124 void availableGeometryChanged(const QRect &geometry);
125 void physicalSizeChanged(const QSizeF &size);
126 void physicalDotsPerInchChanged(qreal dpi);
127 void logicalDotsPerInchChanged(qreal dpi);
128 void virtualGeometryChanged(const QRect &rect);
129 void primaryOrientationChanged(Qt::ScreenOrientation orientation);
130 void orientationChanged(Qt::ScreenOrientation orientation);
131 void refreshRateChanged(qreal refreshRate);
132
133private:
134 explicit QScreen(QPlatformScreen *screen);
135
136 Q_DISABLE_COPY(QScreen)
137 friend class QGuiApplicationPrivate;
138 friend class QPlatformIntegration;
139 friend class QPlatformScreen;
140 friend class QHighDpiScaling;
141 friend class QWindowSystemInterface;
142};
143
144#ifndef QT_NO_DEBUG_STREAM
145Q_GUI_EXPORT QDebug operator<<(QDebug, const QScreen *);
146#endif
147
148QT_END_NAMESPACE
149
150#endif // QSCREEN_H
151
152

source code of qtbase/src/gui/kernel/qscreen.h