Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindow_p.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
4#ifndef QWINDOW_P_H
5#define QWINDOW_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include <QtGui/qscreen.h>
20#include <QtGui/qwindow.h>
21#include <qpa/qplatformwindow.h>
22
23#include <QtCore/private/qobject_p.h>
24#include <QtCore/qelapsedtimer.h>
25#include <QtCore/qxpfunctional.h>
26#include <QtGui/qicon.h>
27#include <QtGui/qpalette.h>
28
29#include <QtCore/qpointer.h>
30
32
33class Q_GUI_EXPORT QWindowPrivate : public QObjectPrivate
34{
35 Q_DECLARE_PUBLIC(QWindow)
36
37public:
39 {
41 WindowFrameExclusive
42 };
43
45 ~QWindowPrivate() override;
46
47 void init(QWindow *parent, QScreen *targetScreen = nullptr);
48
49#ifndef QT_NO_CURSOR
50 void setCursor(const QCursor *c = nullptr);
51 bool applyCursor();
52#endif
53
54 QPoint globalPosition() const;
55
56 QWindow *topLevelWindow(QWindow::AncestorMode mode = QWindow::IncludeTransients) const;
57
58 virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; }
59 virtual QPalette windowPalette() const { return QPalette(); }
60
61 virtual void setVisible(bool visible);
62 void updateVisibility();
63 void _q_clearAlert();
64
65 enum SiblingPosition { PositionTop, PositionBottom };
66 void updateSiblingPosition(SiblingPosition);
67
68 bool windowRecreationRequired(QScreen *newScreen) const;
69 void create(bool recursive);
70 void destroy();
71 void setTopLevelScreen(QScreen *newScreen, bool recreate);
72 void connectToScreen(QScreen *topLevelScreen);
73 void disconnectFromScreen();
74 void emitScreenChangedRecursion(QScreen *newScreen);
75 QScreen *screenForGeometry(const QRect &rect) const;
76 void setTransientParent(QWindow *parent);
77
78 virtual void clearFocusObject();
79
80 enum class FocusTarget {
81 First,
82 Last,
83 Current,
84 Next,
85 Prev
86 };
88
89 virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
90
91 void setMinOrMaxSize(QSize *oldSizeMember, const QSize &size,
92 qxp::function_ref<void()> funcWidthChanged,
93 qxp::function_ref<void()> funcHeightChanged);
94
96
97 virtual bool participatesInLastWindowClosed() const;
98 virtual bool treatAsVisible() const;
99
100 bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; }
102 { positionAutomatic = resizeAutomatic = a; }
103
104 bool updateDevicePixelRatio();
105
106 static QWindowPrivate *get(QWindow *window) { return window->d_func(); }
107
108 static Qt::WindowState effectiveState(Qt::WindowStates);
109
111 Qt::WindowFlags windowFlags = Qt::Window;
112 QWindow *parentWindow = nullptr;
113 QPlatformWindow *platformWindow = nullptr;
114 bool visible= false;
115 bool visibilityOnDestroy = false;
116 bool exposed = false;
117 bool inClose = false;
123 qreal devicePixelRatio = 1.0;
124 Qt::WindowStates windowState = Qt::WindowNoState;
125 QWindow::Visibility visibility = QWindow::Hidden;
126 bool resizeEventPending = true;
127 bool receivedExpose = false;
128 PositionPolicy positionPolicy = WindowFrameExclusive;
129 bool positionAutomatic = true;
130 // resizeAutomatic suppresses resizing by QPlatformWindow::initialGeometry().
131 // It also indicates that width/height=0 is acceptable (for example, for
132 // the QRollEffect widget) and is thus not cleared in setGeometry().
133 // An alternative approach might be using -1,-1 as a default size.
134 bool resizeAutomatic = true;
136 qreal opacity= 1;
138
139 QSize minimumSize = {0, 0};
143
145 bool blockedByModalWindow = false;
146
147 bool updateRequestPending = false;
148 bool transientParentPropertySet = false;
149
150 QPointer<QWindow> transientParent;
151 QPointer<QScreen> topLevelScreen;
152
153#ifndef QT_NO_CURSOR
155 bool hasCursor = false;
156#endif
157
159
160#if QT_CONFIG(vulkan)
161 QVulkanInstance *vulkanInstance = nullptr;
162#endif
163};
164
165
167
168#endif // QWINDOW_P_H
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition qcursor.h:45
\inmodule QtCore
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
The QPlatformWindow class provides an abstraction for top-level windows.
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
SurfaceType
The SurfaceType enum describes what type of surface this is.
Definition qsurface.h:30
@ RasterSurface
Definition qsurface.h:31
The QVulkanInstance class represents a native Vulkan instance, enabling Vulkan rendering onto a QSurf...
QPointer< QScreen > topLevelScreen
Definition qwindow_p.h:151
static QWindowPrivate * get(QWindow *window)
Definition qwindow_p.h:106
QPointer< QWindow > transientParent
Definition qwindow_p.h:150
~QWindowPrivate() override
QString windowFilePath
Definition qwindow_p.h:120
QElapsedTimer lastComposeTime
Definition qwindow_p.h:158
void setAutomaticPositionAndResizeEnabled(bool a)
Definition qwindow_p.h:101
virtual void setFocusToTarget(FocusTarget, Qt::FocusReason)
Definition qwindow_p.h:87
QSize sizeIncrement
Definition qwindow_p.h:142
virtual QWindow * eventReceiver()
Definition qwindow_p.h:58
virtual QPalette windowPalette() const
Definition qwindow_p.h:59
virtual void processSafeAreaMarginsChanged()
Definition qwindow_p.h:95
QSurfaceFormat requestedFormat
Definition qwindow_p.h:118
QString windowTitle
Definition qwindow_p.h:119
bool isPopup() const
Definition qwindow_p.h:100
\inmodule QtGui
Definition qwindow.h:63
QCursor cursor
rect
[4]
Combined button and popup list for selecting options.
WindowState
Definition qnamespace.h:251
@ WindowNoState
Definition qnamespace.h:252
WindowModality
@ NonModal
ScreenOrientation
Definition qnamespace.h:271
@ PrimaryOrientation
Definition qnamespace.h:272
@ ArrowCursor
@ Popup
Definition qnamespace.h:211
@ WindowType_Mask
Definition qnamespace.h:220
@ Window
Definition qnamespace.h:207
FocusReason
static void applyCursor(QWindow *w, QCursor c)
GLenum mode
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
const GLubyte * c
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
#define QWINDOWSIZE_MAX
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
double qreal
Definition qtypes.h:187
item setCursor(Qt::IBeamCursor)
[1]
aWidget window() -> setWindowTitle("New Window Title")
[2]
view create()