Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickwindow.h |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
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 QtQuick 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 QQUICKWINDOW_H | - | ||||||
41 | #define QQUICKWINDOW_H | - | ||||||
42 | - | |||||||
43 | #include <QtQuick/qtquickglobal.h> | - | ||||||
44 | #include <QtQuick/qsgrendererinterface.h> | - | ||||||
45 | #include <QtCore/qmetatype.h> | - | ||||||
46 | #include <QtGui/qopengl.h> | - | ||||||
47 | #include <QtGui/qwindow.h> | - | ||||||
48 | #include <QtGui/qevent.h> | - | ||||||
49 | #include <QtQml/qqml.h> | - | ||||||
50 | #include <QtQml/qqmldebug.h> | - | ||||||
51 | - | |||||||
52 | QT_BEGIN_NAMESPACE | - | ||||||
53 | - | |||||||
54 | class QRunnable; | - | ||||||
55 | class QQuickItem; | - | ||||||
56 | class QSGTexture; | - | ||||||
57 | class QInputMethodEvent; | - | ||||||
58 | class QQuickWindowPrivate; | - | ||||||
59 | class QQuickWindowAttached; | - | ||||||
60 | class QOpenGLContext; | - | ||||||
61 | class QOpenGLFramebufferObject; | - | ||||||
62 | class QQmlIncubationController; | - | ||||||
63 | class QInputMethodEvent; | - | ||||||
64 | class QQuickCloseEvent; | - | ||||||
65 | class QQuickRenderControl; | - | ||||||
66 | class QSGRectangleNode; | - | ||||||
67 | class QSGImageNode; | - | ||||||
68 | class QSGNinePatchNode; | - | ||||||
69 | - | |||||||
70 | class Q_QUICK_EXPORT QQuickWindow : public QWindow | - | ||||||
71 | { | - | ||||||
72 | Q_OBJECT | - | ||||||
73 | Q_PRIVATE_PROPERTY(QQuickWindow::d_func(), QQmlListProperty<QObject> data READ data DESIGNABLE false) | - | ||||||
74 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) | - | ||||||
75 | Q_PROPERTY(QQuickItem* contentItem READ contentItem CONSTANT) | - | ||||||
76 | Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged REVISION 1) | - | ||||||
77 | Q_CLASSINFO("DefaultProperty", "data") | - | ||||||
78 | Q_DECLARE_PRIVATE(QQuickWindow) executed 6972119 times by 91 tests: return reinterpret_cast<QQuickWindowPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 569179 times by 91 tests: return reinterpret_cast<const QQuickWindowPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 569179-6972119 | ||||||
79 | public: | - | ||||||
80 | enum CreateTextureOption { | - | ||||||
81 | TextureHasAlphaChannel = 0x0001, | - | ||||||
82 | TextureHasMipmaps = 0x0002, | - | ||||||
83 | TextureOwnsGLTexture = 0x0004, | - | ||||||
84 | TextureCanUseAtlas = 0x0008, | - | ||||||
85 | TextureIsOpaque = 0x0010 | - | ||||||
86 | }; | - | ||||||
87 | - | |||||||
88 | enum RenderStage { | - | ||||||
89 | BeforeSynchronizingStage, | - | ||||||
90 | AfterSynchronizingStage, | - | ||||||
91 | BeforeRenderingStage, | - | ||||||
92 | AfterRenderingStage, | - | ||||||
93 | AfterSwapStage, | - | ||||||
94 | NoStage | - | ||||||
95 | }; | - | ||||||
96 | - | |||||||
97 | Q_DECLARE_FLAGS(CreateTextureOptions, CreateTextureOption) | - | ||||||
98 | - | |||||||
99 | enum SceneGraphError { | - | ||||||
100 | ContextNotAvailable = 1 | - | ||||||
101 | }; | - | ||||||
102 | Q_ENUM(SceneGraphError) | - | ||||||
103 | - | |||||||
104 | enum TextRenderType { | - | ||||||
105 | QtTextRendering, | - | ||||||
106 | NativeTextRendering | - | ||||||
107 | }; | - | ||||||
108 | Q_ENUM(TextRenderType) | - | ||||||
109 | - | |||||||
110 | explicit QQuickWindow(QWindow *parent = nullptr); | - | ||||||
111 | explicit QQuickWindow(QQuickRenderControl *renderControl); | - | ||||||
112 | - | |||||||
113 | ~QQuickWindow() override; | - | ||||||
114 | - | |||||||
115 | QQuickItem *contentItem() const; | - | ||||||
116 | - | |||||||
117 | QQuickItem *activeFocusItem() const; | - | ||||||
118 | QObject *focusObject() const override; | - | ||||||
119 | - | |||||||
120 | QQuickItem *mouseGrabberItem() const; | - | ||||||
121 | - | |||||||
122 | #if QT_DEPRECATED_SINCE(5, 8) | - | ||||||
123 | QT_DEPRECATED bool sendEvent(QQuickItem *, QEvent *); | - | ||||||
124 | #endif | - | ||||||
125 | - | |||||||
126 | QImage grabWindow(); | - | ||||||
127 | #if QT_CONFIG(opengl) | - | ||||||
128 | void setRenderTarget(QOpenGLFramebufferObject *fbo); | - | ||||||
129 | QOpenGLFramebufferObject *renderTarget() const; | - | ||||||
130 | #endif | - | ||||||
131 | void setRenderTarget(uint fboId, const QSize &size); | - | ||||||
132 | uint renderTargetId() const; | - | ||||||
133 | QSize renderTargetSize() const; | - | ||||||
134 | #if QT_CONFIG(opengl) | - | ||||||
135 | void resetOpenGLState(); | - | ||||||
136 | #endif | - | ||||||
137 | QQmlIncubationController *incubationController() const; | - | ||||||
138 | - | |||||||
139 | #if QT_CONFIG(accessibility) | - | ||||||
140 | QAccessibleInterface *accessibleRoot() const override; | - | ||||||
141 | #endif | - | ||||||
142 | - | |||||||
143 | // Scene graph specific functions | - | ||||||
144 | QSGTexture *createTextureFromImage(const QImage &image) const; | - | ||||||
145 | QSGTexture *createTextureFromImage(const QImage &image, CreateTextureOptions options) const; | - | ||||||
146 | QSGTexture *createTextureFromId(uint id, const QSize &size, CreateTextureOptions options = CreateTextureOption()) const; | - | ||||||
147 | - | |||||||
148 | void setClearBeforeRendering(bool enabled); | - | ||||||
149 | bool clearBeforeRendering() const; | - | ||||||
150 | - | |||||||
151 | void setColor(const QColor &color); | - | ||||||
152 | QColor color() const; | - | ||||||
153 | - | |||||||
154 | static bool hasDefaultAlphaBuffer(); | - | ||||||
155 | static void setDefaultAlphaBuffer(bool useAlpha); | - | ||||||
156 | - | |||||||
157 | void setPersistentOpenGLContext(bool persistent); | - | ||||||
158 | bool isPersistentOpenGLContext() const; | - | ||||||
159 | - | |||||||
160 | void setPersistentSceneGraph(bool persistent); | - | ||||||
161 | bool isPersistentSceneGraph() const; | - | ||||||
162 | - | |||||||
163 | QOpenGLContext *openglContext() const; | - | ||||||
164 | bool isSceneGraphInitialized() const; | - | ||||||
165 | - | |||||||
166 | void scheduleRenderJob(QRunnable *job, RenderStage schedule); | - | ||||||
167 | - | |||||||
168 | qreal effectiveDevicePixelRatio() const; | - | ||||||
169 | - | |||||||
170 | QSGRendererInterface *rendererInterface() const; | - | ||||||
171 | - | |||||||
172 | static void setSceneGraphBackend(QSGRendererInterface::GraphicsApi api); | - | ||||||
173 | static void setSceneGraphBackend(const QString &backend); | - | ||||||
174 | static QString sceneGraphBackend(); | - | ||||||
175 | - | |||||||
176 | QSGRectangleNode *createRectangleNode() const; | - | ||||||
177 | QSGImageNode *createImageNode() const; | - | ||||||
178 | QSGNinePatchNode *createNinePatchNode() const; | - | ||||||
179 | - | |||||||
180 | static TextRenderType textRenderType(); | - | ||||||
181 | static void setTextRenderType(TextRenderType renderType); | - | ||||||
182 | - | |||||||
183 | Q_SIGNALS: | - | ||||||
184 | void frameSwapped(); | - | ||||||
185 | Q_REVISION(2) void openglContextCreated(QOpenGLContext *context); | - | ||||||
186 | void sceneGraphInitialized(); | - | ||||||
187 | void sceneGraphInvalidated(); | - | ||||||
188 | void beforeSynchronizing(); | - | ||||||
189 | Q_REVISION(2) void afterSynchronizing(); | - | ||||||
190 | void beforeRendering(); | - | ||||||
191 | void afterRendering(); | - | ||||||
192 | Q_REVISION(2) void afterAnimating(); | - | ||||||
193 | Q_REVISION(2) void sceneGraphAboutToStop(); | - | ||||||
194 | - | |||||||
195 | Q_REVISION(1) void closing(QQuickCloseEvent *close); | - | ||||||
196 | void colorChanged(const QColor &); | - | ||||||
197 | Q_REVISION(1) void activeFocusItemChanged(); | - | ||||||
198 | Q_REVISION(2) void sceneGraphError(QQuickWindow::SceneGraphError error, const QString &message); | - | ||||||
199 | - | |||||||
200 | - | |||||||
201 | public Q_SLOTS: | - | ||||||
202 | void update(); | - | ||||||
203 | void releaseResources(); | - | ||||||
204 | - | |||||||
205 | protected: | - | ||||||
206 | QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent = nullptr); | - | ||||||
207 | QQuickWindow(QQuickWindowPrivate &dd, QQuickRenderControl *control); | - | ||||||
208 | - | |||||||
209 | void exposeEvent(QExposeEvent *) override; | - | ||||||
210 | void resizeEvent(QResizeEvent *) override; | - | ||||||
211 | - | |||||||
212 | void showEvent(QShowEvent *) override; | - | ||||||
213 | void hideEvent(QHideEvent *) override; | - | ||||||
214 | // TODO Qt 6: reimplement QWindow::closeEvent to emit closing | - | ||||||
215 | - | |||||||
216 | void focusInEvent(QFocusEvent *) override; | - | ||||||
217 | void focusOutEvent(QFocusEvent *) override; | - | ||||||
218 | - | |||||||
219 | bool event(QEvent *) override; | - | ||||||
220 | void keyPressEvent(QKeyEvent *) override; | - | ||||||
221 | void keyReleaseEvent(QKeyEvent *) override; | - | ||||||
222 | void mousePressEvent(QMouseEvent *) override; | - | ||||||
223 | void mouseReleaseEvent(QMouseEvent *) override; | - | ||||||
224 | void mouseDoubleClickEvent(QMouseEvent *) override; | - | ||||||
225 | void mouseMoveEvent(QMouseEvent *) override; | - | ||||||
226 | #if QT_CONFIG(wheelevent) | - | ||||||
227 | void wheelEvent(QWheelEvent *) override; | - | ||||||
228 | #endif | - | ||||||
229 | - | |||||||
230 | private Q_SLOTS: | - | ||||||
231 | void maybeUpdate(); | - | ||||||
232 | void cleanupSceneGraph(); | - | ||||||
233 | void physicalDpiChanged(); | - | ||||||
234 | void handleScreenChanged(QScreen *screen); | - | ||||||
235 | void setTransientParent_helper(QQuickWindow *window); | - | ||||||
236 | void runJobsAfterSwap(); | - | ||||||
237 | void handleApplicationStateChanged(Qt::ApplicationState state); | - | ||||||
238 | private: | - | ||||||
239 | friend class QQuickItem; | - | ||||||
240 | friend class QQuickWidget; | - | ||||||
241 | friend class QQuickRenderControl; | - | ||||||
242 | friend class QQuickAnimatorController; | - | ||||||
243 | Q_DISABLE_COPY(QQuickWindow) | - | ||||||
244 | }; | - | ||||||
245 | - | |||||||
246 | #ifndef QT_NO_DEBUG_STREAM | - | ||||||
247 | QDebug Q_QUICK_EXPORT operator<<(QDebug debug, const QQuickWindow *item); | - | ||||||
248 | #endif | - | ||||||
249 | - | |||||||
250 | QT_END_NAMESPACE | - | ||||||
251 | - | |||||||
252 | Q_DECLARE_METATYPE(QQuickWindow *) executed 112 times by 20 tests: return id; Executed by:
executed 50 times by 20 tests: return newId; Executed by:
| 50-112 | ||||||
253 | - | |||||||
254 | #endif // QQUICKWINDOW_H | - | ||||||
255 | - | |||||||
Source code | Switch to Preprocessed file |