1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QSCREEN_H
41#define QSCREEN_H
42
43#include <QtGui/qtguiglobal.h>
44#include <QtCore/QList>
45#include <QtCore/QObject>
46#include <QtCore/QRect>
47#include <QtCore/QSize>
48#include <QtCore/QSizeF>
49
50#include <QtGui/QTransform>
51
52#include <QtCore/qnamespace.h>
53
54QT_BEGIN_NAMESPACE
55
56
57class QPlatformScreen;
58class QScreenPrivate;
59class QWindow;
60class QRect;
61class QPixmap;
62#ifndef QT_NO_DEBUG_STREAM
63class QDebug;
64#endif
65
66class Q_GUI_EXPORT QScreen : public QObject
67{
68 Q_OBJECT
69 Q_DECLARE_PRIVATE(QScreen)
70
71 Q_PROPERTY(QString name READ name CONSTANT)
72 Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
73 Q_PROPERTY(QString model READ model CONSTANT)
74 Q_PROPERTY(QString serialNumber READ serialNumber CONSTANT)
75 Q_PROPERTY(int depth READ depth CONSTANT)
76 Q_PROPERTY(QSize size READ size NOTIFY geometryChanged)
77 Q_PROPERTY(QSize availableSize READ availableSize NOTIFY availableGeometryChanged)
78 Q_PROPERTY(QSize virtualSize READ virtualSize NOTIFY virtualGeometryChanged)
79 Q_PROPERTY(QSize availableVirtualSize READ availableVirtualSize NOTIFY virtualGeometryChanged)
80 Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
81 Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
82 Q_PROPERTY(QRect virtualGeometry READ virtualGeometry NOTIFY virtualGeometryChanged)
83 Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry NOTIFY virtualGeometryChanged)
84 Q_PROPERTY(QSizeF physicalSize READ physicalSize NOTIFY physicalSizeChanged)
85 Q_PROPERTY(qreal physicalDotsPerInchX READ physicalDotsPerInchX NOTIFY physicalDotsPerInchChanged)
86 Q_PROPERTY(qreal physicalDotsPerInchY READ physicalDotsPerInchY NOTIFY physicalDotsPerInchChanged)
87 Q_PROPERTY(qreal physicalDotsPerInch READ physicalDotsPerInch NOTIFY physicalDotsPerInchChanged)
88 Q_PROPERTY(qreal logicalDotsPerInchX READ logicalDotsPerInchX NOTIFY logicalDotsPerInchChanged)
89 Q_PROPERTY(qreal logicalDotsPerInchY READ logicalDotsPerInchY NOTIFY logicalDotsPerInchChanged)
90 Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
91 Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY physicalDotsPerInchChanged)
92 Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
93 Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
94 Q_PROPERTY(Qt::ScreenOrientation nativeOrientation READ nativeOrientation)
95 Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged)
96
97public:
98 ~QScreen();
99 QPlatformScreen *handle() const;
100
101 QString name() const;
102
103 QString manufacturer() const;
104 QString model() const;
105 QString serialNumber() const;
106
107 int depth() const;
108
109 QSize size() const;
110 QRect geometry() const;
111
112 QSizeF physicalSize() const;
113
114 qreal physicalDotsPerInchX() const;
115 qreal physicalDotsPerInchY() const;
116 qreal physicalDotsPerInch() const;
117
118 qreal logicalDotsPerInchX() const;
119 qreal logicalDotsPerInchY() const;
120 qreal logicalDotsPerInch() const;
121
122 qreal devicePixelRatio() const;
123
124 QSize availableSize() const;
125 QRect availableGeometry() const;
126
127 QList<QScreen *> virtualSiblings() const;
128 QScreen *virtualSiblingAt(QPoint point);
129
130 QSize virtualSize() const;
131 QRect virtualGeometry() const;
132
133 QSize availableVirtualSize() const;
134 QRect availableVirtualGeometry() const;
135
136 Qt::ScreenOrientation primaryOrientation() const;
137 Qt::ScreenOrientation orientation() const;
138 Qt::ScreenOrientation nativeOrientation() const;
139
140 Qt::ScreenOrientations orientationUpdateMask() const;
141 void setOrientationUpdateMask(Qt::ScreenOrientations mask);
142
143 int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const;
144 QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const;
145 QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const;
146
147 bool isPortrait(Qt::ScreenOrientation orientation) const;
148 bool isLandscape(Qt::ScreenOrientation orientation) const;
149
150 QPixmap grabWindow(WId window, int x = 0, int y = 0, int w = -1, int h = -1);
151
152 qreal refreshRate() const;
153
154Q_SIGNALS:
155 void geometryChanged(const QRect &geometry);
156 void availableGeometryChanged(const QRect &geometry);
157 void physicalSizeChanged(const QSizeF &size);
158 void physicalDotsPerInchChanged(qreal dpi);
159 void logicalDotsPerInchChanged(qreal dpi);
160 void virtualGeometryChanged(const QRect &rect);
161 void primaryOrientationChanged(Qt::ScreenOrientation orientation);
162 void orientationChanged(Qt::ScreenOrientation orientation);
163 void refreshRateChanged(qreal refreshRate);
164
165private:
166 explicit QScreen(QPlatformScreen *screen);
167
168 Q_DISABLE_COPY(QScreen)
169 friend class QGuiApplicationPrivate;
170 friend class QPlatformIntegration;
171 friend class QPlatformScreen;
172 friend class QHighDpiScaling;
173 friend class QWindowSystemInterface;
174};
175
176#ifndef QT_NO_DEBUG_STREAM
177Q_GUI_EXPORT QDebug operator<<(QDebug, const QScreen *);
178#endif
179
180QT_END_NAMESPACE
181
182#endif // QSCREEN_H
183
184

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