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 int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const;
141 QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const;
142 QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const;
143
144 bool isPortrait(Qt::ScreenOrientation orientation) const;
145 bool isLandscape(Qt::ScreenOrientation orientation) const;
146
147 QPixmap grabWindow(WId window = 0, int x = 0, int y = 0, int w = -1, int h = -1);
148
149 qreal refreshRate() const;
150
151Q_SIGNALS:
152 void geometryChanged(const QRect &geometry);
153 void availableGeometryChanged(const QRect &geometry);
154 void physicalSizeChanged(const QSizeF &size);
155 void physicalDotsPerInchChanged(qreal dpi);
156 void logicalDotsPerInchChanged(qreal dpi);
157 void virtualGeometryChanged(const QRect &rect);
158 void primaryOrientationChanged(Qt::ScreenOrientation orientation);
159 void orientationChanged(Qt::ScreenOrientation orientation);
160 void refreshRateChanged(qreal refreshRate);
161
162private:
163 explicit QScreen(QPlatformScreen *screen);
164
165 Q_DISABLE_COPY(QScreen)
166 friend class QGuiApplicationPrivate;
167 friend class QPlatformIntegration;
168 friend class QPlatformScreen;
169 friend class QHighDpiScaling;
170 friend class QWindowSystemInterface;
171};
172
173#ifndef QT_NO_DEBUG_STREAM
174Q_GUI_EXPORT QDebug operator<<(QDebug, const QScreen *);
175#endif
176
177QT_END_NAMESPACE
178
179#endif // QSCREEN_H
180
181