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
qquickwindow.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 QQUICKWINDOW_H
5#define QQUICKWINDOW_H
6
7#include <QtQuick/qtquickglobal.h>
8#include <QtQuick/qsgrendererinterface.h>
9
10#include <QtCore/qmetatype.h>
11#include <QtGui/qwindow.h>
12#include <QtGui/qevent.h>
13#include <QtQml/qqml.h>
14#include <QtQml/qqmldebug.h>
15#include <QtQml/qqmlinfo.h>
16
18
19class QRunnable;
20class QQuickItem;
21class QSGTexture;
30class QSGImageNode;
32class QQuickPalette;
36class QRhi;
37class QRhiSwapChain;
38class QRhiTexture;
39class QSGTextNode;
40
41class Q_QUICK_EXPORT QQuickWindow : public QWindow
42{
44 Q_PRIVATE_PROPERTY(QQuickWindow::d_func(), QQmlListProperty<QObject> data READ data DESIGNABLE false)
46 Q_PROPERTY(QQuickItem* contentItem READ contentItem CONSTANT)
47 Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged REVISION(2, 1))
48 Q_PRIVATE_PROPERTY(QQuickWindow::d_func(), QQuickPalette *palette READ palette WRITE setPalette
49 RESET resetPalette NOTIFY paletteChanged REVISION(6, 2))
50 QDOC_PROPERTY(QWindow* transientParent READ transientParent WRITE setTransientParent NOTIFY transientParentChanged)
51 Q_CLASSINFO("DefaultProperty", "data")
52 Q_DECLARE_PRIVATE(QQuickWindow)
53
57public:
58 enum CreateTextureOption {
59 TextureHasAlphaChannel = 0x0001,
60 TextureHasMipmaps = 0x0002,
61 TextureOwnsGLTexture = 0x0004,
62 TextureCanUseAtlas = 0x0008,
63 TextureIsOpaque = 0x0010
64 };
65
66 enum RenderStage {
67 BeforeSynchronizingStage,
68 AfterSynchronizingStage,
69 BeforeRenderingStage,
70 AfterRenderingStage,
71 AfterSwapStage,
72 NoStage
73 };
74
75 Q_DECLARE_FLAGS(CreateTextureOptions, CreateTextureOption)
76 Q_FLAG(CreateTextureOptions)
77
78 enum SceneGraphError {
79 ContextNotAvailable = 1
80 };
81 Q_ENUM(SceneGraphError)
82
83 enum TextRenderType {
84 QtTextRendering,
85 NativeTextRendering,
86 CurveTextRendering
87 };
88 Q_ENUM(TextRenderType)
89
90 explicit QQuickWindow(QWindow *parent = nullptr);
91 explicit QQuickWindow(QQuickRenderControl *renderControl);
92
93 ~QQuickWindow() override;
94
95 QQuickItem *contentItem() const;
96
97 QQuickItem *activeFocusItem() const;
98 QObject *focusObject() const override;
99
100 QQuickItem *mouseGrabberItem() const;
101
102 QImage grabWindow();
103
104 void setRenderTarget(const QQuickRenderTarget &target);
105 QQuickRenderTarget renderTarget() const;
106
107 struct GraphicsStateInfo {
108 int currentFrameSlot;
109 int framesInFlight;
110 };
111 const GraphicsStateInfo &graphicsStateInfo();
112 void beginExternalCommands();
113 void endExternalCommands();
114 QQmlIncubationController *incubationController() const;
115
116#if QT_CONFIG(accessibility)
117 QAccessibleInterface *accessibleRoot() const override;
118#endif
119
120 // Scene graph specific functions
121 QSGTexture *createTextureFromImage(const QImage &image) const;
122 QSGTexture *createTextureFromImage(const QImage &image, CreateTextureOptions options) const;
123 QSGTexture *createTextureFromRhiTexture(QRhiTexture *texture, CreateTextureOptions options = {}) const;
124
125 void setColor(const QColor &color);
126 QColor color() const;
127
128 static bool hasDefaultAlphaBuffer();
129 static void setDefaultAlphaBuffer(bool useAlpha);
130
131 void setPersistentGraphics(bool persistent);
132 bool isPersistentGraphics() const;
133
134 void setPersistentSceneGraph(bool persistent);
135 bool isPersistentSceneGraph() const;
136
137 bool isSceneGraphInitialized() const;
138
139 void scheduleRenderJob(QRunnable *job, RenderStage schedule);
140
141 qreal effectiveDevicePixelRatio() const;
142
143 QSGRendererInterface *rendererInterface() const;
144
145 static void setGraphicsApi(QSGRendererInterface::GraphicsApi api);
146 static QSGRendererInterface::GraphicsApi graphicsApi();
147
148 static void setSceneGraphBackend(const QString &backend);
149 static QString sceneGraphBackend();
150
151 void setGraphicsDevice(const QQuickGraphicsDevice &device);
152 QQuickGraphicsDevice graphicsDevice() const;
153
154 void setGraphicsConfiguration(const QQuickGraphicsConfiguration &config);
155 QQuickGraphicsConfiguration graphicsConfiguration() const;
156
157 QSGRectangleNode *createRectangleNode() const;
159 QSGNinePatchNode *createNinePatchNode() const;
161
162 static TextRenderType textRenderType();
163 static void setTextRenderType(TextRenderType renderType);
164
165 QRhi *rhi() const;
166 QRhiSwapChain *swapChain() const;
167
173 Q_REVISION(2, 2) void afterSynchronizing();
174 void beforeRendering();
175 void afterRendering();
176 Q_REVISION(2, 2) void afterAnimating();
177 Q_REVISION(2, 2) void sceneGraphAboutToStop();
178
179 Q_REVISION(2, 1) void closing(QQuickCloseEvent *close);
180 void colorChanged(const QColor &);
181 Q_REVISION(2, 1) void activeFocusItemChanged();
182 Q_REVISION(2, 2) void sceneGraphError(QQuickWindow::SceneGraphError error, const QString &message);
183
184 Q_REVISION(2, 14) void beforeRenderPassRecording();
185 Q_REVISION(2, 14) void afterRenderPassRecording();
186
187 Q_REVISION(6, 0) void paletteChanged();
188 Q_REVISION(6, 0) void paletteCreated();
189
190 Q_REVISION(6, 0) void beforeFrameBegin();
191 Q_REVISION(6, 0) void afterFrameEnd();
192
193public Q_SLOTS:
194 void update();
195 void releaseResources();
196
197protected:
198 QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent = nullptr);
200
201 void exposeEvent(QExposeEvent *) override;
202 void resizeEvent(QResizeEvent *) override;
203
204 void showEvent(QShowEvent *) override;
205 void hideEvent(QHideEvent *) override;
206 void closeEvent(QCloseEvent *) override;
207
208 void focusInEvent(QFocusEvent *) override;
209 void focusOutEvent(QFocusEvent *) override;
210
211 bool event(QEvent *) override;
212
213 // These overrides are no longer normal entry points for
214 // input events, but kept in case legacy code calls them.
215 void keyPressEvent(QKeyEvent *) override;
216 void keyReleaseEvent(QKeyEvent *) override;
217 void mousePressEvent(QMouseEvent *) override;
218 void mouseReleaseEvent(QMouseEvent *) override;
219 void mouseDoubleClickEvent(QMouseEvent *) override;
220 void mouseMoveEvent(QMouseEvent *) override;
221#if QT_CONFIG(wheelevent)
222 void wheelEvent(QWheelEvent *) override;
223#endif
224#if QT_CONFIG(tabletevent)
225 void tabletEvent(QTabletEvent *) override;
226#endif
227
228private Q_SLOTS:
229 void maybeUpdate();
230 void cleanupSceneGraph();
231 void physicalDpiChanged();
233 void runJobsAfterSwap();
234 void handleApplicationStateChanged(Qt::ApplicationState state);
235 void handleFontDatabaseChanged();
236private:
237#ifndef QT_NO_DEBUG_STREAM
239 {
240 info.QDebug::operator<<(window);
241 return info;
242 }
243#endif
244
245 friend class QQuickItem;
246 friend class QQuickItemPrivate;
247 friend class QQuickWidget;
252 Q_DISABLE_COPY(QQuickWindow)
253};
254
255#ifndef QT_NO_DEBUG_STREAM
256QDebug Q_QUICK_EXPORT operator<<(QDebug debug, const QQuickWindow *item);
257
259{
260 info.QDebug::operator<<(window);
261 return info;
262}
263#endif
264
266
268
269#endif // QQUICKWINDOW_H
270
static void handleScreenChanged(JNIEnv *, jclass, jint displayId)
IOBluetoothDevice * device
The QCloseEvent class contains parameters that describe a close event.
Definition qevent.h:562
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
\inmodule QtCore
Definition qcoreevent.h:45
The QExposeEvent class contains event parameters for expose events. \inmodule QtGui.
Definition qevent.h:515
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:470
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition qevent.h:586
\inmodule QtGui
Definition qimage.h:37
The QInputMethodEvent class provides parameters for input method events.
Definition qevent.h:625
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
QQmlIncubationController instances drive the progress of QQmlIncubators.
\inmodule QtQml
Definition qqmlinfo.h:30
\qmlsignal QtQuick::Window::sceneGraphError(SceneGraphError error, QString message)
QQuickGraphicsConfiguration controls lower level graphics settings for the QQuickWindow.
The QQuickGraphicsDevice class provides an opaque container for native graphics objects representing ...
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
Contains color groups for each QML item state. \inmodule QtQuick.
The QQuickRenderControl class provides a mechanism for rendering the Qt Quick scenegraph onto an offs...
The QQuickRenderTarget class provides an opaque container for native graphics resources specifying a ...
The QQuickWidget class provides a widget for displaying a Qt Quick user interface.
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
void frameSwapped()
This signal is emitted when a frame has been queued for presenting.
void beforeSynchronizing()
This signal is emitted before the scene graph is synchronized with the QML state.
Q_REVISION(2, 2) void afterSynchronizing()
void sceneGraphInitialized()
\qmlsignal QtQuick::Window::frameSwapped()
void sceneGraphInvalidated()
\qmlsignal QtQuick::Window::sceneGraphInitialized()
friend QQmlInfo operator<<(QQmlInfo info, const QQuickWindow *window)
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
\inmodule QtGui
Definition qrhi.h:1549
\inmodule QtGui
Definition qrhi.h:895
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
\inmodule QtCore
Definition qrunnable.h:18
The QSGImageNode class is provided for convenience to easily draw textured content using the QML scen...
\inmodule QtQuick
The QSGRectangleNode class is a convenience class for drawing solid filled rectangles using scenegrap...
An interface providing access to some of the graphics API specific internals of the scenegraph.
GraphicsApi
\value Unknown An unknown graphics API is in use \value Software The Qt Quick 2D Renderer is in use \...
The QSGTextNode class is a class for drawing text layouts and text documents in the Qt Quick scene gr...
Definition qsgtextnode.h:14
\inmodule QtQuick
Definition qsgtexture.h:20
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:578
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtGui
Definition qwindow.h:63
[Window class with invokable method]
Definition window.h:11
void colorChanged()
else opt state
[0]
Combined button and popup list for selecting options.
ApplicationState
Definition qnamespace.h:262
Definition image.cpp:4
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError * error
EGLConfig config
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1525
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint color
[2]
GLenum target
GLenum GLuint texture
GLuint GLsizei const GLchar * message
struct _cl_event * event
#define QML_NAMED_ELEMENT(NAME)
#define QML_REMOVED_IN_VERSION(MAJOR, MINOR)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
QDebug Q_QUICK_EXPORT operator<<(QDebug debug, const QQuickWindow *item)
static QSvgNode * createImageNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
static QSvgNode * createTextNode(QSvgNode *parent, const QXmlStreamAttributes &attributes, QSvgHandler *handler)
QScreen * screen
[1]
Definition main.cpp:29
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_CLASSINFO(name, value)
#define Q_FLAG(x)
#define Q_SLOTS
#define QDOC_PROPERTY(text)
#define Q_SIGNALS
#define Q_PRIVATE_PROPERTY(d, text)
double qreal
Definition qtypes.h:187
QGraphicsItem * item
myFilter setColor(QColor(128, 0, 0))
aWidget window() -> setWindowTitle("New Window Title")
[2]
QNetworkRequestFactory api
[0]
QHostInfo info
[0]