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#include <QtCore/qnativeinterface.h>
54
55QT_BEGIN_NAMESPACE
56
57
58class QPlatformScreen;
59class QScreenPrivate;
60class QWindow;
61class QRect;
62class QPixmap;
63#ifndef QT_NO_DEBUG_STREAM
64class QDebug;
65#endif
66
67class Q_GUI_EXPORT QScreen : public QObject
68{
69 Q_OBJECT
70 Q_DECLARE_PRIVATE(QScreen)
71
72 Q_PROPERTY(QString name READ name CONSTANT)
73 Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
74 Q_PROPERTY(QString model READ model CONSTANT)
75 Q_PROPERTY(QString serialNumber READ serialNumber CONSTANT)
76 Q_PROPERTY(int depth READ depth CONSTANT)
77 Q_PROPERTY(QSize size READ size NOTIFY geometryChanged)
78 Q_PROPERTY(QSize availableSize READ availableSize NOTIFY availableGeometryChanged)
79 Q_PROPERTY(QSize virtualSize READ virtualSize NOTIFY virtualGeometryChanged)
80 Q_PROPERTY(QSize availableVirtualSize READ availableVirtualSize NOTIFY virtualGeometryChanged)
81 Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
82 Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
83 Q_PROPERTY(QRect virtualGeometry READ virtualGeometry NOTIFY virtualGeometryChanged)
84 Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry
85 NOTIFY virtualGeometryChanged)
86 Q_PROPERTY(QSizeF physicalSize READ physicalSize NOTIFY physicalSizeChanged)
87 Q_PROPERTY(qreal physicalDotsPerInchX READ physicalDotsPerInchX
88 NOTIFY physicalDotsPerInchChanged)
89 Q_PROPERTY(qreal physicalDotsPerInchY READ physicalDotsPerInchY
90 NOTIFY physicalDotsPerInchChanged)
91 Q_PROPERTY(qreal physicalDotsPerInch READ physicalDotsPerInch NOTIFY physicalDotsPerInchChanged)
92 Q_PROPERTY(qreal logicalDotsPerInchX READ logicalDotsPerInchX NOTIFY logicalDotsPerInchChanged)
93 Q_PROPERTY(qreal logicalDotsPerInchY READ logicalDotsPerInchY NOTIFY logicalDotsPerInchChanged)
94 Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
95 Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY physicalDotsPerInchChanged)
96 Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation
97 NOTIFY primaryOrientationChanged)
98 Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
99 Q_PROPERTY(Qt::ScreenOrientation nativeOrientation READ nativeOrientation)
100 Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged)
101
102public:
103 ~QScreen();
104 QPlatformScreen *handle() const;
105
106 QString name() const;
107
108 QString manufacturer() const;
109 QString model() const;
110 QString serialNumber() const;
111
112 int depth() const;
113
114 QSize size() const;
115 QRect geometry() const;
116
117 QSizeF physicalSize() const;
118
119 qreal physicalDotsPerInchX() const;
120 qreal physicalDotsPerInchY() const;
121 qreal physicalDotsPerInch() const;
122
123 qreal logicalDotsPerInchX() const;
124 qreal logicalDotsPerInchY() const;
125 qreal logicalDotsPerInch() const;
126
127 qreal devicePixelRatio() const;
128
129 QSize availableSize() const;
130 QRect availableGeometry() const;
131
132 QList<QScreen *> virtualSiblings() const;
133 QScreen *virtualSiblingAt(QPoint point);
134
135 QSize virtualSize() const;
136 QRect virtualGeometry() const;
137
138 QSize availableVirtualSize() const;
139 QRect availableVirtualGeometry() const;
140
141 Qt::ScreenOrientation primaryOrientation() const;
142 Qt::ScreenOrientation orientation() const;
143 Qt::ScreenOrientation nativeOrientation() const;
144
145 int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const;
146 QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const;
147 QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const;
148
149 bool isPortrait(Qt::ScreenOrientation orientation) const;
150 bool isLandscape(Qt::ScreenOrientation orientation) const;
151
152 QPixmap grabWindow(WId window = 0, int x = 0, int y = 0, int w = -1, int h = -1);
153
154 qreal refreshRate() const;
155
156 QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QScreen)
157
158Q_SIGNALS:
159 void geometryChanged(const QRect &geometry);
160 void availableGeometryChanged(const QRect &geometry);
161 void physicalSizeChanged(const QSizeF &size);
162 void physicalDotsPerInchChanged(qreal dpi);
163 void logicalDotsPerInchChanged(qreal dpi);
164 void virtualGeometryChanged(const QRect &rect);
165 void primaryOrientationChanged(Qt::ScreenOrientation orientation);
166 void orientationChanged(Qt::ScreenOrientation orientation);
167 void refreshRateChanged(qreal refreshRate);
168
169private:
170 explicit QScreen(QPlatformScreen *screen);
171
172 Q_DISABLE_COPY(QScreen)
173 friend class QGuiApplicationPrivate;
174 friend class QPlatformIntegration;
175 friend class QPlatformScreen;
176 friend class QHighDpiScaling;
177 friend class QWindowSystemInterface;
178};
179
180#ifndef QT_NO_DEBUG_STREAM
181Q_GUI_EXPORT QDebug operator<<(QDebug, const QScreen *);
182#endif
183
184QT_END_NAMESPACE
185
186#endif // QSCREEN_H
187
188

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