Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
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 Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qwindow.h" | - |
43 | | - |
44 | #include <qpa/qplatformwindow.h> | - |
45 | #include <qpa/qplatformintegration.h> | - |
46 | #include "qsurfaceformat.h" | - |
47 | #ifndef QT_NO_OPENGL | - |
48 | #include <qpa/qplatformopenglcontext.h> | - |
49 | #include "qopenglcontext.h" | - |
50 | #endif | - |
51 | #include "qscreen.h" | - |
52 | | - |
53 | #include "qwindow_p.h" | - |
54 | #include "qguiapplication_p.h" | - |
55 | #ifndef QT_NO_ACCESSIBILITY | - |
56 | # include "qaccessible.h" | - |
57 | #endif | - |
58 | | - |
59 | #include <private/qevent_p.h> | - |
60 | | - |
61 | #include <QtCore/QDebug> | - |
62 | | - |
63 | #include <QStyleHints> | - |
64 | #include <qpa/qplatformcursor.h> | - |
65 | | - |
66 | QT_BEGIN_NAMESPACE | - |
67 | | - |
68 | /*! | - |
69 | \class QWindow | - |
70 | \inmodule QtGui | - |
71 | \since 5.0 | - |
72 | \brief The QWindow class represents a window in the underlying windowing system. | - |
73 | | - |
74 | A window that is supplied a parent becomes a native child window of | - |
75 | their parent window. | - |
76 | | - |
77 | An application will typically use QWidget or QQuickView for its UI, and not | - |
78 | QWindow directly. Still, it is possible to render directly to a QWindow | - |
79 | with QBackingStore or QOpenGLContext, when wanting to keep dependencies to | - |
80 | a minimum or when wanting to use OpenGL directly. The | - |
81 | \l{gui/rasterwindow}{Raster Window} and \l{gui/openglwindow}{OpenGL Window} | - |
82 | examples are useful reference examples for how to render to a QWindow using | - |
83 | either approach. | - |
84 | | - |
85 | \section1 Resource management | - |
86 | | - |
87 | Windows can potentially use a lot of memory. A usual measurement is | - |
88 | width times height times color depth. A window might also include multiple | - |
89 | buffers to support double and triple buffering, as well as depth and stencil | - |
90 | buffers. To release a window's memory resources, call the destroy() function. | - |
91 | | - |
92 | \section1 Content orientation | - |
93 | | - |
94 | QWindow has reportContentOrientationChange() that can be used to specify | - |
95 | the layout of the window contents in relation to the screen. The content | - |
96 | orientation is simply a hint to the windowing system about which | - |
97 | orientation the window contents are in. It's useful when you wish to keep | - |
98 | the same window size, but rotate the contents instead, especially when | - |
99 | doing rotation animations between different orientations. The windowing | - |
100 | system might use this value to determine the layout of system popups or | - |
101 | dialogs. | - |
102 | | - |
103 | \section1 Visibility and Windowing system exposure. | - |
104 | | - |
105 | By default, the window is not visible, and you must call setVisible(true), | - |
106 | or show() or similar to make it visible. To make a window hidden again, | - |
107 | call setVisible(false) or hide(). The visible property describes the state | - |
108 | the application wants the window to be in. Depending on the underlying | - |
109 | system, a visible window might still not be shown on the screen. It could, | - |
110 | for instance, be covered by other opaque windows or moved outside the | - |
111 | physical area of the screen. On windowing systems that have exposure | - |
112 | notifications, the isExposed() accessor describes whether the window should | - |
113 | be treated as directly visible on screen. The exposeEvent() function is | - |
114 | called whenever the windows exposure in the windowing system changes. On | - |
115 | windowing systems that do not make this information visible to the | - |
116 | application, isExposed() will simply return the same value as isVisible(). | - |
117 | | - |
118 | \section1 Rendering | - |
119 | | - |
120 | There are two Qt APIs that can be used to render content into a window, | - |
121 | QBackingStore for rendering with a QPainter and flushing the contents | - |
122 | to a window with type QSurface::RasterSurface, and QOpenGLContext for | - |
123 | rendering with OpenGL to a window with type QSurface::OpenGLSurface. | - |
124 | | - |
125 | The application can start rendering as soon as isExposed() returns true, | - |
126 | and can keep rendering until it isExposed() returns false. To find out when | - |
127 | isExposed() changes, reimplement exposeEvent(). The window will always get | - |
128 | a resize event before the first expose event. | - |
129 | */ | - |
130 | | - |
131 | /*! | - |
132 | Creates a window as a top level on the \a targetScreen. | - |
133 | | - |
134 | The window is not shown until setVisible(true), show(), or similar is called. | - |
135 | | - |
136 | \sa setScreen() | - |
137 | */ | - |
138 | QWindow::QWindow(QScreen *targetScreen) | - |
139 | : QObject(*new QWindowPrivate(), 0) | - |
140 | , QSurface(QSurface::Window) | - |
141 | { | - |
142 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
143 | d->screen = targetScreen; executed (the execution status of this line is deduced): d->screen = targetScreen; | - |
144 | if (!d->screen) partially evaluated: !d->screen yes Evaluation Count:56 | no Evaluation Count:0 |
| 0-56 |
145 | d->screen = QGuiApplication::primaryScreen(); executed: d->screen = QGuiApplication::primaryScreen(); Execution Count:56 | 56 |
146 | | - |
147 | //if your applications aborts here, then chances are your creating a QWindow before the | - |
148 | //screen list is populated. | - |
149 | Q_ASSERT(d->screen); executed (the execution status of this line is deduced): qt_noop(); | - |
150 | | - |
151 | connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); executed (the execution status of this line is deduced): connect(d->screen, "2""destroyed(QObject*)", this, "1""screenDestroyed(QObject*)"); | - |
152 | QGuiApplicationPrivate::window_list.prepend(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.prepend(this); | - |
153 | } executed: } Execution Count:56 | 56 |
154 | | - |
155 | /*! | - |
156 | Creates a window as a child of the given \a parent window. | - |
157 | | - |
158 | The window will be embedded inside the parent window, its coordinates | - |
159 | relative to the parent. | - |
160 | | - |
161 | The screen is inherited from the parent. | - |
162 | | - |
163 | \sa setParent() | - |
164 | */ | - |
165 | QWindow::QWindow(QWindow *parent) | - |
166 | : QObject(*new QWindowPrivate(), parent) | - |
167 | , QSurface(QSurface::Window) | - |
168 | { | - |
169 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
170 | d->parentWindow = parent; executed (the execution status of this line is deduced): d->parentWindow = parent; | - |
171 | if (parent) evaluated: parent yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-5 |
172 | d->screen = parent->screen(); executed: d->screen = parent->screen(); Execution Count:5 | 5 |
173 | if (!d->screen) evaluated: !d->screen yes Evaluation Count:3 | yes Evaluation Count:5 |
| 3-5 |
174 | d->screen = QGuiApplication::primaryScreen(); executed: d->screen = QGuiApplication::primaryScreen(); Execution Count:3 | 3 |
175 | connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); executed (the execution status of this line is deduced): connect(d->screen, "2""destroyed(QObject*)", this, "1""screenDestroyed(QObject*)"); | - |
176 | QGuiApplicationPrivate::window_list.prepend(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.prepend(this); | - |
177 | } executed: } Execution Count:8 | 8 |
178 | | - |
179 | /*! | - |
180 | Creates a window as a child of the given \a parent window with the \a dd | - |
181 | private implementation. | - |
182 | | - |
183 | The window will be embedded inside the parent window, its coordinates | - |
184 | relative to the parent. | - |
185 | | - |
186 | The screen is inherited from the parent. | - |
187 | | - |
188 | \internal | - |
189 | \sa setParent() | - |
190 | */ | - |
191 | QWindow::QWindow(QWindowPrivate &dd, QWindow *parent) | - |
192 | : QObject(dd, parent) | - |
193 | , QSurface(QSurface::Window) | - |
194 | { | - |
195 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
196 | d->parentWindow = parent; executed (the execution status of this line is deduced): d->parentWindow = parent; | - |
197 | if (parent) partially evaluated: parent no Evaluation Count:0 | yes Evaluation Count:3470 |
| 0-3470 |
198 | d->screen = parent->screen(); never executed: d->screen = parent->screen(); | 0 |
199 | if (!d->screen) partially evaluated: !d->screen yes Evaluation Count:3470 | no Evaluation Count:0 |
| 0-3470 |
200 | d->screen = QGuiApplication::primaryScreen(); executed: d->screen = QGuiApplication::primaryScreen(); Execution Count:3470 | 3470 |
201 | connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); executed (the execution status of this line is deduced): connect(d->screen, "2""destroyed(QObject*)", this, "1""screenDestroyed(QObject*)"); | - |
202 | QGuiApplicationPrivate::window_list.prepend(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.prepend(this); | - |
203 | } executed: } Execution Count:3470 | 3470 |
204 | | - |
205 | /*! | - |
206 | Destroys the window. | - |
207 | */ | - |
208 | QWindow::~QWindow() | - |
209 | { | - |
210 | if (QGuiApplicationPrivate::focus_window == this) evaluated: QGuiApplicationPrivate::focus_window == this yes Evaluation Count:1325 | yes Evaluation Count:2201 |
| 1325-2201 |
211 | QGuiApplicationPrivate::focus_window = 0; executed: QGuiApplicationPrivate::focus_window = 0; Execution Count:1325 | 1325 |
212 | if (QGuiApplicationPrivate::currentMouseWindow == this) evaluated: QGuiApplicationPrivate::currentMouseWindow == this yes Evaluation Count:942 | yes Evaluation Count:2584 |
| 942-2584 |
213 | QGuiApplicationPrivate::currentMouseWindow = 0; executed: QGuiApplicationPrivate::currentMouseWindow = 0; Execution Count:942 | 942 |
214 | QGuiApplicationPrivate::window_list.removeAll(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.removeAll(this); | - |
215 | destroy(); executed (the execution status of this line is deduced): destroy(); | - |
216 | } executed: } Execution Count:3526 | 3526 |
217 | | - |
218 | /*! | - |
219 | Sets the \a surfaceType of the window. | - |
220 | | - |
221 | Specifies whether the window is meant for raster rendering with | - |
222 | QBackingStore, or OpenGL rendering with QOpenGLContext. | - |
223 | | - |
224 | The surfaceType will be used when the native surface is created | - |
225 | in the create() function. Calling this function after the native | - |
226 | surface has been created requires calling destroy() and create() | - |
227 | to release the old native surface and create a new one. | - |
228 | | - |
229 | \sa QBackingStore, QOpenGLContext, create(), destroy() | - |
230 | */ | - |
231 | void QWindow::setSurfaceType(SurfaceType surfaceType) | - |
232 | { | - |
233 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
234 | d->surfaceType = surfaceType; never executed (the execution status of this line is deduced): d->surfaceType = surfaceType; | - |
235 | } | 0 |
236 | | - |
237 | /*! | - |
238 | Returns the surface type of the window. | - |
239 | | - |
240 | \sa setSurfaceType() | - |
241 | */ | - |
242 | QWindow::SurfaceType QWindow::surfaceType() const | - |
243 | { | - |
244 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
245 | return d->surfaceType; executed: return d->surfaceType; Execution Count:2579 | 2579 |
246 | } | - |
247 | | - |
248 | /*! | - |
249 | \property QWindow::visible | - |
250 | \brief whether the window is visible or not | - |
251 | | - |
252 | This property controls the visibility of the window in the windowing system. | - |
253 | | - |
254 | By default, the window is not visible, you must call setVisible(true), or | - |
255 | show() or similar to make it visible. | - |
256 | | - |
257 | \sa show() | - |
258 | */ | - |
259 | void QWindow::setVisible(bool visible) | - |
260 | { | - |
261 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
262 | | - |
263 | if (d->visible == visible) evaluated: d->visible == visible yes Evaluation Count:6944 | yes Evaluation Count:5230 |
| 5230-6944 |
264 | return; executed: return; Execution Count:6944 | 6944 |
265 | d->visible = visible; executed (the execution status of this line is deduced): d->visible = visible; | - |
266 | emit visibleChanged(visible); executed (the execution status of this line is deduced): visibleChanged(visible); | - |
267 | | - |
268 | if (!d->platformWindow) evaluated: !d->platformWindow yes Evaluation Count:53 | yes Evaluation Count:5177 |
| 53-5177 |
269 | create(); executed: create(); Execution Count:53 | 53 |
270 | | - |
271 | if (visible) { evaluated: visible yes Evaluation Count:2615 | yes Evaluation Count:2615 |
| 2615 |
272 | // remove posted quit events when showing a new window | - |
273 | QCoreApplication::removePostedEvents(qApp, QEvent::Quit); executed (the execution status of this line is deduced): QCoreApplication::removePostedEvents((static_cast<QGuiApplication *>(QCoreApplication::instance())), QEvent::Quit); | - |
274 | | - |
275 | QShowEvent showEvent; executed (the execution status of this line is deduced): QShowEvent showEvent; | - |
276 | QGuiApplication::sendEvent(this, &showEvent); executed (the execution status of this line is deduced): QGuiApplication::sendEvent(this, &showEvent); | - |
277 | } executed: } Execution Count:2615 | 2615 |
278 | | - |
279 | if (isModal()) { evaluated: isModal() yes Evaluation Count:218 | yes Evaluation Count:5012 |
| 218-5012 |
280 | if (visible) evaluated: visible yes Evaluation Count:109 | yes Evaluation Count:109 |
| 109 |
281 | QGuiApplicationPrivate::showModalWindow(this); executed: QGuiApplicationPrivate::showModalWindow(this); Execution Count:109 | 109 |
282 | else | - |
283 | QGuiApplicationPrivate::hideModalWindow(this); executed: QGuiApplicationPrivate::hideModalWindow(this); Execution Count:109 | 109 |
284 | } | - |
285 | | - |
286 | #ifndef QT_NO_CURSOR | - |
287 | if (visible) evaluated: visible yes Evaluation Count:2615 | yes Evaluation Count:2615 |
| 2615 |
288 | d->applyCursor(); executed: d->applyCursor(); Execution Count:2615 | 2615 |
289 | #endif | - |
290 | d->platformWindow->setVisible(visible); executed (the execution status of this line is deduced): d->platformWindow->setVisible(visible); | - |
291 | | - |
292 | if (!visible) { evaluated: !visible yes Evaluation Count:2615 | yes Evaluation Count:2615 |
| 2615 |
293 | QHideEvent hideEvent; executed (the execution status of this line is deduced): QHideEvent hideEvent; | - |
294 | QGuiApplication::sendEvent(this, &hideEvent); executed (the execution status of this line is deduced): QGuiApplication::sendEvent(this, &hideEvent); | - |
295 | } executed: } Execution Count:2615 | 2615 |
296 | } executed: } Execution Count:5230 | 5230 |
297 | | - |
298 | bool QWindow::isVisible() const | - |
299 | { | - |
300 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
301 | | - |
302 | return d->visible; executed: return d->visible; Execution Count:68 | 68 |
303 | } | - |
304 | | - |
305 | /*! | - |
306 | Allocates the platform resources associated with the window. | - |
307 | | - |
308 | It is at this point that the surface format set using setFormat() gets resolved | - |
309 | into an actual native surface. However, the window remains hidden until setVisible() is called. | - |
310 | | - |
311 | Note that it is not usually necessary to call this function directly, as it will be implicitly | - |
312 | called by show(), setVisible(), and other functions that require access to the platform | - |
313 | resources. | - |
314 | | - |
315 | Call destroy() to free the platform resources if necessary. | - |
316 | | - |
317 | \sa destroy() | - |
318 | */ | - |
319 | void QWindow::create() | - |
320 | { | - |
321 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
322 | if (!d->platformWindow) { evaluated: !d->platformWindow yes Evaluation Count:2711 | yes Evaluation Count:17 |
| 17-2711 |
323 | d->platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(this); executed (the execution status of this line is deduced): d->platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(this); | - |
324 | QObjectList childObjects = children(); executed (the execution status of this line is deduced): QObjectList childObjects = children(); | - |
325 | for (int i = 0; i < childObjects.size(); i ++) { evaluated: i < childObjects.size() yes Evaluation Count:1 | yes Evaluation Count:2711 |
| 1-2711 |
326 | QObject *object = childObjects.at(i); executed (the execution status of this line is deduced): QObject *object = childObjects.at(i); | - |
327 | if(object->isWindowType()) { partially evaluated: object->isWindowType() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
328 | QWindow *window = static_cast<QWindow *>(object); executed (the execution status of this line is deduced): QWindow *window = static_cast<QWindow *>(object); | - |
329 | if (window->d_func()->platformWindow) partially evaluated: window->d_func()->platformWindow no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
330 | window->d_func()->platformWindow->setParent(d->platformWindow); never executed: window->d_func()->platformWindow->setParent(d->platformWindow); | 0 |
331 | } executed: } Execution Count:1 | 1 |
332 | } executed: } Execution Count:1 | 1 |
333 | } executed: } Execution Count:2711 | 2711 |
334 | } executed: } Execution Count:2728 | 2728 |
335 | | - |
336 | /*! | - |
337 | Returns the window's platform id. | - |
338 | | - |
339 | For platforms where this id might be useful, the value returned | - |
340 | will uniquely represent the window inside the corresponding screen. | - |
341 | | - |
342 | \sa screen() | - |
343 | */ | - |
344 | WId QWindow::winId() const | - |
345 | { | - |
346 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
347 | if(!d->platformWindow) partially evaluated: !d->platformWindow no Evaluation Count:0 | yes Evaluation Count:2813 |
| 0-2813 |
348 | const_cast<QWindow *>(this)->create(); never executed: const_cast<QWindow *>(this)->create(); | 0 |
349 | | - |
350 | WId id = d->platformWindow->winId(); executed (the execution status of this line is deduced): WId id = d->platformWindow->winId(); | - |
351 | // See the QPlatformWindow::winId() documentation | - |
352 | Q_ASSERT(id != WId(0)); executed (the execution status of this line is deduced): qt_noop(); | - |
353 | return id; executed: return id; Execution Count:2813 | 2813 |
354 | } | - |
355 | | - |
356 | /*! | - |
357 | Returns the parent window, if any. | - |
358 | | - |
359 | A window without a parent is known as a top level window. | - |
360 | */ | - |
361 | QWindow *QWindow::parent() const | - |
362 | { | - |
363 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
364 | return d->parentWindow; executed: return d->parentWindow; Execution Count:37623 | 37623 |
365 | } | - |
366 | | - |
367 | /*! | - |
368 | Sets the \a parent Window. This will lead to the windowing system managing | - |
369 | the clip of the window, so it will be clipped to the \a parent window. | - |
370 | | - |
371 | Setting \a parent to be 0 will make the window become a top level window. | - |
372 | */ | - |
373 | | - |
374 | void QWindow::setParent(QWindow *parent) | - |
375 | { | - |
376 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
377 | | - |
378 | QObject::setParent(parent); executed (the execution status of this line is deduced): QObject::setParent(parent); | - |
379 | | - |
380 | if (d->platformWindow) { evaluated: d->platformWindow yes Evaluation Count:36 | yes Evaluation Count:192 |
| 36-192 |
381 | if (parent && parent->d_func()->platformWindow) { evaluated: parent yes Evaluation Count:25 | yes Evaluation Count:11 |
partially evaluated: parent->d_func()->platformWindow yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
382 | d->platformWindow->setParent(parent->d_func()->platformWindow); executed (the execution status of this line is deduced): d->platformWindow->setParent(parent->d_func()->platformWindow); | - |
383 | } else { executed: } Execution Count:25 | 25 |
384 | d->platformWindow->setParent(0); executed (the execution status of this line is deduced): d->platformWindow->setParent(0); | - |
385 | } executed: } Execution Count:11 | 11 |
386 | } | - |
387 | | - |
388 | d->parentWindow = parent; executed (the execution status of this line is deduced): d->parentWindow = parent; | - |
389 | | - |
390 | QGuiApplicationPrivate::updateBlockedStatus(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::updateBlockedStatus(this); | - |
391 | } executed: } Execution Count:228 | 228 |
392 | | - |
393 | /*! | - |
394 | Returns whether the window is top level, i.e. has no parent window. | - |
395 | */ | - |
396 | bool QWindow::isTopLevel() const | - |
397 | { | - |
398 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
399 | return d->parentWindow == 0; executed: return d->parentWindow == 0; Execution Count:2901 | 2901 |
400 | } | - |
401 | | - |
402 | /*! | - |
403 | Returns whether the window is modal. | - |
404 | | - |
405 | A modal window prevents other windows from getting any input. | - |
406 | | - |
407 | \sa QWindow::modality | - |
408 | */ | - |
409 | bool QWindow::isModal() const | - |
410 | { | - |
411 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
412 | return d->modality != Qt::NonModal; executed: return d->modality != Qt::NonModal; Execution Count:5230 | 5230 |
413 | } | - |
414 | | - |
415 | /*! \property QWindow::modality | - |
416 | \brief the modality of the window | - |
417 | | - |
418 | A modal window prevents other windows from receiving input events. Qt | - |
419 | supports two types of modality: Qt::WindowModal and Qt::ApplicationModal. | - |
420 | | - |
421 | By default, this property is Qt::NonModal | - |
422 | | - |
423 | \sa Qt::WindowModality | - |
424 | */ | - |
425 | | - |
426 | Qt::WindowModality QWindow::modality() const | - |
427 | { | - |
428 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
429 | return d->modality; executed: return d->modality; Execution Count:5605 | 5605 |
430 | } | - |
431 | | - |
432 | void QWindow::setModality(Qt::WindowModality modality) | - |
433 | { | - |
434 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
435 | if (d->modality == modality) evaluated: d->modality == modality yes Evaluation Count:2588 | yes Evaluation Count:144 |
| 144-2588 |
436 | return; executed: return; Execution Count:2588 | 2588 |
437 | d->modality = modality; executed (the execution status of this line is deduced): d->modality = modality; | - |
438 | emit modalityChanged(modality); executed (the execution status of this line is deduced): modalityChanged(modality); | - |
439 | } executed: } Execution Count:144 | 144 |
440 | | - |
441 | /*! \fn void QWindow::modalityChanged(Qt::WindowModality modality) | - |
442 | | - |
443 | This signal is emitted when the Qwindow::modality property changes to \a modality. | - |
444 | */ | - |
445 | | - |
446 | /*! | - |
447 | Sets the window's surface \a format. | - |
448 | | - |
449 | The format determines properties such as color depth, alpha, depth and | - |
450 | stencil buffer size, etc. For example, to give a window a transparent | - |
451 | background (provided that the window system supports compositing, and | - |
452 | provided that other content in the window does not make it opaque again): | - |
453 | | - |
454 | \code | - |
455 | QSurfaceFormat format; | - |
456 | format.setAlphaBufferSize(8); | - |
457 | window.setFormat(format); | - |
458 | \endcode | - |
459 | | - |
460 | The surface format will be resolved in the create() function. Calling | - |
461 | this function after create() has been called will not re-resolve the | - |
462 | surface format of the native surface. | - |
463 | | - |
464 | \sa create(), destroy() | - |
465 | */ | - |
466 | void QWindow::setFormat(const QSurfaceFormat &format) | - |
467 | { | - |
468 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
469 | d->requestedFormat = format; executed (the execution status of this line is deduced): d->requestedFormat = format; | - |
470 | } executed: } Execution Count:14 | 14 |
471 | | - |
472 | /*! | - |
473 | Returns the requested surfaceformat of this window. | - |
474 | | - |
475 | If the requested format was not supported by the platform implementation, | - |
476 | the requestedFormat will differ from the actual window format. | - |
477 | | - |
478 | This is the value set with setFormat(). | - |
479 | | - |
480 | \sa setFormat(), format() | - |
481 | */ | - |
482 | QSurfaceFormat QWindow::requestedFormat() const | - |
483 | { | - |
484 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
485 | return d->requestedFormat; executed: return d->requestedFormat; Execution Count:2579 | 2579 |
486 | } | - |
487 | | - |
488 | /*! | - |
489 | Returns the actual format of this window. | - |
490 | | - |
491 | After the window has been created, this function will return the actual surface format | - |
492 | of the window. It might differ from the requested format if the requested format could | - |
493 | not be fulfilled by the platform. | - |
494 | | - |
495 | \sa create(), requestedFormat() | - |
496 | */ | - |
497 | QSurfaceFormat QWindow::format() const | - |
498 | { | - |
499 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
500 | if (d->platformWindow) evaluated: d->platformWindow yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-9 |
501 | return d->platformWindow->format(); executed: return d->platformWindow->format(); Execution Count:9 | 9 |
502 | return d->requestedFormat; executed: return d->requestedFormat; Execution Count:1 | 1 |
503 | } | - |
504 | | - |
505 | /*! | - |
506 | \property QWindow::flags | - |
507 | \brief the window flags of the window | - |
508 | | - |
509 | The window flags control the window's appearance in the windowing system, | - |
510 | whether it's a dialog, popup, or a regular window, and whether it should | - |
511 | have a title bar, etc. | - |
512 | | - |
513 | The actual window flags might differ from the flags set with setFlags() | - |
514 | if the requested flags could not be fulfilled. | - |
515 | */ | - |
516 | void QWindow::setFlags(Qt::WindowFlags flags) | - |
517 | { | - |
518 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
519 | if (d->platformWindow) evaluated: d->platformWindow yes Evaluation Count:34 | yes Evaluation Count:2701 |
| 34-2701 |
520 | d->platformWindow->setWindowFlags(flags); executed: d->platformWindow->setWindowFlags(flags); Execution Count:34 | 34 |
521 | d->windowFlags = flags; executed (the execution status of this line is deduced): d->windowFlags = flags; | - |
522 | } executed: } Execution Count:2735 | 2735 |
523 | | - |
524 | Qt::WindowFlags QWindow::flags() const | - |
525 | { | - |
526 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
527 | return d->windowFlags; executed: return d->windowFlags; Execution Count:25935 | 25935 |
528 | } | - |
529 | | - |
530 | /*! | - |
531 | Returns the type of the window. | - |
532 | | - |
533 | This returns the part of the window flags that represents | - |
534 | whether the window is a dialog, tooltip, popup, regular window, etc. | - |
535 | | - |
536 | \sa flags(), setFlags() | - |
537 | */ | - |
538 | Qt::WindowType QWindow::type() const | - |
539 | { | - |
540 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
541 | return static_cast<Qt::WindowType>(int(d->windowFlags & Qt::WindowType_Mask)); executed: return static_cast<Qt::WindowType>(int(d->windowFlags & Qt::WindowType_Mask)); Execution Count:23394 | 23394 |
542 | } | - |
543 | | - |
544 | /*! | - |
545 | \property QWindow::title | - |
546 | \brief the window's title in the windowing system | - |
547 | | - |
548 | The window title might appear in the title area of the window decorations, | - |
549 | depending on the windowing system and the window flags. It might also | - |
550 | be used by the windowing system to identify the window in other contexts, | - |
551 | such as in the task switcher. | - |
552 | | - |
553 | \sa flags() | - |
554 | */ | - |
555 | void QWindow::setTitle(const QString &title) | - |
556 | { | - |
557 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
558 | d->windowTitle = title; executed (the execution status of this line is deduced): d->windowTitle = title; | - |
559 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:3002 | no Evaluation Count:0 |
| 0-3002 |
560 | d->platformWindow->setWindowTitle(title); executed: d->platformWindow->setWindowTitle(title); Execution Count:3002 | 3002 |
561 | } executed: } Execution Count:3002 | 3002 |
562 | | - |
563 | QString QWindow::title() const | - |
564 | { | - |
565 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
566 | return d->windowTitle; executed: return d->windowTitle; Execution Count:2579 | 2579 |
567 | } | - |
568 | | - |
569 | /*! | - |
570 | \brief set the file name this window is representing. | - |
571 | | - |
572 | The windowing system might use \a filePath to display the | - |
573 | path of the document this window is representing in the tile bar. | - |
574 | | - |
575 | */ | - |
576 | void QWindow::setFilePath(const QString &filePath) | - |
577 | { | - |
578 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
579 | d->windowFilePath = filePath; never executed (the execution status of this line is deduced): d->windowFilePath = filePath; | - |
580 | if (d->platformWindow) never evaluated: d->platformWindow | 0 |
581 | d->platformWindow->setWindowFilePath(filePath); never executed: d->platformWindow->setWindowFilePath(filePath); | 0 |
582 | } | 0 |
583 | | - |
584 | /*! | - |
585 | \brief the file name this window is representing. | - |
586 | | - |
587 | \sa setFilePath() | - |
588 | */ | - |
589 | QString QWindow::filePath() const | - |
590 | { | - |
591 | Q_D(const QWindow); never executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
592 | return d->windowFilePath; never executed: return d->windowFilePath; | 0 |
593 | } | - |
594 | | - |
595 | /*! | - |
596 | \brief Sets the window's \a icon in the windowing system | - |
597 | | - |
598 | The window icon might be used by the windowing system for example to | - |
599 | decorate the window, and/or in the task switcher. | - |
600 | */ | - |
601 | void QWindow::setIcon(const QIcon &icon) | - |
602 | { | - |
603 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
604 | d->windowIcon = icon; executed (the execution status of this line is deduced): d->windowIcon = icon; | - |
605 | if (d->platformWindow) evaluated: d->platformWindow yes Evaluation Count:2507 | yes Evaluation Count:106 |
| 106-2507 |
606 | d->platformWindow->setWindowIcon(icon); executed: d->platformWindow->setWindowIcon(icon); Execution Count:2507 | 2507 |
607 | } executed: } Execution Count:2613 | 2613 |
608 | | - |
609 | /*! | - |
610 | \brief Sets the window's icon in the windowing system | - |
611 | | - |
612 | \sa setIcon() | - |
613 | */ | - |
614 | QIcon QWindow::icon() const | - |
615 | { | - |
616 | Q_D(const QWindow); never executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
617 | return d->windowIcon; never executed: return d->windowIcon; | 0 |
618 | } | - |
619 | | - |
620 | /*! | - |
621 | Raise the window in the windowing system. | - |
622 | | - |
623 | Requests that the window be raised to appear above other windows. | - |
624 | */ | - |
625 | void QWindow::raise() | - |
626 | { | - |
627 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
628 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:128 | no Evaluation Count:0 |
| 0-128 |
629 | d->platformWindow->raise(); executed: d->platformWindow->raise(); Execution Count:128 | 128 |
630 | } executed: } Execution Count:128 | 128 |
631 | | - |
632 | /*! | - |
633 | Lower the window in the windowing system. | - |
634 | | - |
635 | Requests that the window be lowered to appear below other windows. | - |
636 | */ | - |
637 | void QWindow::lower() | - |
638 | { | - |
639 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
640 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
641 | d->platformWindow->lower(); executed: d->platformWindow->lower(); Execution Count:1 | 1 |
642 | } executed: } Execution Count:1 | 1 |
643 | | - |
644 | /*! | - |
645 | Sets the window's opacity in the windowing system to \a level. | - |
646 | | - |
647 | If the windowing system supports window opacity, this can be used to fade the | - |
648 | window in and out, or to make it semitransparent. | - |
649 | | - |
650 | A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below | - |
651 | is treated as fully transparent. Values inbetween represent varying levels of | - |
652 | translucency between the two extremes. | - |
653 | */ | - |
654 | void QWindow::setOpacity(qreal level) | - |
655 | { | - |
656 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
657 | if (level == d->opacity) // #fixme: Add property for 5.1 evaluated: level == d->opacity yes Evaluation Count:348 | yes Evaluation Count:7 |
| 7-348 |
658 | return; executed: return; Execution Count:348 | 348 |
659 | d->opacity = level; executed (the execution status of this line is deduced): d->opacity = level; | - |
660 | if (d->platformWindow) evaluated: d->platformWindow yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
661 | d->platformWindow->setOpacity(level); executed: d->platformWindow->setOpacity(level); Execution Count:2 | 2 |
662 | } executed: } Execution Count:7 | 7 |
663 | | - |
664 | /*! | - |
665 | Requests the window to be activated, i.e. receive keyboard focus. | - |
666 | | - |
667 | \sa isActive(), QGuiApplication::focusWindow() | - |
668 | */ | - |
669 | void QWindow::requestActivate() | - |
670 | { | - |
671 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
672 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:386 | no Evaluation Count:0 |
| 0-386 |
673 | d->platformWindow->requestActivateWindow(); executed: d->platformWindow->requestActivateWindow(); Execution Count:386 | 386 |
674 | } executed: } Execution Count:386 | 386 |
675 | | - |
676 | /*! | - |
677 | Returns if this window is exposed in the windowing system. | - |
678 | | - |
679 | When the window is not exposed, it is shown by the application | - |
680 | but it is still not showing in the windowing system, so the application | - |
681 | should minimize rendering and other graphical activities. | - |
682 | | - |
683 | An exposeEvent() is sent every time this value changes. | - |
684 | | - |
685 | \sa exposeEvent() | - |
686 | */ | - |
687 | bool QWindow::isExposed() const | - |
688 | { | - |
689 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
690 | return d->exposed; executed: return d->exposed; Execution Count:7345 | 7345 |
691 | } | - |
692 | | - |
693 | /*! | - |
694 | Returns true if the window should appear active from a style perspective. | - |
695 | | - |
696 | This is the case for the window that has input focus as well as windows | - |
697 | that are in the same parent / transient parent chain as the focus window. | - |
698 | | - |
699 | To get the window that currently has focus, use QGuiApplication::focusWindow(). | - |
700 | */ | - |
701 | bool QWindow::isActive() const | - |
702 | { | - |
703 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
704 | if (!d->platformWindow) partially evaluated: !d->platformWindow no Evaluation Count:0 | yes Evaluation Count:862 |
| 0-862 |
705 | return false; never executed: return false; | 0 |
706 | | - |
707 | QWindow *focus = QGuiApplication::focusWindow(); executed (the execution status of this line is deduced): QWindow *focus = QGuiApplication::focusWindow(); | - |
708 | | - |
709 | // Means the whole application lost the focus | - |
710 | if (!focus) evaluated: !focus yes Evaluation Count:272 | yes Evaluation Count:590 |
| 272-590 |
711 | return false; executed: return false; Execution Count:272 | 272 |
712 | | - |
713 | if (focus == this) evaluated: focus == this yes Evaluation Count:552 | yes Evaluation Count:38 |
| 38-552 |
714 | return true; executed: return true; Execution Count:552 | 552 |
715 | | - |
716 | if (!parent() && !transientParent()) { evaluated: !parent() yes Evaluation Count:36 | yes Evaluation Count:2 |
evaluated: !transientParent() yes Evaluation Count:33 | yes Evaluation Count:3 |
| 2-36 |
717 | return isAncestorOf(focus); executed: return isAncestorOf(focus); Execution Count:33 | 33 |
718 | } else { | - |
719 | return (parent() && parent()->isActive()) || (transientParent() && transientParent()->isActive()); executed: return (parent() && parent()->isActive()) || (transientParent() && transientParent()->isActive()); Execution Count:5 | 5 |
720 | } | - |
721 | } | - |
722 | | - |
723 | /*! | - |
724 | \property QWindow::contentOrientation | - |
725 | \brief the orientation of the window's contents | - |
726 | | - |
727 | This is a hint to the window manager in case it needs to display | - |
728 | additional content like popups, dialogs, status bars, or similar | - |
729 | in relation to the window. | - |
730 | | - |
731 | The recommended orientation is QScreen::orientation() but | - |
732 | an application doesn't have to support all possible orientations, | - |
733 | and thus can opt to ignore the current screen orientation. | - |
734 | | - |
735 | The difference between the window and the content orientation | - |
736 | determines how much to rotate the content by. QScreen::angleBetween(), | - |
737 | QScreen::transformBetween(), and QScreen::mapBetween() can be used | - |
738 | to compute the necessary transform. | - |
739 | | - |
740 | The default value is Qt::PrimaryOrientation | - |
741 | */ | - |
742 | void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation) | - |
743 | { | - |
744 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
745 | if (d->contentOrientation == orientation) partially evaluated: d->contentOrientation == orientation no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
746 | return; | 0 |
747 | if (!d->platformWindow) partially evaluated: !d->platformWindow no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
748 | create(); never executed: create(); | 0 |
749 | Q_ASSERT(d->platformWindow); executed (the execution status of this line is deduced): qt_noop(); | - |
750 | d->contentOrientation = orientation; executed (the execution status of this line is deduced): d->contentOrientation = orientation; | - |
751 | d->platformWindow->handleContentOrientationChange(orientation); executed (the execution status of this line is deduced): d->platformWindow->handleContentOrientationChange(orientation); | - |
752 | emit contentOrientationChanged(orientation); executed (the execution status of this line is deduced): contentOrientationChanged(orientation); | - |
753 | } executed: } Execution Count:3 | 3 |
754 | | - |
755 | Qt::ScreenOrientation QWindow::contentOrientation() const | - |
756 | { | - |
757 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
758 | return d->contentOrientation; executed: return d->contentOrientation; Execution Count:2 | 2 |
759 | } | - |
760 | | - |
761 | /*! | - |
762 | Returns the ratio between physical pixels and device-independent pixels | - |
763 | for the window. This value is dependent on the screen the window is on, | - |
764 | and may change when the window is moved. | - |
765 | | - |
766 | Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays. | - |
767 | | - |
768 | \sa QScreen::devicePixelRatio(), QGuiApplication::devicePixelRatio() | - |
769 | */ | - |
770 | qreal QWindow::devicePixelRatio() const | - |
771 | { | - |
772 | Q_D(const QWindow); never executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
773 | if (!d->platformWindow) never evaluated: !d->platformWindow | 0 |
774 | return 1.0; never executed: return 1.0; | 0 |
775 | return d->platformWindow->devicePixelRatio(); never executed: return d->platformWindow->devicePixelRatio(); | 0 |
776 | } | - |
777 | | - |
778 | /*! | - |
779 | \brief set the screen-occupation state of the window | - |
780 | | - |
781 | The window \a state represents whether the window appears in the | - |
782 | windowing system as maximized, minimized, fullscreen, or normal. | - |
783 | | - |
784 | The enum value Qt::WindowActive is not an accepted parameter. | - |
785 | | - |
786 | \sa showNormal(), showFullScreen(), showMinimized(), showMaximized() | - |
787 | */ | - |
788 | void QWindow::setWindowState(Qt::WindowState state) | - |
789 | { | - |
790 | if (state == Qt::WindowActive) { partially evaluated: state == Qt::WindowActive no Evaluation Count:0 | yes Evaluation Count:155 |
| 0-155 |
791 | qWarning() << "QWindow::setWindowState does not accept Qt::WindowActive"; never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwindow.cpp", 791, __PRETTY_FUNCTION__).warning() << "QWindow::setWindowState does not accept Qt::WindowActive"; | - |
792 | return; | 0 |
793 | } | - |
794 | | - |
795 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
796 | if (d->platformWindow) evaluated: d->platformWindow yes Evaluation Count:102 | yes Evaluation Count:53 |
| 53-102 |
797 | d->platformWindow->setWindowState(state); executed: d->platformWindow->setWindowState(state); Execution Count:102 | 102 |
798 | d->windowState = state; executed (the execution status of this line is deduced): d->windowState = state; | - |
799 | emit windowStateChanged(d->windowState); executed (the execution status of this line is deduced): windowStateChanged(d->windowState); | - |
800 | } executed: } Execution Count:155 | 155 |
801 | | - |
802 | /*! | - |
803 | \brief the screen-occupation state of the window | - |
804 | | - |
805 | \sa setWindowState() | - |
806 | */ | - |
807 | Qt::WindowState QWindow::windowState() const | - |
808 | { | - |
809 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
810 | return d->windowState; executed: return d->windowState; Execution Count:13288 | 13288 |
811 | } | - |
812 | | - |
813 | /*! | - |
814 | \fn QWindow::windowStateChanged(Qt::WindowState windowState) | - |
815 | | - |
816 | This signal is emitted when the \a windowState changes, either | - |
817 | by being set explicitly with setWindowState(), or automatically when | - |
818 | the user clicks one of the titlebar buttons or by other means. | - |
819 | */ | - |
820 | | - |
821 | /*! | - |
822 | Sets the transient \a parent | - |
823 | | - |
824 | This is a hint to the window manager that this window is a dialog or pop-up | - |
825 | on behalf of the given window. | - |
826 | | - |
827 | \sa transientParent(), parent() | - |
828 | */ | - |
829 | void QWindow::setTransientParent(QWindow *parent) | - |
830 | { | - |
831 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
832 | d->transientParent = parent; executed (the execution status of this line is deduced): d->transientParent = parent; | - |
833 | | - |
834 | QGuiApplicationPrivate::updateBlockedStatus(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::updateBlockedStatus(this); | - |
835 | } executed: } Execution Count:205 | 205 |
836 | | - |
837 | /*! | - |
838 | Returns the transient parent of the window. | - |
839 | | - |
840 | \sa setTransientParent(), parent() | - |
841 | */ | - |
842 | QWindow *QWindow::transientParent() const | - |
843 | { | - |
844 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
845 | return d->transientParent.data(); executed: return d->transientParent.data(); Execution Count:882 | 882 |
846 | } | - |
847 | | - |
848 | /*! | - |
849 | \enum QWindow::AncestorMode | - |
850 | | - |
851 | This enum is used to control whether or not transient parents | - |
852 | should be considered ancestors. | - |
853 | | - |
854 | \value ExcludeTransients Transient parents are not considered ancestors. | - |
855 | \value IncludeTransients Transient parents are considered ancestors. | - |
856 | */ | - |
857 | | - |
858 | /*! | - |
859 | Returns true if the window is an ancestor of the given \a child. If \a mode | - |
860 | is IncludeTransients, then transient parents are also considered ancestors. | - |
861 | */ | - |
862 | bool QWindow::isAncestorOf(const QWindow *child, AncestorMode mode) const | - |
863 | { | - |
864 | if (child->parent() == this || (mode == IncludeTransients && child->transientParent() == this)) evaluated: child->parent() == this yes Evaluation Count:1 | yes Evaluation Count:32 |
partially evaluated: mode == IncludeTransients yes Evaluation Count:32 | no Evaluation Count:0 |
evaluated: child->transientParent() == this yes Evaluation Count:2 | yes Evaluation Count:30 |
| 0-32 |
865 | return true; executed: return true; Execution Count:3 | 3 |
866 | | - |
867 | return (child->parent() && isAncestorOf(child->parent(), mode)) executed: return (child->parent() && isAncestorOf(child->parent(), mode)) || (mode == IncludeTransients && child->transientParent() && isAncestorOf(child->transientParent(), mode)); Execution Count:30 | 30 |
868 | || (mode == IncludeTransients && child->transientParent() && isAncestorOf(child->transientParent(), mode)); executed: return (child->parent() && isAncestorOf(child->parent(), mode)) || (mode == IncludeTransients && child->transientParent() && isAncestorOf(child->transientParent(), mode)); Execution Count:30 | 30 |
869 | } | - |
870 | | - |
871 | /*! | - |
872 | Returns the minimum size of the window. | - |
873 | | - |
874 | \sa setMinimumSize() | - |
875 | */ | - |
876 | QSize QWindow::minimumSize() const | - |
877 | { | - |
878 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
879 | return d->minimumSize; executed: return d->minimumSize; Execution Count:10851 | 10851 |
880 | } | - |
881 | | - |
882 | /*! | - |
883 | Returns the maximum size of the window. | - |
884 | | - |
885 | \sa setMaximumSize() | - |
886 | */ | - |
887 | QSize QWindow::maximumSize() const | - |
888 | { | - |
889 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
890 | return d->maximumSize; executed: return d->maximumSize; Execution Count:10852 | 10852 |
891 | } | - |
892 | | - |
893 | /*! | - |
894 | Returns the base size of the window. | - |
895 | | - |
896 | \sa setBaseSize() | - |
897 | */ | - |
898 | QSize QWindow::baseSize() const | - |
899 | { | - |
900 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
901 | return d->baseSize; executed: return d->baseSize; Execution Count:8250 | 8250 |
902 | } | - |
903 | | - |
904 | /*! | - |
905 | Returns the size increment of the window. | - |
906 | | - |
907 | \sa setSizeIncrement() | - |
908 | */ | - |
909 | QSize QWindow::sizeIncrement() const | - |
910 | { | - |
911 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
912 | return d->sizeIncrement; executed: return d->sizeIncrement; Execution Count:8250 | 8250 |
913 | } | - |
914 | | - |
915 | /*! | - |
916 | Sets the minimum size of the window. | - |
917 | | - |
918 | This is a hint to the window manager to prevent resizing below the specified \a size. | - |
919 | | - |
920 | \sa setMaximumSize(), minimumSize() | - |
921 | */ | - |
922 | void QWindow::setMinimumSize(const QSize &size) | - |
923 | { | - |
924 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
925 | QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); executed (the execution status of this line is deduced): QSize adjustedSize = QSize(qBound(0, size.width(), ((1<<24)-1)), qBound(0, size.height(), ((1<<24)-1))); | - |
926 | if (d->minimumSize == adjustedSize) partially evaluated: d->minimumSize == adjustedSize no Evaluation Count:0 | yes Evaluation Count:201 |
| 0-201 |
927 | return; | 0 |
928 | QSize oldSize = d->minimumSize; executed (the execution status of this line is deduced): QSize oldSize = d->minimumSize; | - |
929 | d->minimumSize = adjustedSize; executed (the execution status of this line is deduced): d->minimumSize = adjustedSize; | - |
930 | if (d->platformWindow && isTopLevel()) partially evaluated: d->platformWindow no Evaluation Count:0 | yes Evaluation Count:201 |
never evaluated: isTopLevel() | 0-201 |
931 | d->platformWindow->propagateSizeHints(); never executed: d->platformWindow->propagateSizeHints(); | 0 |
932 | if (d->minimumSize.width() != oldSize.width()) evaluated: d->minimumSize.width() != oldSize.width() yes Evaluation Count:199 | yes Evaluation Count:2 |
| 2-199 |
933 | emit minimumWidthChanged(d->minimumSize.width()); executed: minimumWidthChanged(d->minimumSize.width()); Execution Count:199 | 199 |
934 | if (d->minimumSize.height() != oldSize.height()) evaluated: d->minimumSize.height() != oldSize.height() yes Evaluation Count:197 | yes Evaluation Count:4 |
| 4-197 |
935 | emit minimumHeightChanged(d->minimumSize.height()); executed: minimumHeightChanged(d->minimumSize.height()); Execution Count:197 | 197 |
936 | } executed: } Execution Count:201 | 201 |
937 | | - |
938 | /*! | - |
939 | \property QWindow::x | - |
940 | \brief the x position of the window's geometry | - |
941 | */ | - |
942 | void QWindow::setX(int arg) | - |
943 | { | - |
944 | if (x() != arg) never evaluated: x() != arg | 0 |
945 | setGeometry(QRect(arg, y(), width(), height())); never executed: setGeometry(QRect(arg, y(), width(), height())); | 0 |
946 | } | 0 |
947 | | - |
948 | /*! | - |
949 | \property QWindow::y | - |
950 | \brief the y position of the window's geometry | - |
951 | */ | - |
952 | void QWindow::setY(int arg) | - |
953 | { | - |
954 | if (y() != arg) never evaluated: y() != arg | 0 |
955 | setGeometry(QRect(x(), arg, width(), height())); never executed: setGeometry(QRect(x(), arg, width(), height())); | 0 |
956 | } | 0 |
957 | | - |
958 | /*! | - |
959 | \property QWindow::width | - |
960 | \brief the width of the window's geometry | - |
961 | */ | - |
962 | void QWindow::setWidth(int arg) | - |
963 | { | - |
964 | if (width() != arg) never evaluated: width() != arg | 0 |
965 | setGeometry(QRect(x(), y(), arg, height())); never executed: setGeometry(QRect(x(), y(), arg, height())); | 0 |
966 | } | 0 |
967 | | - |
968 | /*! | - |
969 | \property QWindow::height | - |
970 | \brief the height of the window's geometry | - |
971 | */ | - |
972 | void QWindow::setHeight(int arg) | - |
973 | { | - |
974 | if (height() != arg) never evaluated: height() != arg | 0 |
975 | setGeometry(QRect(x(), y(), width(), arg)); never executed: setGeometry(QRect(x(), y(), width(), arg)); | 0 |
976 | } | 0 |
977 | | - |
978 | /*! | - |
979 | \property QWindow::minimumWidth | - |
980 | \brief the minimum width of the window's geometry | - |
981 | */ | - |
982 | void QWindow::setMinimumWidth(int w) | - |
983 | { | - |
984 | setMinimumSize(QSize(w, minimumHeight())); executed (the execution status of this line is deduced): setMinimumSize(QSize(w, minimumHeight())); | - |
985 | } executed: } Execution Count:1 | 1 |
986 | | - |
987 | /*! | - |
988 | \property QWindow::minimumHeight | - |
989 | \brief the minimum height of the window's geometry | - |
990 | */ | - |
991 | void QWindow::setMinimumHeight(int h) | - |
992 | { | - |
993 | setMinimumSize(QSize(minimumWidth(), h)); executed (the execution status of this line is deduced): setMinimumSize(QSize(minimumWidth(), h)); | - |
994 | } executed: } Execution Count:1 | 1 |
995 | | - |
996 | /*! | - |
997 | Sets the maximum size of the window. | - |
998 | | - |
999 | This is a hint to the window manager to prevent resizing above the specified \a size. | - |
1000 | | - |
1001 | \sa setMinimumSize(), maximumSize() | - |
1002 | */ | - |
1003 | void QWindow::setMaximumSize(const QSize &size) | - |
1004 | { | - |
1005 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1006 | QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); executed (the execution status of this line is deduced): QSize adjustedSize = QSize(qBound(0, size.width(), ((1<<24)-1)), qBound(0, size.height(), ((1<<24)-1))); | - |
1007 | if (d->maximumSize == adjustedSize) partially evaluated: d->maximumSize == adjustedSize no Evaluation Count:0 | yes Evaluation Count:193 |
| 0-193 |
1008 | return; | 0 |
1009 | QSize oldSize = d->maximumSize; executed (the execution status of this line is deduced): QSize oldSize = d->maximumSize; | - |
1010 | d->maximumSize = adjustedSize; executed (the execution status of this line is deduced): d->maximumSize = adjustedSize; | - |
1011 | if (d->platformWindow && isTopLevel()) partially evaluated: d->platformWindow no Evaluation Count:0 | yes Evaluation Count:193 |
never evaluated: isTopLevel() | 0-193 |
1012 | d->platformWindow->propagateSizeHints(); never executed: d->platformWindow->propagateSizeHints(); | 0 |
1013 | if (d->maximumSize.width() != oldSize.width()) evaluated: d->maximumSize.width() != oldSize.width() yes Evaluation Count:191 | yes Evaluation Count:2 |
| 2-191 |
1014 | emit maximumWidthChanged(d->maximumSize.width()); executed: maximumWidthChanged(d->maximumSize.width()); Execution Count:191 | 191 |
1015 | if (d->maximumSize.height() != oldSize.height()) evaluated: d->maximumSize.height() != oldSize.height() yes Evaluation Count:191 | yes Evaluation Count:2 |
| 2-191 |
1016 | emit maximumHeightChanged(d->maximumSize.height()); executed: maximumHeightChanged(d->maximumSize.height()); Execution Count:191 | 191 |
1017 | } executed: } Execution Count:193 | 193 |
1018 | | - |
1019 | /*! | - |
1020 | \property QWindow::maximumWidth | - |
1021 | \brief the maximum width of the window's geometry | - |
1022 | */ | - |
1023 | void QWindow::setMaximumWidth(int w) | - |
1024 | { | - |
1025 | setMaximumSize(QSize(w, maximumHeight())); executed (the execution status of this line is deduced): setMaximumSize(QSize(w, maximumHeight())); | - |
1026 | } executed: } Execution Count:1 | 1 |
1027 | | - |
1028 | /*! | - |
1029 | \property QWindow::maximumHeight | - |
1030 | \brief the maximum height of the window's geometry | - |
1031 | */ | - |
1032 | void QWindow::setMaximumHeight(int h) | - |
1033 | { | - |
1034 | setMaximumSize(QSize(maximumWidth(), h)); executed (the execution status of this line is deduced): setMaximumSize(QSize(maximumWidth(), h)); | - |
1035 | } executed: } Execution Count:1 | 1 |
1036 | | - |
1037 | /*! | - |
1038 | Sets the base \a size of the window. | - |
1039 | | - |
1040 | The base size is used to calculate a proper window size if the | - |
1041 | window defines sizeIncrement(). | - |
1042 | | - |
1043 | \sa setMinimumSize(), setMaximumSize(), setSizeIncrement(), baseSize() | - |
1044 | */ | - |
1045 | void QWindow::setBaseSize(const QSize &size) | - |
1046 | { | - |
1047 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1048 | if (d->baseSize == size) never evaluated: d->baseSize == size | 0 |
1049 | return; | 0 |
1050 | d->baseSize = size; never executed (the execution status of this line is deduced): d->baseSize = size; | - |
1051 | if (d->platformWindow && isTopLevel()) never evaluated: d->platformWindow never evaluated: isTopLevel() | 0 |
1052 | d->platformWindow->propagateSizeHints(); never executed: d->platformWindow->propagateSizeHints(); | 0 |
1053 | } | 0 |
1054 | | - |
1055 | /*! | - |
1056 | Sets the size increment (\a size) of the window. | - |
1057 | | - |
1058 | When the user resizes the window, the size will move in steps of | - |
1059 | sizeIncrement().width() pixels horizontally and | - |
1060 | sizeIncrement().height() pixels vertically, with baseSize() as the | - |
1061 | basis. | - |
1062 | | - |
1063 | By default, this property contains a size with zero width and height. | - |
1064 | | - |
1065 | The windowing system might not support size increments. | - |
1066 | | - |
1067 | \sa setBaseSize(), setMinimumSize(), setMaximumSize() | - |
1068 | */ | - |
1069 | void QWindow::setSizeIncrement(const QSize &size) | - |
1070 | { | - |
1071 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1072 | if (d->sizeIncrement == size) never evaluated: d->sizeIncrement == size | 0 |
1073 | return; | 0 |
1074 | d->sizeIncrement = size; never executed (the execution status of this line is deduced): d->sizeIncrement = size; | - |
1075 | if (d->platformWindow && isTopLevel()) never evaluated: d->platformWindow never evaluated: isTopLevel() | 0 |
1076 | d->platformWindow->propagateSizeHints(); never executed: d->platformWindow->propagateSizeHints(); | 0 |
1077 | } | 0 |
1078 | | - |
1079 | /*! | - |
1080 | Sets the geometry of the window, excluding its window frame, to a | - |
1081 | rectangle constructed from \a posx, \a posy, \a w and \a h. | - |
1082 | | - |
1083 | \sa geometry() | - |
1084 | */ | - |
1085 | void QWindow::setGeometry(int posx, int posy, int w, int h) | - |
1086 | { | - |
1087 | setGeometry(QRect(posx, posy, w, h)); executed (the execution status of this line is deduced): setGeometry(QRect(posx, posy, w, h)); | - |
1088 | } executed: } Execution Count:22 | 22 |
1089 | | - |
1090 | /*! | - |
1091 | \brief Sets the geometry of the window, excluding its window frame, to \a rect. | - |
1092 | | - |
1093 | \sa geometry() | - |
1094 | */ | - |
1095 | void QWindow::setGeometry(const QRect &rect) | - |
1096 | { | - |
1097 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1098 | if (rect == geometry()) evaluated: rect == geometry() yes Evaluation Count:20 | yes Evaluation Count:5162 |
| 20-5162 |
1099 | return; executed: return; Execution Count:20 | 20 |
1100 | QRect oldRect = geometry(); executed (the execution status of this line is deduced): QRect oldRect = geometry(); | - |
1101 | | - |
1102 | d->positionPolicy = QWindowPrivate::WindowFrameExclusive; executed (the execution status of this line is deduced): d->positionPolicy = QWindowPrivate::WindowFrameExclusive; | - |
1103 | if (d->platformWindow) { evaluated: d->platformWindow yes Evaluation Count:2479 | yes Evaluation Count:2683 |
| 2479-2683 |
1104 | d->platformWindow->setGeometry(rect); executed (the execution status of this line is deduced): d->platformWindow->setGeometry(rect); | - |
1105 | } else { executed: } Execution Count:2479 | 2479 |
1106 | d->geometry = rect; executed (the execution status of this line is deduced): d->geometry = rect; | - |
1107 | | - |
1108 | if (rect.x() != oldRect.x()) evaluated: rect.x() != oldRect.x() yes Evaluation Count:345 | yes Evaluation Count:2338 |
| 345-2338 |
1109 | emit xChanged(rect.x()); executed: xChanged(rect.x()); Execution Count:345 | 345 |
1110 | if (rect.y() != oldRect.y()) evaluated: rect.y() != oldRect.y() yes Evaluation Count:349 | yes Evaluation Count:2334 |
| 349-2334 |
1111 | emit yChanged(rect.y()); executed: yChanged(rect.y()); Execution Count:349 | 349 |
1112 | if (rect.width() != oldRect.width()) evaluated: rect.width() != oldRect.width() yes Evaluation Count:2682 | yes Evaluation Count:1 |
| 1-2682 |
1113 | emit widthChanged(rect.width()); executed: widthChanged(rect.width()); Execution Count:2682 | 2682 |
1114 | if (rect.height() != oldRect.height()) evaluated: rect.height() != oldRect.height() yes Evaluation Count:2682 | yes Evaluation Count:1 |
| 1-2682 |
1115 | emit heightChanged(rect.height()); executed: heightChanged(rect.height()); Execution Count:2682 | 2682 |
1116 | } executed: } Execution Count:2683 | 2683 |
1117 | } | - |
1118 | | - |
1119 | /*! | - |
1120 | Returns the geometry of the window, excluding its window frame. | - |
1121 | | - |
1122 | \sa frameMargins(), frameGeometry() | - |
1123 | */ | - |
1124 | QRect QWindow::geometry() const | - |
1125 | { | - |
1126 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1127 | if (d->platformWindow) evaluated: d->platformWindow yes Evaluation Count:56711 | yes Evaluation Count:10672 |
| 10672-56711 |
1128 | return d->platformWindow->geometry(); executed: return d->platformWindow->geometry(); Execution Count:56711 | 56711 |
1129 | return d->geometry; executed: return d->geometry; Execution Count:10672 | 10672 |
1130 | } | - |
1131 | | - |
1132 | /*! | - |
1133 | Returns the window frame margins surrounding the window. | - |
1134 | | - |
1135 | \sa geometry(), frameGeometry() | - |
1136 | */ | - |
1137 | QMargins QWindow::frameMargins() const | - |
1138 | { | - |
1139 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1140 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:3029 | no Evaluation Count:0 |
| 0-3029 |
1141 | return d->platformWindow->frameMargins(); executed: return d->platformWindow->frameMargins(); Execution Count:3029 | 3029 |
1142 | return QMargins(); never executed: return QMargins(); | 0 |
1143 | } | - |
1144 | | - |
1145 | /*! | - |
1146 | Returns the geometry of the window, including its window frame. | - |
1147 | | - |
1148 | \sa geometry(), frameMargins() | - |
1149 | */ | - |
1150 | QRect QWindow::frameGeometry() const | - |
1151 | { | - |
1152 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1153 | if (d->platformWindow) { partially evaluated: d->platformWindow yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1154 | QMargins m = frameMargins(); executed (the execution status of this line is deduced): QMargins m = frameMargins(); | - |
1155 | return d->platformWindow->geometry().adjusted(-m.left(), -m.top(), m.right(), m.bottom()); executed: return d->platformWindow->geometry().adjusted(-m.left(), -m.top(), m.right(), m.bottom()); Execution Count:1 | 1 |
1156 | } | - |
1157 | return d->geometry; never executed: return d->geometry; | 0 |
1158 | } | - |
1159 | | - |
1160 | /*! | - |
1161 | Returns the top left position of the window, including its window frame. | - |
1162 | | - |
1163 | This returns the same value as frameGeometry().topLeft(). | - |
1164 | | - |
1165 | \sa geometry(), frameGeometry() | - |
1166 | */ | - |
1167 | QPoint QWindow::framePosition() const | - |
1168 | { | - |
1169 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1170 | if (d->platformWindow) { partially evaluated: d->platformWindow yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
1171 | QMargins margins = frameMargins(); executed (the execution status of this line is deduced): QMargins margins = frameMargins(); | - |
1172 | return d->platformWindow->geometry().topLeft() - QPoint(margins.left(), margins.top()); executed: return d->platformWindow->geometry().topLeft() - QPoint(margins.left(), margins.top()); Execution Count:9 | 9 |
1173 | } | - |
1174 | return d->geometry.topLeft(); never executed: return d->geometry.topLeft(); | 0 |
1175 | } | - |
1176 | | - |
1177 | /*! | - |
1178 | Sets the upper left position of the window (\a point) including its window frame. | - |
1179 | | - |
1180 | \sa setGeometry(), frameGeometry() | - |
1181 | */ | - |
1182 | void QWindow::setFramePosition(const QPoint &point) | - |
1183 | { | - |
1184 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1185 | d->positionPolicy = QWindowPrivate::WindowFrameInclusive; executed (the execution status of this line is deduced): d->positionPolicy = QWindowPrivate::WindowFrameInclusive; | - |
1186 | if (d->platformWindow) { evaluated: d->platformWindow yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1187 | d->platformWindow->setGeometry(QRect(point, size())); executed (the execution status of this line is deduced): d->platformWindow->setGeometry(QRect(point, size())); | - |
1188 | } else { executed: } Execution Count:1 | 1 |
1189 | d->geometry.moveTopLeft(point); executed (the execution status of this line is deduced): d->geometry.moveTopLeft(point); | - |
1190 | } executed: } Execution Count:1 | 1 |
1191 | } | - |
1192 | | - |
1193 | /*! | - |
1194 | \brief set the position of the window on the desktop to \a pt | - |
1195 | | - |
1196 | \sa position() | - |
1197 | */ | - |
1198 | void QWindow::setPosition(const QPoint &pt) | - |
1199 | { | - |
1200 | setGeometry(QRect(pt, size())); executed (the execution status of this line is deduced): setGeometry(QRect(pt, size())); | - |
1201 | } executed: } Execution Count:1 | 1 |
1202 | | - |
1203 | /*! | - |
1204 | \brief set the position of the window on the desktop to \a posx, \a posy | - |
1205 | | - |
1206 | \sa position() | - |
1207 | */ | - |
1208 | void QWindow::setPosition(int posx, int posy) | - |
1209 | { | - |
1210 | setPosition(QPoint(posx, posy)); never executed (the execution status of this line is deduced): setPosition(QPoint(posx, posy)); | - |
1211 | } | 0 |
1212 | | - |
1213 | /*! | - |
1214 | \fn QPoint QWindow::position() const | - |
1215 | \brief Returns the position of the window on the desktop excluding any window frame | - |
1216 | | - |
1217 | \sa setPosition() | - |
1218 | */ | - |
1219 | | - |
1220 | /*! | - |
1221 | \fn QSize QWindow::size() const | - |
1222 | \brief Returns the size of the window excluding any window frame | - |
1223 | | - |
1224 | \sa resize() | - |
1225 | */ | - |
1226 | | - |
1227 | /*! | - |
1228 | set the size of the window, excluding any window frame, to a QSize | - |
1229 | constructed from width \a w and height \a h | - |
1230 | | - |
1231 | \sa size(), geometry() | - |
1232 | */ | - |
1233 | void QWindow::resize(int w, int h) | - |
1234 | { | - |
1235 | resize(QSize(w, h)); never executed (the execution status of this line is deduced): resize(QSize(w, h)); | - |
1236 | } | 0 |
1237 | | - |
1238 | /*! | - |
1239 | \brief set the size of the window, excluding any window frame, to \a newSize | - |
1240 | | - |
1241 | \sa size(), geometry() | - |
1242 | */ | - |
1243 | void QWindow::resize(const QSize &newSize) | - |
1244 | { | - |
1245 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1246 | if (d->platformWindow) { never evaluated: d->platformWindow | 0 |
1247 | d->platformWindow->setGeometry(QRect(position(), newSize)); never executed (the execution status of this line is deduced): d->platformWindow->setGeometry(QRect(position(), newSize)); | - |
1248 | } else { | 0 |
1249 | d->geometry.setSize(newSize); never executed (the execution status of this line is deduced): d->geometry.setSize(newSize); | - |
1250 | } | 0 |
1251 | } | - |
1252 | | - |
1253 | /*! | - |
1254 | Releases the native platform resources associated with this window. | - |
1255 | | - |
1256 | \sa create() | - |
1257 | */ | - |
1258 | void QWindow::destroy() | - |
1259 | { | - |
1260 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1261 | QObjectList childrenWindows = children(); executed (the execution status of this line is deduced): QObjectList childrenWindows = children(); | - |
1262 | for (int i = 0; i < childrenWindows.size(); i++) { evaluated: i < childrenWindows.size() yes Evaluation Count:3 | yes Evaluation Count:7008 |
| 3-7008 |
1263 | QObject *object = childrenWindows.at(i); executed (the execution status of this line is deduced): QObject *object = childrenWindows.at(i); | - |
1264 | if (object->isWindowType()) { partially evaluated: object->isWindowType() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1265 | QWindow *w = static_cast<QWindow*>(object); executed (the execution status of this line is deduced): QWindow *w = static_cast<QWindow*>(object); | - |
1266 | QGuiApplicationPrivate::window_list.removeAll(w); executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.removeAll(w); | - |
1267 | w->destroy(); executed (the execution status of this line is deduced): w->destroy(); | - |
1268 | } executed: } Execution Count:3 | 3 |
1269 | } executed: } Execution Count:3 | 3 |
1270 | setVisible(false); executed (the execution status of this line is deduced): setVisible(false); | - |
1271 | delete d->platformWindow; executed (the execution status of this line is deduced): delete d->platformWindow; | - |
1272 | d->resizeEventPending = true; executed (the execution status of this line is deduced): d->resizeEventPending = true; | - |
1273 | d->receivedExpose = false; executed (the execution status of this line is deduced): d->receivedExpose = false; | - |
1274 | d->exposed = false; executed (the execution status of this line is deduced): d->exposed = false; | - |
1275 | d->platformWindow = 0; executed (the execution status of this line is deduced): d->platformWindow = 0; | - |
1276 | } executed: } Execution Count:7008 | 7008 |
1277 | | - |
1278 | /*! | - |
1279 | Returns the platform window corresponding to the window. | - |
1280 | | - |
1281 | \internal | - |
1282 | */ | - |
1283 | QPlatformWindow *QWindow::handle() const | - |
1284 | { | - |
1285 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1286 | return d->platformWindow; executed: return d->platformWindow; Execution Count:504018 | 504018 |
1287 | } | - |
1288 | | - |
1289 | /*! | - |
1290 | Returns the platform surface corresponding to the window. | - |
1291 | | - |
1292 | \internal | - |
1293 | */ | - |
1294 | QPlatformSurface *QWindow::surfaceHandle() const | - |
1295 | { | - |
1296 | Q_D(const QWindow); never executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1297 | return d->platformWindow; never executed: return d->platformWindow; | 0 |
1298 | } | - |
1299 | | - |
1300 | /*! | - |
1301 | Sets whether keyboard grab should be enabled or not (\a grab). | - |
1302 | | - |
1303 | If the return value is true, the window receives all key events until | - |
1304 | setKeyboardGrabEnabled(false) is called; other windows get no key events at | - |
1305 | all. Mouse events are not affected. Use setMouseGrabEnabled() if you want | - |
1306 | to grab that. | - |
1307 | | - |
1308 | \sa setMouseGrabEnabled() | - |
1309 | */ | - |
1310 | bool QWindow::setKeyboardGrabEnabled(bool grab) | - |
1311 | { | - |
1312 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1313 | if (grab && QGuiApplicationPrivate::noGrab) evaluated: grab yes Evaluation Count:113 | yes Evaluation Count:90 |
partially evaluated: QGuiApplicationPrivate::noGrab no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
1314 | return false; never executed: return false; | 0 |
1315 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:203 | no Evaluation Count:0 |
| 0-203 |
1316 | return d->platformWindow->setKeyboardGrabEnabled(grab); executed: return d->platformWindow->setKeyboardGrabEnabled(grab); Execution Count:203 | 203 |
1317 | return false; never executed: return false; | 0 |
1318 | } | - |
1319 | | - |
1320 | /*! | - |
1321 | Sets whether mouse grab should be enabled or not (\a grab). | - |
1322 | | - |
1323 | If the return value is true, the window receives all mouse events until setMouseGrabEnabled(false) is | - |
1324 | called; other windows get no mouse events at all. Keyboard events are not affected. | - |
1325 | Use setKeyboardGrabEnabled() if you want to grab that. | - |
1326 | | - |
1327 | \sa setKeyboardGrabEnabled() | - |
1328 | */ | - |
1329 | bool QWindow::setMouseGrabEnabled(bool grab) | - |
1330 | { | - |
1331 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1332 | if (grab && QGuiApplicationPrivate::noGrab) evaluated: grab yes Evaluation Count:113 | yes Evaluation Count:92 |
partially evaluated: QGuiApplicationPrivate::noGrab no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
1333 | return false; never executed: return false; | 0 |
1334 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:205 | no Evaluation Count:0 |
| 0-205 |
1335 | return d->platformWindow->setMouseGrabEnabled(grab); executed: return d->platformWindow->setMouseGrabEnabled(grab); Execution Count:205 | 205 |
1336 | return false; never executed: return false; | 0 |
1337 | } | - |
1338 | | - |
1339 | /*! | - |
1340 | Returns the screen on which the window is shown. | - |
1341 | | - |
1342 | The value returned will not change when the window is moved | - |
1343 | between virtual screens (as returned by QScreen::virtualSiblings()). | - |
1344 | | - |
1345 | \sa setScreen(), QScreen::virtualSiblings() | - |
1346 | */ | - |
1347 | QScreen *QWindow::screen() const | - |
1348 | { | - |
1349 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1350 | return d->screen; executed: return d->screen; Execution Count:185269 | 185269 |
1351 | } | - |
1352 | | - |
1353 | /*! | - |
1354 | Sets the screen on which the window should be shown. | - |
1355 | | - |
1356 | If the window has been created, it will be recreated on the \a newScreen. | - |
1357 | | - |
1358 | Note that if the screen is part of a virtual desktop of multiple screens, | - |
1359 | the window can appear on any of the screens returned by QScreen::virtualSiblings(). | - |
1360 | | - |
1361 | \sa screen(), QScreen::virtualSiblings() | - |
1362 | */ | - |
1363 | void QWindow::setScreen(QScreen *newScreen) | - |
1364 | { | - |
1365 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1366 | if (!newScreen) evaluated: !newScreen yes Evaluation Count:8 | yes Evaluation Count:2674 |
| 8-2674 |
1367 | newScreen = QGuiApplication::primaryScreen(); executed: newScreen = QGuiApplication::primaryScreen(); Execution Count:8 | 8 |
1368 | if (newScreen != screen()) { evaluated: newScreen != screen() yes Evaluation Count:8 | yes Evaluation Count:2674 |
| 8-2674 |
1369 | const bool wasCreated = d->platformWindow != 0; executed (the execution status of this line is deduced): const bool wasCreated = d->platformWindow != 0; | - |
1370 | if (wasCreated) evaluated: wasCreated yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
1371 | destroy(); executed: destroy(); Execution Count:4 | 4 |
1372 | if (d->screen) partially evaluated: d->screen yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1373 | disconnect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); executed: disconnect(d->screen, "2""destroyed(QObject*)", this, "1""screenDestroyed(QObject*)"); Execution Count:8 | 8 |
1374 | d->screen = newScreen; executed (the execution status of this line is deduced): d->screen = newScreen; | - |
1375 | if (newScreen) { partially evaluated: newScreen no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1376 | connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); never executed (the execution status of this line is deduced): connect(d->screen, "2""destroyed(QObject*)", this, "1""screenDestroyed(QObject*)"); | - |
1377 | if (wasCreated) never evaluated: wasCreated | 0 |
1378 | create(); never executed: create(); | 0 |
1379 | } | 0 |
1380 | emit screenChanged(newScreen); executed (the execution status of this line is deduced): screenChanged(newScreen); | - |
1381 | } executed: } Execution Count:8 | 8 |
1382 | } executed: } Execution Count:2682 | 2682 |
1383 | | - |
1384 | void QWindow::screenDestroyed(QObject *object) | - |
1385 | { | - |
1386 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1387 | if (object == static_cast<QObject *>(d->screen)) { partially evaluated: object == static_cast<QObject *>(d->screen) yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1388 | const bool wasVisible = isVisible(); executed (the execution status of this line is deduced): const bool wasVisible = isVisible(); | - |
1389 | setScreen(0); executed (the execution status of this line is deduced): setScreen(0); | - |
1390 | // destroy() might have hidden our window, show it again. | - |
1391 | // This might not be the best behavior if the new screen isn't a virtual sibling | - |
1392 | // of the old one. This can be removed once platform plugins have the power to | - |
1393 | // update the QScreen of its QWindows itself. | - |
1394 | if (wasVisible && d->platformWindow) evaluated: wasVisible yes Evaluation Count:4 | yes Evaluation Count:4 |
partially evaluated: d->platformWindow no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
1395 | setVisible(true); never executed: setVisible(true); | 0 |
1396 | } executed: } Execution Count:8 | 8 |
1397 | } executed: } Execution Count:8 | 8 |
1398 | | - |
1399 | /*! | - |
1400 | \fn QWindow::screenChanged(QScreen *screen) | - |
1401 | | - |
1402 | This signal is emitted when a window's \a screen changes, either | - |
1403 | by being set explicitly with setScreen(), or automatically when | - |
1404 | the window's screen is removed. | - |
1405 | */ | - |
1406 | | - |
1407 | /*! | - |
1408 | Returns the accessibility interface for the object that the window represents | - |
1409 | \internal | - |
1410 | \sa QAccessible | - |
1411 | */ | - |
1412 | QAccessibleInterface *QWindow::accessibleRoot() const | - |
1413 | { | - |
1414 | return 0; never executed: return 0; | 0 |
1415 | } | - |
1416 | | - |
1417 | /*! | - |
1418 | \fn QWindow::focusObjectChanged(QObject *focusObject) | - |
1419 | | - |
1420 | This signal is emitted when final receiver of events tied to focus is | - |
1421 | changed to \a focusObject. | - |
1422 | | - |
1423 | \sa focusObject() | - |
1424 | */ | - |
1425 | | - |
1426 | /*! | - |
1427 | Returns the QObject that will be the final receiver of events tied focus, such | - |
1428 | as key events. | - |
1429 | */ | - |
1430 | QObject *QWindow::focusObject() const | - |
1431 | { | - |
1432 | return const_cast<QWindow *>(this); executed: return const_cast<QWindow *>(this); Execution Count:113 | 113 |
1433 | } | - |
1434 | | - |
1435 | /*! | - |
1436 | Shows the window. | - |
1437 | | - |
1438 | This equivalent to calling showFullScreen() or showNormal(), depending | - |
1439 | on whether the platform defaults to windows being fullscreen or not. | - |
1440 | | - |
1441 | \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen() | - |
1442 | */ | - |
1443 | void QWindow::show() | - |
1444 | { | - |
1445 | if (qApp->styleHints()->showIsFullScreen()) partially evaluated: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints()->showIsFullScreen() no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
1446 | showFullScreen(); never executed: showFullScreen(); | 0 |
1447 | else | - |
1448 | showNormal(); executed: showNormal(); Execution Count:55 | 55 |
1449 | } | - |
1450 | | - |
1451 | /*! | - |
1452 | Hides the window. | - |
1453 | | - |
1454 | Equivalent to calling setVisible(false). | - |
1455 | | - |
1456 | \sa show(), setVisible() | - |
1457 | */ | - |
1458 | void QWindow::hide() | - |
1459 | { | - |
1460 | setVisible(false); executed (the execution status of this line is deduced): setVisible(false); | - |
1461 | } executed: } Execution Count:10 | 10 |
1462 | | - |
1463 | /*! | - |
1464 | Shows the window as minimized. | - |
1465 | | - |
1466 | Equivalent to calling setWindowState(Qt::WindowMinimized) and then | - |
1467 | setVisible(true). | - |
1468 | | - |
1469 | \sa setWindowState(), setVisible() | - |
1470 | */ | - |
1471 | void QWindow::showMinimized() | - |
1472 | { | - |
1473 | setWindowState(Qt::WindowMinimized); never executed (the execution status of this line is deduced): setWindowState(Qt::WindowMinimized); | - |
1474 | setVisible(true); never executed (the execution status of this line is deduced): setVisible(true); | - |
1475 | } | 0 |
1476 | | - |
1477 | /*! | - |
1478 | Shows the window as maximized. | - |
1479 | | - |
1480 | Equivalent to calling setWindowState(Qt::WindowMaximized) and then | - |
1481 | setVisible(true). | - |
1482 | | - |
1483 | \sa setWindowState(), setVisible() | - |
1484 | */ | - |
1485 | void QWindow::showMaximized() | - |
1486 | { | - |
1487 | setWindowState(Qt::WindowMaximized); executed (the execution status of this line is deduced): setWindowState(Qt::WindowMaximized); | - |
1488 | setVisible(true); executed (the execution status of this line is deduced): setVisible(true); | - |
1489 | } executed: } Execution Count:1 | 1 |
1490 | | - |
1491 | /*! | - |
1492 | Shows the window as fullscreen. | - |
1493 | | - |
1494 | Equivalent to calling setWindowState(Qt::WindowFullScreen) and then | - |
1495 | setVisible(true). | - |
1496 | | - |
1497 | \sa setWindowState(), setVisible() | - |
1498 | */ | - |
1499 | void QWindow::showFullScreen() | - |
1500 | { | - |
1501 | setWindowState(Qt::WindowFullScreen); never executed (the execution status of this line is deduced): setWindowState(Qt::WindowFullScreen); | - |
1502 | setVisible(true); never executed (the execution status of this line is deduced): setVisible(true); | - |
1503 | requestActivate(); never executed (the execution status of this line is deduced): requestActivate(); | - |
1504 | } | 0 |
1505 | | - |
1506 | /*! | - |
1507 | Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen. | - |
1508 | | - |
1509 | Equivalent to calling setWindowState(Qt::WindowNoState) and then | - |
1510 | setVisible(true). | - |
1511 | | - |
1512 | \sa setWindowState(), setVisible() | - |
1513 | */ | - |
1514 | void QWindow::showNormal() | - |
1515 | { | - |
1516 | setWindowState(Qt::WindowNoState); executed (the execution status of this line is deduced): setWindowState(Qt::WindowNoState); | - |
1517 | setVisible(true); executed (the execution status of this line is deduced): setVisible(true); | - |
1518 | } executed: } Execution Count:55 | 55 |
1519 | | - |
1520 | /*! | - |
1521 | Close the window. | - |
1522 | | - |
1523 | This closes the window, effectively calling destroy(), and potentially | - |
1524 | quitting the application. Returns true on success, false if it has a parent | - |
1525 | window (in which case the top level window should be closed instead). | - |
1526 | | - |
1527 | \sa destroy(), QGuiApplication::quitOnLastWindowClosed() | - |
1528 | */ | - |
1529 | bool QWindow::close() | - |
1530 | { | - |
1531 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1532 | | - |
1533 | // Do not close non top level windows | - |
1534 | if (parent()) evaluated: parent() yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
1535 | return false; executed: return false; Execution Count:1 | 1 |
1536 | | - |
1537 | if (QGuiApplicationPrivate::focus_window == this) evaluated: QGuiApplicationPrivate::focus_window == this yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-6 |
1538 | QGuiApplicationPrivate::focus_window = 0; executed: QGuiApplicationPrivate::focus_window = 0; Execution Count:1 | 1 |
1539 | if (QGuiApplicationPrivate::currentMouseWindow == this) partially evaluated: QGuiApplicationPrivate::currentMouseWindow == this no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
1540 | QGuiApplicationPrivate::currentMouseWindow = 0; never executed: QGuiApplicationPrivate::currentMouseWindow = 0; | 0 |
1541 | | - |
1542 | QGuiApplicationPrivate::window_list.removeAll(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.removeAll(this); | - |
1543 | destroy(); executed (the execution status of this line is deduced): destroy(); | - |
1544 | d->maybeQuitOnLastWindowClosed(); executed (the execution status of this line is deduced): d->maybeQuitOnLastWindowClosed(); | - |
1545 | return true; executed: return true; Execution Count:7 | 7 |
1546 | } | - |
1547 | | - |
1548 | /*! | - |
1549 | The expose event (\a ev) is sent by the window system whenever the window's | - |
1550 | exposure on screen changes. | - |
1551 | | - |
1552 | The application can start rendering into the window with QBackingStore | - |
1553 | and QOpenGLContext as soon as it gets an exposeEvent() such that | - |
1554 | isExposed() is true. | - |
1555 | | - |
1556 | If the window is moved off screen, is made totally obscured by another | - |
1557 | window, iconified or similar, this function might be called and the | - |
1558 | value of isExposed() might change to false. When this happens, | - |
1559 | an application should stop its rendering as it is no longer visible | - |
1560 | to the user. | - |
1561 | | - |
1562 | A resize event will always be sent before the expose event the first time | - |
1563 | a window is shown. | - |
1564 | | - |
1565 | \sa isExposed() | - |
1566 | */ | - |
1567 | void QWindow::exposeEvent(QExposeEvent *ev) | - |
1568 | { | - |
1569 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1570 | } executed: } Execution Count:92 | 92 |
1571 | | - |
1572 | /*! | - |
1573 | Override this to handle mouse events (\a ev). | - |
1574 | */ | - |
1575 | void QWindow::moveEvent(QMoveEvent *ev) | - |
1576 | { | - |
1577 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1578 | } executed: } Execution Count:5 | 5 |
1579 | | - |
1580 | /*! | - |
1581 | Override this to handle resize events (\a ev). | - |
1582 | | - |
1583 | The resize event is called whenever the window is resized in the windowing system, | - |
1584 | either directly through the windowing system acknowledging a setGeometry() or resize() request, | - |
1585 | or indirectly through the user resizing the window manually. | - |
1586 | */ | - |
1587 | void QWindow::resizeEvent(QResizeEvent *ev) | - |
1588 | { | - |
1589 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1590 | } executed: } Execution Count:45 | 45 |
1591 | | - |
1592 | /*! | - |
1593 | Override this to handle show events (\a ev). | - |
1594 | | - |
1595 | The function is called when the window has requested becoming visible. | - |
1596 | | - |
1597 | If the window is successfully shown by the windowing system, this will | - |
1598 | be followed by a resize and an expose event. | - |
1599 | */ | - |
1600 | void QWindow::showEvent(QShowEvent *ev) | - |
1601 | { | - |
1602 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1603 | } executed: } Execution Count:2615 | 2615 |
1604 | | - |
1605 | /*! | - |
1606 | Override this to handle hide events (\a ev). | - |
1607 | | - |
1608 | The function is called when the window has requested being hidden in the | - |
1609 | windowing system. | - |
1610 | */ | - |
1611 | void QWindow::hideEvent(QHideEvent *ev) | - |
1612 | { | - |
1613 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1614 | } executed: } Execution Count:2579 | 2579 |
1615 | | - |
1616 | /*! | - |
1617 | Override this to handle any event (\a ev) sent to the window. | - |
1618 | Return \c true if the event was recognized and processed. | - |
1619 | | - |
1620 | Remember to call the base class version if you wish for mouse events, | - |
1621 | key events, resize events, etc to be dispatched as usual. | - |
1622 | */ | - |
1623 | bool QWindow::event(QEvent *ev) | - |
1624 | { | - |
1625 | switch (ev->type()) { | - |
1626 | case QEvent::MouseMove: | - |
1627 | mouseMoveEvent(static_cast<QMouseEvent*>(ev)); executed (the execution status of this line is deduced): mouseMoveEvent(static_cast<QMouseEvent*>(ev)); | - |
1628 | break; executed: break; Execution Count:8 | 8 |
1629 | | - |
1630 | case QEvent::MouseButtonPress: | - |
1631 | mousePressEvent(static_cast<QMouseEvent*>(ev)); executed (the execution status of this line is deduced): mousePressEvent(static_cast<QMouseEvent*>(ev)); | - |
1632 | break; executed: break; Execution Count:57 | 57 |
1633 | | - |
1634 | case QEvent::MouseButtonRelease: | - |
1635 | mouseReleaseEvent(static_cast<QMouseEvent*>(ev)); executed (the execution status of this line is deduced): mouseReleaseEvent(static_cast<QMouseEvent*>(ev)); | - |
1636 | break; executed: break; Execution Count:57 | 57 |
1637 | | - |
1638 | case QEvent::MouseButtonDblClick: | - |
1639 | mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev)); executed (the execution status of this line is deduced): mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev)); | - |
1640 | break; executed: break; Execution Count:19 | 19 |
1641 | | - |
1642 | case QEvent::TouchBegin: | - |
1643 | case QEvent::TouchUpdate: | - |
1644 | case QEvent::TouchEnd: | - |
1645 | case QEvent::TouchCancel: | - |
1646 | touchEvent(static_cast<QTouchEvent *>(ev)); executed (the execution status of this line is deduced): touchEvent(static_cast<QTouchEvent *>(ev)); | - |
1647 | break; executed: break; Execution Count:25 | 25 |
1648 | | - |
1649 | case QEvent::Move: | - |
1650 | moveEvent(static_cast<QMoveEvent*>(ev)); executed (the execution status of this line is deduced): moveEvent(static_cast<QMoveEvent*>(ev)); | - |
1651 | break; executed: break; Execution Count:5 | 5 |
1652 | | - |
1653 | case QEvent::Resize: | - |
1654 | resizeEvent(static_cast<QResizeEvent*>(ev)); executed (the execution status of this line is deduced): resizeEvent(static_cast<QResizeEvent*>(ev)); | - |
1655 | break; executed: break; Execution Count:46 | 46 |
1656 | | - |
1657 | case QEvent::KeyPress: | - |
1658 | keyPressEvent(static_cast<QKeyEvent *>(ev)); executed (the execution status of this line is deduced): keyPressEvent(static_cast<QKeyEvent *>(ev)); | - |
1659 | break; executed: break; Execution Count:7 | 7 |
1660 | | - |
1661 | case QEvent::KeyRelease: | - |
1662 | keyReleaseEvent(static_cast<QKeyEvent *>(ev)); executed (the execution status of this line is deduced): keyReleaseEvent(static_cast<QKeyEvent *>(ev)); | - |
1663 | break; executed: break; Execution Count:7 | 7 |
1664 | | - |
1665 | case QEvent::FocusIn: { | - |
1666 | focusInEvent(static_cast<QFocusEvent *>(ev)); executed (the execution status of this line is deduced): focusInEvent(static_cast<QFocusEvent *>(ev)); | - |
1667 | #ifndef QT_NO_ACCESSIBILITY | - |
1668 | QAccessible::State state; executed (the execution status of this line is deduced): QAccessible::State state; | - |
1669 | state.active = true; executed (the execution status of this line is deduced): state.active = true; | - |
1670 | QAccessibleStateChangeEvent event(this, state); executed (the execution status of this line is deduced): QAccessibleStateChangeEvent event(this, state); | - |
1671 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
1672 | #endif | - |
1673 | break; } executed: break; Execution Count:48 | 48 |
1674 | | - |
1675 | case QEvent::FocusOut: { | - |
1676 | focusOutEvent(static_cast<QFocusEvent *>(ev)); executed (the execution status of this line is deduced): focusOutEvent(static_cast<QFocusEvent *>(ev)); | - |
1677 | #ifndef QT_NO_ACCESSIBILITY | - |
1678 | QAccessible::State state; executed (the execution status of this line is deduced): QAccessible::State state; | - |
1679 | state.active = true; executed (the execution status of this line is deduced): state.active = true; | - |
1680 | QAccessibleStateChangeEvent event(this, state); executed (the execution status of this line is deduced): QAccessibleStateChangeEvent event(this, state); | - |
1681 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
1682 | #endif | - |
1683 | break; } executed: break; Execution Count:17 | 17 |
1684 | | - |
1685 | #ifndef QT_NO_WHEELEVENT | - |
1686 | case QEvent::Wheel: | - |
1687 | wheelEvent(static_cast<QWheelEvent*>(ev)); executed (the execution status of this line is deduced): wheelEvent(static_cast<QWheelEvent*>(ev)); | - |
1688 | break; executed: break; Execution Count:3 | 3 |
1689 | #endif | - |
1690 | | - |
1691 | case QEvent::Close: { | - |
1692 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1693 | bool wasVisible = isVisible(); never executed (the execution status of this line is deduced): bool wasVisible = isVisible(); | - |
1694 | destroy(); never executed (the execution status of this line is deduced): destroy(); | - |
1695 | if (wasVisible) never evaluated: wasVisible | 0 |
1696 | d->maybeQuitOnLastWindowClosed(); never executed: d->maybeQuitOnLastWindowClosed(); | 0 |
1697 | break; } | 0 |
1698 | | - |
1699 | case QEvent::Expose: | - |
1700 | exposeEvent(static_cast<QExposeEvent *>(ev)); executed (the execution status of this line is deduced): exposeEvent(static_cast<QExposeEvent *>(ev)); | - |
1701 | break; executed: break; Execution Count:94 | 94 |
1702 | | - |
1703 | case QEvent::Show: | - |
1704 | showEvent(static_cast<QShowEvent *>(ev)); executed (the execution status of this line is deduced): showEvent(static_cast<QShowEvent *>(ev)); | - |
1705 | break; executed: break; Execution Count:2615 | 2615 |
1706 | | - |
1707 | case QEvent::Hide: | - |
1708 | hideEvent(static_cast<QHideEvent *>(ev)); executed (the execution status of this line is deduced): hideEvent(static_cast<QHideEvent *>(ev)); | - |
1709 | break; executed: break; Execution Count:2579 | 2579 |
1710 | | - |
1711 | case QEvent::WindowStateChange: { | - |
1712 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1713 | emit windowStateChanged(d->windowState); executed (the execution status of this line is deduced): windowStateChanged(d->windowState); | - |
1714 | break; executed: break; Execution Count:48 | 48 |
1715 | } | - |
1716 | | - |
1717 | #ifndef QT_NO_TABLETEVENT | - |
1718 | case QEvent::TabletPress: | - |
1719 | case QEvent::TabletMove: | - |
1720 | case QEvent::TabletRelease: | - |
1721 | tabletEvent(static_cast<QTabletEvent *>(ev)); executed (the execution status of this line is deduced): tabletEvent(static_cast<QTabletEvent *>(ev)); | - |
1722 | break; executed: break; Execution Count:2 | 2 |
1723 | #endif | - |
1724 | | - |
1725 | default: | - |
1726 | return QObject::event(ev); executed: return QObject::event(ev); Execution Count:3893 | 3893 |
1727 | } | - |
1728 | return true; executed: return true; Execution Count:5637 | 5637 |
1729 | } | - |
1730 | | - |
1731 | /*! | - |
1732 | Override this to handle key press events (\a ev). | - |
1733 | | - |
1734 | \sa keyReleaseEvent() | - |
1735 | */ | - |
1736 | void QWindow::keyPressEvent(QKeyEvent *ev) | - |
1737 | { | - |
1738 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1739 | } executed: } Execution Count:6 | 6 |
1740 | | - |
1741 | /*! | - |
1742 | Override this to handle key release events (\a ev). | - |
1743 | | - |
1744 | \sa keyPressEvent() | - |
1745 | */ | - |
1746 | void QWindow::keyReleaseEvent(QKeyEvent *ev) | - |
1747 | { | - |
1748 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1749 | } executed: } Execution Count:6 | 6 |
1750 | | - |
1751 | /*! | - |
1752 | Override this to handle focus in events (\a ev). | - |
1753 | | - |
1754 | Focus in events are sent when the window receives keyboard focus. | - |
1755 | | - |
1756 | \sa focusOutEvent() | - |
1757 | */ | - |
1758 | void QWindow::focusInEvent(QFocusEvent *ev) | - |
1759 | { | - |
1760 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1761 | } executed: } Execution Count:48 | 48 |
1762 | | - |
1763 | /*! | - |
1764 | Override this to handle focus out events (\a ev). | - |
1765 | | - |
1766 | Focus out events are sent when the window loses keyboard focus. | - |
1767 | | - |
1768 | \sa focusInEvent() | - |
1769 | */ | - |
1770 | void QWindow::focusOutEvent(QFocusEvent *ev) | - |
1771 | { | - |
1772 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1773 | } executed: } Execution Count:14 | 14 |
1774 | | - |
1775 | /*! | - |
1776 | Override this to handle mouse press events (\a ev). | - |
1777 | | - |
1778 | \sa mouseReleaseEvent() | - |
1779 | */ | - |
1780 | void QWindow::mousePressEvent(QMouseEvent *ev) | - |
1781 | { | - |
1782 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1783 | } executed: } Execution Count:32 | 32 |
1784 | | - |
1785 | /*! | - |
1786 | Override this to handle mouse release events (\a ev). | - |
1787 | | - |
1788 | \sa mousePressEvent() | - |
1789 | */ | - |
1790 | void QWindow::mouseReleaseEvent(QMouseEvent *ev) | - |
1791 | { | - |
1792 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1793 | } executed: } Execution Count:32 | 32 |
1794 | | - |
1795 | /*! | - |
1796 | Override this to handle mouse double click events (\a ev). | - |
1797 | | - |
1798 | \sa mousePressEvent(), QStyleHints::mouseDoubleClickInterval() | - |
1799 | */ | - |
1800 | void QWindow::mouseDoubleClickEvent(QMouseEvent *ev) | - |
1801 | { | - |
1802 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1803 | } executed: } Execution Count:12 | 12 |
1804 | | - |
1805 | /*! | - |
1806 | Override this to handle mouse move events (\a ev). | - |
1807 | */ | - |
1808 | void QWindow::mouseMoveEvent(QMouseEvent *ev) | - |
1809 | { | - |
1810 | ev->ignore(); never executed (the execution status of this line is deduced): ev->ignore(); | - |
1811 | } | 0 |
1812 | | - |
1813 | #ifndef QT_NO_WHEELEVENT | - |
1814 | /*! | - |
1815 | Override this to handle mouse wheel or other wheel events (\a ev). | - |
1816 | */ | - |
1817 | void QWindow::wheelEvent(QWheelEvent *ev) | - |
1818 | { | - |
1819 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1820 | } executed: } Execution Count:3 | 3 |
1821 | #endif //QT_NO_WHEELEVENT | - |
1822 | | - |
1823 | /*! | - |
1824 | Override this to handle touch events (\a ev). | - |
1825 | */ | - |
1826 | void QWindow::touchEvent(QTouchEvent *ev) | - |
1827 | { | - |
1828 | ev->ignore(); never executed (the execution status of this line is deduced): ev->ignore(); | - |
1829 | } | 0 |
1830 | | - |
1831 | #ifndef QT_NO_TABLETEVENT | - |
1832 | /*! | - |
1833 | Override this to handle tablet press, move, and release events (\a ev). | - |
1834 | | - |
1835 | Proximity enter and leave events are not sent to windows, they are | - |
1836 | delivered to the application instance. | - |
1837 | */ | - |
1838 | void QWindow::tabletEvent(QTabletEvent *ev) | - |
1839 | { | - |
1840 | ev->ignore(); never executed (the execution status of this line is deduced): ev->ignore(); | - |
1841 | } | 0 |
1842 | #endif | - |
1843 | | - |
1844 | /*! | - |
1845 | Override this to handle platform dependent events. | - |
1846 | Will be given \a eventType, \a message and \a result. | - |
1847 | | - |
1848 | This might make your application non-portable. | - |
1849 | | - |
1850 | Should return true only if the event was handled. | - |
1851 | */ | - |
1852 | bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) | - |
1853 | { | - |
1854 | Q_UNUSED(eventType); executed (the execution status of this line is deduced): (void)eventType;; | - |
1855 | Q_UNUSED(message); executed (the execution status of this line is deduced): (void)message;; | - |
1856 | Q_UNUSED(result); executed (the execution status of this line is deduced): (void)result;; | - |
1857 | return false; executed: return false; Execution Count:1385 | 1385 |
1858 | } | - |
1859 | | - |
1860 | /*! | - |
1861 | \fn QPoint QWindow::mapToGlobal(const QPoint &pos) const | - |
1862 | | - |
1863 | Translates the window coordinate \a pos to global screen | - |
1864 | coordinates. For example, \c{mapToGlobal(QPoint(0,0))} would give | - |
1865 | the global coordinates of the top-left pixel of the window. | - |
1866 | | - |
1867 | \sa mapFromGlobal() | - |
1868 | */ | - |
1869 | QPoint QWindow::mapToGlobal(const QPoint &pos) const | - |
1870 | { | - |
1871 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1872 | if (d->platformWindow && d->platformWindow->isEmbedded(0)) evaluated: d->platformWindow yes Evaluation Count:13824 | yes Evaluation Count:4 |
partially evaluated: d->platformWindow->isEmbedded(0) no Evaluation Count:0 | yes Evaluation Count:13824 |
| 0-13824 |
1873 | return d->platformWindow->mapToGlobal(pos); never executed: return d->platformWindow->mapToGlobal(pos); | 0 |
1874 | else | - |
1875 | return pos + d_func()->globalPosition(); executed: return pos + d_func()->globalPosition(); Execution Count:13828 | 13828 |
1876 | } | - |
1877 | | - |
1878 | | - |
1879 | /*! | - |
1880 | \fn QPoint QWindow::mapFromGlobal(const QPoint &pos) const | - |
1881 | | - |
1882 | Translates the global screen coordinate \a pos to window | - |
1883 | coordinates. | - |
1884 | | - |
1885 | \sa mapToGlobal() | - |
1886 | */ | - |
1887 | QPoint QWindow::mapFromGlobal(const QPoint &pos) const | - |
1888 | { | - |
1889 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1890 | if (d->platformWindow && d->platformWindow->isEmbedded(0)) evaluated: d->platformWindow yes Evaluation Count:14679 | yes Evaluation Count:3 |
partially evaluated: d->platformWindow->isEmbedded(0) no Evaluation Count:0 | yes Evaluation Count:14679 |
| 0-14679 |
1891 | return d->platformWindow->mapFromGlobal(pos); never executed: return d->platformWindow->mapFromGlobal(pos); | 0 |
1892 | else | - |
1893 | return pos - d_func()->globalPosition(); executed: return pos - d_func()->globalPosition(); Execution Count:14682 | 14682 |
1894 | } | - |
1895 | | - |
1896 | | - |
1897 | Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window) | - |
1898 | { | - |
1899 | return window->d_func(); executed: return window->d_func(); Execution Count:20185 | 20185 |
1900 | } | - |
1901 | | - |
1902 | void QWindowPrivate::maybeQuitOnLastWindowClosed() | - |
1903 | { | - |
1904 | Q_Q(QWindow); executed (the execution status of this line is deduced): QWindow * const q = q_func(); | - |
1905 | | - |
1906 | // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent | - |
1907 | bool quitOnClose = QGuiApplication::quitOnLastWindowClosed() && !q->parent(); partially evaluated: QGuiApplication::quitOnLastWindowClosed() yes Evaluation Count:7 | no Evaluation Count:0 |
partially evaluated: !q->parent() yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
1908 | | - |
1909 | if (quitOnClose) { partially evaluated: quitOnClose yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
1910 | QWindowList list = QGuiApplication::topLevelWindows(); executed (the execution status of this line is deduced): QWindowList list = QGuiApplication::topLevelWindows(); | - |
1911 | bool lastWindowClosed = true; executed (the execution status of this line is deduced): bool lastWindowClosed = true; | - |
1912 | for (int i = 0; i < list.size(); ++i) { evaluated: i < list.size() yes Evaluation Count:4 | yes Evaluation Count:5 |
| 4-5 |
1913 | QWindow *w = list.at(i); executed (the execution status of this line is deduced): QWindow *w = list.at(i); | - |
1914 | if (!w->isVisible() || w->transientParent()) evaluated: !w->isVisible() yes Evaluation Count:1 | yes Evaluation Count:3 |
evaluated: w->transientParent() yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-3 |
1915 | continue; executed: continue; Execution Count:2 | 2 |
1916 | lastWindowClosed = false; executed (the execution status of this line is deduced): lastWindowClosed = false; | - |
1917 | break; executed: break; Execution Count:2 | 2 |
1918 | } | - |
1919 | if (lastWindowClosed) { evaluated: lastWindowClosed yes Evaluation Count:5 | yes Evaluation Count:2 |
| 2-5 |
1920 | QGuiApplicationPrivate::emitLastWindowClosed(); executed (the execution status of this line is deduced): QGuiApplicationPrivate::emitLastWindowClosed(); | - |
1921 | QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance())); executed (the execution status of this line is deduced): QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance())); | - |
1922 | applicationPrivate->maybeQuit(); executed (the execution status of this line is deduced): applicationPrivate->maybeQuit(); | - |
1923 | } executed: } Execution Count:5 | 5 |
1924 | } executed: } Execution Count:7 | 7 |
1925 | | - |
1926 | } executed: } Execution Count:7 | 7 |
1927 | | - |
1928 | #ifndef QT_NO_CURSOR | - |
1929 | /*! | - |
1930 | \brief set the cursor shape for this window | - |
1931 | | - |
1932 | The mouse \a cursor will assume this shape when it is over this | - |
1933 | window, unless an override cursor is set. | - |
1934 | See the \l{Qt::CursorShape}{list of predefined cursor objects} for a | - |
1935 | range of useful shapes. | - |
1936 | | - |
1937 | By default, the cursor has the Qt::ArrowCursor shape. | - |
1938 | | - |
1939 | Some underlying window implementations will reset the cursor if it | - |
1940 | leaves a window even if the mouse is grabbed. If you want to have | - |
1941 | a cursor set for all windows, even when outside the window, consider | - |
1942 | QGuiApplication::setOverrideCursor(). | - |
1943 | | - |
1944 | \sa QGuiApplication::setOverrideCursor() | - |
1945 | */ | - |
1946 | void QWindow::setCursor(const QCursor &cursor) | - |
1947 | { | - |
1948 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1949 | d->cursor = cursor; executed (the execution status of this line is deduced): d->cursor = cursor; | - |
1950 | // Only attempt to set cursor and emit signal if there is an actual platform cursor | - |
1951 | if (d->screen->handle()->cursor()) { partially evaluated: d->screen->handle()->cursor() yes Evaluation Count:3775 | no Evaluation Count:0 |
| 0-3775 |
1952 | d->applyCursor(); executed (the execution status of this line is deduced): d->applyCursor(); | - |
1953 | QEvent event(QEvent::CursorChange); executed (the execution status of this line is deduced): QEvent event(QEvent::CursorChange); | - |
1954 | QGuiApplication::sendEvent(this, &event); executed (the execution status of this line is deduced): QGuiApplication::sendEvent(this, &event); | - |
1955 | } executed: } Execution Count:3775 | 3775 |
1956 | } executed: } Execution Count:3775 | 3775 |
1957 | | - |
1958 | /*! | - |
1959 | \brief Restores the default arrow cursor for this window. | - |
1960 | */ | - |
1961 | void QWindow::unsetCursor() | - |
1962 | { | - |
1963 | setCursor(Qt::ArrowCursor); never executed (the execution status of this line is deduced): setCursor(Qt::ArrowCursor); | - |
1964 | } | 0 |
1965 | | - |
1966 | /*! | - |
1967 | \brief the cursor shape for this window | - |
1968 | | - |
1969 | \sa setCursor(), unsetCursor() | - |
1970 | */ | - |
1971 | QCursor QWindow::cursor() const | - |
1972 | { | - |
1973 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1974 | return d->cursor; executed: return d->cursor; Execution Count:70 | 70 |
1975 | } | - |
1976 | | - |
1977 | void QWindowPrivate::applyCursor() | - |
1978 | { | - |
1979 | Q_Q(QWindow); executed (the execution status of this line is deduced): QWindow * const q = q_func(); | - |
1980 | if (platformWindow) { partially evaluated: platformWindow yes Evaluation Count:6390 | no Evaluation Count:0 |
| 0-6390 |
1981 | if (QPlatformCursor *platformCursor = screen->handle()->cursor()) { partially evaluated: QPlatformCursor *platformCursor = screen->handle()->cursor() yes Evaluation Count:6390 | no Evaluation Count:0 |
| 0-6390 |
1982 | QCursor *oc = QGuiApplication::overrideCursor(); executed (the execution status of this line is deduced): QCursor *oc = QGuiApplication::overrideCursor(); | - |
1983 | QCursor c = oc ? *oc : cursor; evaluated: oc yes Evaluation Count:2 | yes Evaluation Count:6388 |
| 2-6388 |
1984 | platformCursor->changeCursor(&c, q); executed (the execution status of this line is deduced): platformCursor->changeCursor(&c, q); | - |
1985 | } executed: } Execution Count:6390 | 6390 |
1986 | } executed: } Execution Count:6390 | 6390 |
1987 | } executed: } Execution Count:6390 | 6390 |
1988 | #endif // QT_NO_CURSOR | - |
1989 | | - |
1990 | QT_END_NAMESPACE | - |
1991 | | - |
| | |