Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qplatformscreen.h
Go to the documentation of this file.
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QPLATFORMSCREEN_H
6
#
define
QPLATFORMSCREEN_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is part of the QPA API and is not meant to be used
13
// in applications. Usage of this API may make your code
14
// source and binary incompatible with future versions of Qt.
15
//
16
17
#
include
<
QtGui
/
qtguiglobal
.
h
>
18
#
include
<
QtCore
/
qmetatype
.
h
>
19
#
include
<
QtCore
/
qnamespace
.
h
>
20
#
include
<
QtCore
/
qcoreevent
.
h
>
21
#
include
<
QtCore
/
qvariant
.
h
>
22
#
include
<
QtCore
/
qrect
.
h
>
23
#
include
<
QtCore
/
qobject
.
h
>
24
25
#
include
<
QtGui
/
qcolorspace
.
h
>
26
#
include
<
QtGui
/
qcursor
.
h
>
27
#
include
<
QtGui
/
qimage
.
h
>
28
#
include
<
QtGui
/
qwindowdefs
.
h
>
29
#
include
<
qpa
/
qplatformpixmap
.
h
>
30
31
QT_BEGIN_NAMESPACE
32
33
34
class
QPlatformBackingStore;
35
class
QPlatformScreenPrivate
;
36
class
QPlatformWindow;
37
class
QPlatformCursor;
38
class
QScreen;
39
class
QSurfaceFormat;
40
41
typedef
std
::
pair
<
qreal
,
qreal
>
QDpi
;
42
43
44
class
Q_GUI_EXPORT
QPlatformScreen
45
{
46
Q_GADGET
47
Q_DECLARE_PRIVATE(QPlatformScreen)
48
49
public
:
50
Q_DISABLE_COPY_MOVE(QPlatformScreen)
51
52
enum
SubpixelAntialiasingType {
// copied from qfontengine_p.h since we can't include private headers
53
Subpixel_None,
54
Subpixel_RGB,
55
Subpixel_BGR,
56
Subpixel_VRGB,
57
Subpixel_VBGR
58
};
59
60
enum
PowerState {
61
PowerStateOn,
62
PowerStateStandby,
63
PowerStateSuspend,
64
PowerStateOff
65
};
66
67
struct
Mode {
68
QSize size;
69
qreal refreshRate;
70
};
71
72
QPlatformScreen();
73
virtual
~QPlatformScreen();
74
75
virtual
bool
isPlaceholder()
const
{
return
false
; }
76
77
virtual
QPixmap grabWindow(WId window,
int
x,
int
y,
int
width,
int
height)
const
;
78
79
virtual
QRect geometry()
const
= 0;
80
virtual
QRect availableGeometry()
const
{
return
geometry();}
81
82
virtual
int
depth()
const
= 0;
83
virtual
QImage::Format format()
const
= 0;
84
virtual
QColorSpace colorSpace()
const
{
return
QColorSpace::SRgb; }
85
86
virtual
QSizeF physicalSize()
const
;
87
virtual
QDpi logicalDpi()
const
;
88
virtual
QDpi logicalBaseDpi()
const
;
89
virtual
qreal devicePixelRatio()
const
;
90
91
virtual
qreal refreshRate()
const
;
92
93
virtual
Qt::ScreenOrientation nativeOrientation()
const
;
94
virtual
Qt::ScreenOrientation orientation()
const
;
95
96
virtual
QWindow *topLevelAt(
const
QPoint &point)
const
;
97
QWindowList windows()
const
;
98
99
virtual
QList<QPlatformScreen *> virtualSiblings()
const
;
100
const
QPlatformScreen *screenForPosition(
const
QPoint &point)
const
;
101
102
QScreen *screen()
const
;
103
104
//jl: should this function be in QPlatformIntegration
105
//jl: maybe screenForWindow is a better name?
106
static
QPlatformScreen *platformScreenForWindow(
const
QWindow *window);
107
108
virtual
QString name()
const
{
return
QString(); }
109
110
virtual
QString manufacturer()
const
;
111
virtual
QString model()
const
;
112
virtual
QString serialNumber()
const
;
113
114
virtual
QPlatformCursor *cursor()
const
;
115
virtual
SubpixelAntialiasingType subpixelAntialiasingTypeHint()
const
;
116
117
virtual
PowerState powerState()
const
;
118
virtual
void
setPowerState(PowerState state);
119
120
virtual
QList<Mode> modes()
const
;
121
122
virtual
int
currentMode()
const
;
123
virtual
int
preferredMode()
const
;
124
125
static
int
angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
126
static
QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b,
const
QRect &target);
127
static
QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b,
const
QRect &rect);
128
129
static
QDpi overrideDpi(
const
QDpi &in);
130
131
protected
:
132
void
resizeMaximizedWindows();
133
134
QScopedPointer<QPlatformScreenPrivate> d_ptr;
135
136
private
:
137
friend
class
QScreen;
138
};
139
140
// Qt doesn't currently support running with no platform screen
141
// QPA plugins can use this class to create a fake screen
142
class
Q_GUI_EXPORT
QPlatformPlaceholderScreen
:
public
QPlatformScreen {
143
public
:
144
// virtualSibling can be passed in to make the placeholder a sibling with other screens during
145
// the transitioning phase when the real screen is about to be removed, or the first real screen
146
// is about to be added. This is useful because Qt will currently recreate (but now show!)
147
// windows when they are moved from one virtual desktop to another, so if the last monitor is
148
// unplugged, then plugged in again, windows will be hidden unless the placeholder belongs to
149
// the same virtual desktop as the other screens.
150
QPlatformPlaceholderScreen(
bool
virtualSibling =
true
) : m_virtualSibling(virtualSibling) {}
151
bool
isPlaceholder()
const
override {
return
true
; }
152
QRect geometry()
const
override {
return
QRect(); }
153
QRect availableGeometry()
const
override {
return
QRect(); }
154
int
depth()
const
override {
return
32; }
155
QImage::Format format()
const
override {
return
QImage::Format::Format_RGB32; }
156
QList<QPlatformScreen *> virtualSiblings()
const
override;
157
private
:
158
bool
m_virtualSibling =
true
;
159
};
160
161
QT_END_NAMESPACE
162
163
#
endif
// QPLATFORMSCREEN_H
QPlatformPlaceholderScreen
Definition
qplatformscreen.h:142
QPlatformScreenPrivate
Definition
qplatformscreen_p.h:29
QPlatformScreen
The QPlatformScreen class provides an abstraction for visual displays.
Definition
qplatformscreen.h:45
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
log2
static int log2(uint i)
Definition
qplatformscreen.cpp:353
QDpi
std::pair< qreal, qreal > QDpi
Definition
qplatformscreen.h:41
qtbase
src
gui
kernel
qplatformscreen.h
Generated on
for Qt by
1.18.0