Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2012 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:2276 | no Evaluation Count:0 |
| 0-2276 |
145 | d->screen = QGuiApplication::primaryScreen(); executed: d->screen = QGuiApplication::primaryScreen(); Execution Count:2276 | 2276 |
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:2276 | 2276 |
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); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
196 | d->parentWindow = parent; never executed (the execution status of this line is deduced): d->parentWindow = parent; | - |
197 | if (parent) | 0 |
198 | d->screen = parent->screen(); never executed: d->screen = parent->screen(); | 0 |
199 | if (!d->screen) never evaluated: !d->screen | 0 |
200 | d->screen = QGuiApplication::primaryScreen(); never executed: d->screen = QGuiApplication::primaryScreen(); | 0 |
201 | 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*)"); | - |
202 | QGuiApplicationPrivate::window_list.prepend(this); never executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.prepend(this); | - |
203 | } | 0 |
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:603 | yes Evaluation Count:1607 |
| 603-1607 |
211 | QGuiApplicationPrivate::focus_window = 0; executed: QGuiApplicationPrivate::focus_window = 0; Execution Count:603 | 603 |
212 | if (QGuiApplicationPrivate::currentMouseWindow == this) evaluated: QGuiApplicationPrivate::currentMouseWindow == this yes Evaluation Count:366 | yes Evaluation Count:1844 |
| 366-1844 |
213 | QGuiApplicationPrivate::currentMouseWindow = 0; executed: QGuiApplicationPrivate::currentMouseWindow = 0; Execution Count:366 | 366 |
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:2210 | 2210 |
217 | | - |
218 | /*! | - |
219 | Set 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:1544 | 1544 |
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:4330 | yes Evaluation Count:3148 |
| 3148-4330 |
264 | return; executed: return; Execution Count:4330 | 4330 |
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:3095 |
| 53-3095 |
269 | create(); executed: create(); Execution Count:53 | 53 |
270 | | - |
271 | if (visible) { evaluated: visible yes Evaluation Count:1590 | yes Evaluation Count:1558 |
| 1558-1590 |
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:1590 | 1590 |
278 | | - |
279 | if (isModal()) { evaluated: isModal() yes Evaluation Count:212 | yes Evaluation Count:2936 |
| 212-2936 |
280 | if (visible) evaluated: visible yes Evaluation Count:106 | yes Evaluation Count:106 |
| 106 |
281 | QGuiApplicationPrivate::showModalWindow(this); executed: QGuiApplicationPrivate::showModalWindow(this); Execution Count:106 | 106 |
282 | else | - |
283 | QGuiApplicationPrivate::hideModalWindow(this); executed: QGuiApplicationPrivate::hideModalWindow(this); Execution Count:106 | 106 |
284 | } | - |
285 | | - |
286 | #ifndef QT_NO_CURSOR | - |
287 | if (visible) evaluated: visible yes Evaluation Count:1590 | yes Evaluation Count:1558 |
| 1558-1590 |
288 | d->applyCursor(); executed: d->applyCursor(); Execution Count:1590 | 1590 |
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:1558 | yes Evaluation Count:1590 |
| 1558-1590 |
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:1558 | 1558 |
296 | } executed: } Execution Count:3148 | 3148 |
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:58 | 58 |
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:1649 | yes Evaluation Count:3 |
| 3-1649 |
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:1645 |
| 1-1645 |
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:1645 | 1645 |
334 | } executed: } Execution Count:1648 | 1648 |
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:1690 |
| 0-1690 |
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:1690 | 1690 |
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:23195 | 23195 |
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:5 | yes Evaluation Count:121 |
| 5-121 |
381 | if (parent && parent->d_func()->platformWindow) { evaluated: parent yes Evaluation Count:2 | yes Evaluation Count:3 |
partially evaluated: parent->d_func()->platformWindow yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-3 |
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:2 | 2 |
384 | d->platformWindow->setParent(0); executed (the execution status of this line is deduced): d->platformWindow->setParent(0); | - |
385 | } executed: } Execution Count:3 | 3 |
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:126 | 126 |
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:1748 | 1748 |
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:3148 | 3148 |
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:3581 | 3581 |
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:1513 | yes Evaluation Count:137 |
| 137-1513 |
436 | return; executed: return; Execution Count:1513 | 1513 |
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:137 | 137 |
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:3 | 3 |
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:1544 | 1544 |
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); never executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
500 | if (d->platformWindow) never evaluated: d->platformWindow | 0 |
501 | return d->platformWindow->format(); never executed: return d->platformWindow->format(); | 0 |
502 | return d->requestedFormat; never executed: return d->requestedFormat; | 0 |
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:7 | yes Evaluation Count:1628 |
| 7-1628 |
520 | d->platformWindow->setWindowFlags(flags); executed: d->platformWindow->setWindowFlags(flags); Execution Count:7 | 7 |
521 | d->windowFlags = flags; executed (the execution status of this line is deduced): d->windowFlags = flags; | - |
522 | } executed: } Execution Count:1635 | 1635 |
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:15690 | 15690 |
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:14043 | 14043 |
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:1971 | no Evaluation Count:0 |
| 0-1971 |
560 | d->platformWindow->setWindowTitle(title); executed: d->platformWindow->setWindowTitle(title); Execution Count:1971 | 1971 |
561 | } executed: } Execution Count:1971 | 1971 |
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:1544 | 1544 |
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 set 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:1485 | yes Evaluation Count:124 |
| 124-1485 |
606 | d->platformWindow->setWindowIcon(icon); executed: d->platformWindow->setWindowIcon(icon); Execution Count:1485 | 1485 |
607 | } executed: } Execution Count:1609 | 1609 |
608 | | - |
609 | /*! | - |
610 | \brief set 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:92 | no Evaluation Count:0 |
| 0-92 |
629 | d->platformWindow->raise(); executed: d->platformWindow->raise(); Execution Count:92 | 92 |
630 | } executed: } Execution Count:92 | 92 |
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); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
640 | if (d->platformWindow) never evaluated: d->platformWindow | 0 |
641 | d->platformWindow->lower(); never executed: d->platformWindow->lower(); | 0 |
642 | } | 0 |
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:272 | yes Evaluation Count:2 |
| 2-272 |
658 | return; executed: return; Execution Count:272 | 272 |
659 | d->opacity = level; executed (the execution status of this line is deduced): d->opacity = level; | - |
660 | if (d->platformWindow) partially evaluated: d->platformWindow no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
661 | d->platformWindow->setOpacity(level); never executed: d->platformWindow->setOpacity(level); | 0 |
662 | } executed: } Execution Count:2 | 2 |
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:227 | no Evaluation Count:0 |
| 0-227 |
673 | d->platformWindow->requestActivateWindow(); executed: d->platformWindow->requestActivateWindow(); Execution Count:227 | 227 |
674 | } executed: } Execution Count:227 | 227 |
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:3354 | 3354 |
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:301 |
| 0-301 |
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:89 | yes Evaluation Count:212 |
| 89-212 |
711 | return false; executed: return false; Execution Count:89 | 89 |
712 | | - |
713 | if (focus == this) evaluated: focus == this yes Evaluation Count:198 | yes Evaluation Count:14 |
| 14-198 |
714 | return true; executed: return true; Execution Count:198 | 198 |
715 | | - |
716 | if (!parent() && !transientParent()) { evaluated: !parent() yes Evaluation Count:12 | yes Evaluation Count:2 |
evaluated: !transientParent() yes Evaluation Count:9 | yes Evaluation Count:3 |
| 2-12 |
717 | return isAncestorOf(focus); executed: return isAncestorOf(focus); Execution Count:9 | 9 |
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 QWindow::devicePixelRatio(); | - |
769 | \sa QGuiApplicaiton::devicePixelRatio(); | - |
770 | */ | - |
771 | qreal QWindow::devicePixelRatio() const | - |
772 | { | - |
773 | Q_D(const QWindow); never executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
774 | if (!d->platformWindow) never evaluated: !d->platformWindow | 0 |
775 | return 1.0; never executed: return 1.0; | 0 |
776 | return d->platformWindow->devicePixelRatio(); never executed: return d->platformWindow->devicePixelRatio(); | 0 |
777 | } | - |
778 | | - |
779 | /*! | - |
780 | \brief set the screen-occupation state of the window | - |
781 | | - |
782 | The window \a state represents whether the window appears in the | - |
783 | windowing system as maximized, minimized, fullscreen, or normal. | - |
784 | | - |
785 | The enum value Qt::WindowActive is not an accepted parameter. | - |
786 | | - |
787 | \sa showNormal(), showFullScreen(), showMinimized(), showMaximized() | - |
788 | */ | - |
789 | void QWindow::setWindowState(Qt::WindowState state) | - |
790 | { | - |
791 | if (state == Qt::WindowActive) { partially evaluated: state == Qt::WindowActive no Evaluation Count:0 | yes Evaluation Count:87 |
| 0-87 |
792 | qWarning() << "QWindow::setWindowState does not accept Qt::WindowActive"; never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwindow.cpp", 792, __PRETTY_FUNCTION__).warning() << "QWindow::setWindowState does not accept Qt::WindowActive"; | - |
793 | return; | 0 |
794 | } | - |
795 | | - |
796 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
797 | if (d->platformWindow) evaluated: d->platformWindow yes Evaluation Count:34 | yes Evaluation Count:53 |
| 34-53 |
798 | d->platformWindow->setWindowState(state); executed: d->platformWindow->setWindowState(state); Execution Count:34 | 34 |
799 | d->windowState = state; executed (the execution status of this line is deduced): d->windowState = state; | - |
800 | emit windowStateChanged(d->windowState); executed (the execution status of this line is deduced): windowStateChanged(d->windowState); | - |
801 | } executed: } Execution Count:87 | 87 |
802 | | - |
803 | /*! | - |
804 | \brief the screen-occupation state of the window | - |
805 | | - |
806 | \sa setWindowState() | - |
807 | */ | - |
808 | Qt::WindowState QWindow::windowState() const | - |
809 | { | - |
810 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
811 | return d->windowState; executed: return d->windowState; Execution Count:7718 | 7718 |
812 | } | - |
813 | | - |
814 | /*! | - |
815 | \fn QWindow::windowStateChanged(Qt::WindowState windowState) | - |
816 | | - |
817 | This signal is emitted when the \a windowState changes, either | - |
818 | by being set explicitly with setWindowState(), or automatically when | - |
819 | the user clicks one of the titlebar buttons or by other means. | - |
820 | */ | - |
821 | | - |
822 | /*! | - |
823 | Sets the transient \a parent | - |
824 | | - |
825 | This is a hint to the window manager that this window is a dialog or pop-up | - |
826 | on behalf of the given window. | - |
827 | | - |
828 | \sa transientParent(), parent() | - |
829 | */ | - |
830 | void QWindow::setTransientParent(QWindow *parent) | - |
831 | { | - |
832 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
833 | d->transientParent = parent; executed (the execution status of this line is deduced): d->transientParent = parent; | - |
834 | | - |
835 | QGuiApplicationPrivate::updateBlockedStatus(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::updateBlockedStatus(this); | - |
836 | } executed: } Execution Count:127 | 127 |
837 | | - |
838 | /*! | - |
839 | Returns the transient parent of the window. | - |
840 | | - |
841 | \sa setTransientParent(), parent() | - |
842 | */ | - |
843 | QWindow *QWindow::transientParent() const | - |
844 | { | - |
845 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
846 | return d->transientParent.data(); executed: return d->transientParent.data(); Execution Count:739 | 739 |
847 | } | - |
848 | | - |
849 | /*! | - |
850 | \enum QWindow::AncestorMode | - |
851 | | - |
852 | This enum is used to control whether or not transient parents | - |
853 | should be considered ancestors. | - |
854 | | - |
855 | \value ExcludeTransients Transient parents are not considered ancestors. | - |
856 | \value IncludeTransients Transient parents are considered ancestors. | - |
857 | */ | - |
858 | | - |
859 | /*! | - |
860 | Returns true if the window is an ancestor of the given \a child. If \a mode | - |
861 | is IncludeTransients, then transient parents are also considered ancestors. | - |
862 | */ | - |
863 | bool QWindow::isAncestorOf(const QWindow *child, AncestorMode mode) const | - |
864 | { | - |
865 | if (child->parent() == this || (mode == IncludeTransients && child->transientParent() == this)) evaluated: child->parent() == this yes Evaluation Count:1 | yes Evaluation Count:8 |
partially evaluated: mode == IncludeTransients yes Evaluation Count:8 | no Evaluation Count:0 |
evaluated: child->transientParent() == this yes Evaluation Count:2 | yes Evaluation Count:6 |
| 0-8 |
866 | return true; executed: return true; Execution Count:3 | 3 |
867 | | - |
868 | 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:6 | 6 |
869 | || (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:6 | 6 |
870 | } | - |
871 | | - |
872 | /*! | - |
873 | Returns the minimum size of the window. | - |
874 | | - |
875 | \sa setMinimumSize() | - |
876 | */ | - |
877 | QSize QWindow::minimumSize() const | - |
878 | { | - |
879 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
880 | return d->minimumSize; executed: return d->minimumSize; Execution Count:6801 | 6801 |
881 | } | - |
882 | | - |
883 | /*! | - |
884 | Returns the maximum size of the window. | - |
885 | | - |
886 | \sa setMaximumSize() | - |
887 | */ | - |
888 | QSize QWindow::maximumSize() const | - |
889 | { | - |
890 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
891 | return d->maximumSize; executed: return d->maximumSize; Execution Count:6802 | 6802 |
892 | } | - |
893 | | - |
894 | /*! | - |
895 | Returns the base size of the window. | - |
896 | | - |
897 | \sa setBaseSize() | - |
898 | */ | - |
899 | QSize QWindow::baseSize() const | - |
900 | { | - |
901 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
902 | return d->baseSize; executed: return d->baseSize; Execution Count:5205 | 5205 |
903 | } | - |
904 | | - |
905 | /*! | - |
906 | Returns the size increment of the window. | - |
907 | | - |
908 | \sa setSizeIncrement() | - |
909 | */ | - |
910 | QSize QWindow::sizeIncrement() const | - |
911 | { | - |
912 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
913 | return d->sizeIncrement; executed: return d->sizeIncrement; Execution Count:5205 | 5205 |
914 | } | - |
915 | | - |
916 | /*! | - |
917 | Sets the minimum size of the window. | - |
918 | | - |
919 | This is a hint to the window manager to prevent resizing below the specified \a size. | - |
920 | | - |
921 | \sa setMaximumSize(), minimumSize() | - |
922 | */ | - |
923 | void QWindow::setMinimumSize(const QSize &size) | - |
924 | { | - |
925 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
926 | 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))); | - |
927 | if (d->minimumSize == adjustedSize) partially evaluated: d->minimumSize == adjustedSize no Evaluation Count:0 | yes Evaluation Count:187 |
| 0-187 |
928 | return; | 0 |
929 | QSize oldSize = d->minimumSize; executed (the execution status of this line is deduced): QSize oldSize = d->minimumSize; | - |
930 | d->minimumSize = adjustedSize; executed (the execution status of this line is deduced): d->minimumSize = adjustedSize; | - |
931 | if (d->platformWindow && isTopLevel()) partially evaluated: d->platformWindow no Evaluation Count:0 | yes Evaluation Count:187 |
never evaluated: isTopLevel() | 0-187 |
932 | d->platformWindow->propagateSizeHints(); never executed: d->platformWindow->propagateSizeHints(); | 0 |
933 | if (d->minimumSize.width() != oldSize.width()) evaluated: d->minimumSize.width() != oldSize.width() yes Evaluation Count:185 | yes Evaluation Count:2 |
| 2-185 |
934 | emit minimumWidthChanged(d->minimumSize.width()); executed: minimumWidthChanged(d->minimumSize.width()); Execution Count:185 | 185 |
935 | if (d->minimumSize.height() != oldSize.height()) evaluated: d->minimumSize.height() != oldSize.height() yes Evaluation Count:185 | yes Evaluation Count:2 |
| 2-185 |
936 | emit minimumHeightChanged(d->minimumSize.height()); executed: minimumHeightChanged(d->minimumSize.height()); Execution Count:185 | 185 |
937 | } executed: } Execution Count:187 | 187 |
938 | | - |
939 | /*! | - |
940 | \property QWindow::x | - |
941 | \brief the x position of the window's geometry | - |
942 | */ | - |
943 | void QWindow::setX(int arg) | - |
944 | { | - |
945 | if (x() != arg) never evaluated: x() != arg | 0 |
946 | setGeometry(QRect(arg, y(), width(), height())); never executed: setGeometry(QRect(arg, y(), width(), height())); | 0 |
947 | } | 0 |
948 | | - |
949 | /*! | - |
950 | \property QWindow::y | - |
951 | \brief the y position of the window's geometry | - |
952 | */ | - |
953 | void QWindow::setY(int arg) | - |
954 | { | - |
955 | if (y() != arg) never evaluated: y() != arg | 0 |
956 | setGeometry(QRect(x(), arg, width(), height())); never executed: setGeometry(QRect(x(), arg, width(), height())); | 0 |
957 | } | 0 |
958 | | - |
959 | /*! | - |
960 | \property QWindow::width | - |
961 | \brief the width of the window's geometry | - |
962 | */ | - |
963 | void QWindow::setWidth(int arg) | - |
964 | { | - |
965 | if (width() != arg) never evaluated: width() != arg | 0 |
966 | setGeometry(QRect(x(), y(), arg, height())); never executed: setGeometry(QRect(x(), y(), arg, height())); | 0 |
967 | } | 0 |
968 | | - |
969 | /*! | - |
970 | \property QWindow::height | - |
971 | \brief the height of the window's geometry | - |
972 | */ | - |
973 | void QWindow::setHeight(int arg) | - |
974 | { | - |
975 | if (height() != arg) never evaluated: height() != arg | 0 |
976 | setGeometry(QRect(x(), y(), width(), arg)); never executed: setGeometry(QRect(x(), y(), width(), arg)); | 0 |
977 | } | 0 |
978 | | - |
979 | /*! | - |
980 | \property QWindow::minimumWidth | - |
981 | \brief the minimum width of the window's geometry | - |
982 | */ | - |
983 | void QWindow::setMinimumWidth(int w) | - |
984 | { | - |
985 | setMinimumSize(QSize(w, minimumHeight())); executed (the execution status of this line is deduced): setMinimumSize(QSize(w, minimumHeight())); | - |
986 | } executed: } Execution Count:1 | 1 |
987 | | - |
988 | /*! | - |
989 | \property QWindow::minimumHeight | - |
990 | \brief the minimum height of the window's geometry | - |
991 | */ | - |
992 | void QWindow::setMinimumHeight(int h) | - |
993 | { | - |
994 | setMinimumSize(QSize(minimumWidth(), h)); executed (the execution status of this line is deduced): setMinimumSize(QSize(minimumWidth(), h)); | - |
995 | } executed: } Execution Count:1 | 1 |
996 | | - |
997 | /*! | - |
998 | Sets the maximum size of the window. | - |
999 | | - |
1000 | This is a hint to the window manager to prevent resizing above the specified \a size. | - |
1001 | | - |
1002 | \sa setMinimumSize(), maximumSize() | - |
1003 | */ | - |
1004 | void QWindow::setMaximumSize(const QSize &size) | - |
1005 | { | - |
1006 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1007 | 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))); | - |
1008 | if (d->maximumSize == adjustedSize) partially evaluated: d->maximumSize == adjustedSize no Evaluation Count:0 | yes Evaluation Count:183 |
| 0-183 |
1009 | return; | 0 |
1010 | QSize oldSize = d->maximumSize; executed (the execution status of this line is deduced): QSize oldSize = d->maximumSize; | - |
1011 | d->maximumSize = adjustedSize; executed (the execution status of this line is deduced): d->maximumSize = adjustedSize; | - |
1012 | if (d->platformWindow && isTopLevel()) partially evaluated: d->platformWindow no Evaluation Count:0 | yes Evaluation Count:183 |
never evaluated: isTopLevel() | 0-183 |
1013 | d->platformWindow->propagateSizeHints(); never executed: d->platformWindow->propagateSizeHints(); | 0 |
1014 | if (d->maximumSize.width() != oldSize.width()) evaluated: d->maximumSize.width() != oldSize.width() yes Evaluation Count:181 | yes Evaluation Count:2 |
| 2-181 |
1015 | emit maximumWidthChanged(d->maximumSize.width()); executed: maximumWidthChanged(d->maximumSize.width()); Execution Count:181 | 181 |
1016 | if (d->maximumSize.height() != oldSize.height()) evaluated: d->maximumSize.height() != oldSize.height() yes Evaluation Count:181 | yes Evaluation Count:2 |
| 2-181 |
1017 | emit maximumHeightChanged(d->maximumSize.height()); executed: maximumHeightChanged(d->maximumSize.height()); Execution Count:181 | 181 |
1018 | } executed: } Execution Count:183 | 183 |
1019 | | - |
1020 | /*! | - |
1021 | \property QWindow::maximumWidth | - |
1022 | \brief the maximum width of the window's geometry | - |
1023 | */ | - |
1024 | void QWindow::setMaximumWidth(int w) | - |
1025 | { | - |
1026 | setMaximumSize(QSize(w, maximumHeight())); executed (the execution status of this line is deduced): setMaximumSize(QSize(w, maximumHeight())); | - |
1027 | } executed: } Execution Count:1 | 1 |
1028 | | - |
1029 | /*! | - |
1030 | \property QWindow::maximumHeight | - |
1031 | \brief the maximum height of the window's geometry | - |
1032 | */ | - |
1033 | void QWindow::setMaximumHeight(int h) | - |
1034 | { | - |
1035 | setMaximumSize(QSize(maximumWidth(), h)); executed (the execution status of this line is deduced): setMaximumSize(QSize(maximumWidth(), h)); | - |
1036 | } executed: } Execution Count:1 | 1 |
1037 | | - |
1038 | /*! | - |
1039 | Sets the base \a size of the window. | - |
1040 | | - |
1041 | The base size is used to calculate a proper window size if the | - |
1042 | window defines sizeIncrement(). | - |
1043 | | - |
1044 | \sa setMinimumSize(), setMaximumSize(), setSizeIncrement(), baseSize() | - |
1045 | */ | - |
1046 | void QWindow::setBaseSize(const QSize &size) | - |
1047 | { | - |
1048 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1049 | if (d->baseSize == size) never evaluated: d->baseSize == size | 0 |
1050 | return; | 0 |
1051 | d->baseSize = size; never executed (the execution status of this line is deduced): d->baseSize = size; | - |
1052 | if (d->platformWindow && isTopLevel()) never evaluated: d->platformWindow never evaluated: isTopLevel() | 0 |
1053 | d->platformWindow->propagateSizeHints(); never executed: d->platformWindow->propagateSizeHints(); | 0 |
1054 | } | 0 |
1055 | | - |
1056 | /*! | - |
1057 | Sets the size increment (\a size) of the window. | - |
1058 | | - |
1059 | When the user resizes the window, the size will move in steps of | - |
1060 | sizeIncrement().width() pixels horizontally and | - |
1061 | sizeIncrement().height() pixels vertically, with baseSize() as the | - |
1062 | basis. | - |
1063 | | - |
1064 | By default, this property contains a size with zero width and height. | - |
1065 | | - |
1066 | The windowing system might not support size increments. | - |
1067 | | - |
1068 | \sa setBaseSize(), setMinimumSize(), setMaximumSize() | - |
1069 | */ | - |
1070 | void QWindow::setSizeIncrement(const QSize &size) | - |
1071 | { | - |
1072 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1073 | if (d->sizeIncrement == size) never evaluated: d->sizeIncrement == size | 0 |
1074 | return; | 0 |
1075 | d->sizeIncrement = size; never executed (the execution status of this line is deduced): d->sizeIncrement = size; | - |
1076 | if (d->platformWindow && isTopLevel()) never evaluated: d->platformWindow never evaluated: isTopLevel() | 0 |
1077 | d->platformWindow->propagateSizeHints(); never executed: d->platformWindow->propagateSizeHints(); | 0 |
1078 | } | 0 |
1079 | | - |
1080 | /*! | - |
1081 | Sets the geometry of the window, excluding its window frame, to a | - |
1082 | rectangle constructed from \a posx, \a posy, \a w and \a h. | - |
1083 | | - |
1084 | \sa geometry() | - |
1085 | */ | - |
1086 | void QWindow::setGeometry(int posx, int posy, int w, int h) | - |
1087 | { | - |
1088 | setGeometry(QRect(posx, posy, w, h)); executed (the execution status of this line is deduced): setGeometry(QRect(posx, posy, w, h)); | - |
1089 | } executed: } Execution Count:22 | 22 |
1090 | | - |
1091 | /*! | - |
1092 | \brief Sets the geometry of the window, excluding its window frame, to \a rect. | - |
1093 | | - |
1094 | \sa geometry() | - |
1095 | */ | - |
1096 | void QWindow::setGeometry(const QRect &rect) | - |
1097 | { | - |
1098 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1099 | if (rect == geometry()) evaluated: rect == geometry() yes Evaluation Count:8 | yes Evaluation Count:3128 |
| 8-3128 |
1100 | return; executed: return; Execution Count:8 | 8 |
1101 | QRect oldRect = geometry(); executed (the execution status of this line is deduced): QRect oldRect = geometry(); | - |
1102 | | - |
1103 | d->positionPolicy = QWindowPrivate::WindowFrameExclusive; executed (the execution status of this line is deduced): d->positionPolicy = QWindowPrivate::WindowFrameExclusive; | - |
1104 | if (d->platformWindow) { evaluated: d->platformWindow yes Evaluation Count:1508 | yes Evaluation Count:1620 |
| 1508-1620 |
1105 | d->platformWindow->setGeometry(rect); executed (the execution status of this line is deduced): d->platformWindow->setGeometry(rect); | - |
1106 | } else { executed: } Execution Count:1508 | 1508 |
1107 | d->geometry = rect; executed (the execution status of this line is deduced): d->geometry = rect; | - |
1108 | | - |
1109 | if (rect.x() != oldRect.x()) evaluated: rect.x() != oldRect.x() yes Evaluation Count:256 | yes Evaluation Count:1364 |
| 256-1364 |
1110 | emit xChanged(rect.x()); executed: xChanged(rect.x()); Execution Count:256 | 256 |
1111 | if (rect.y() != oldRect.y()) evaluated: rect.y() != oldRect.y() yes Evaluation Count:259 | yes Evaluation Count:1361 |
| 259-1361 |
1112 | emit yChanged(rect.y()); executed: yChanged(rect.y()); Execution Count:259 | 259 |
1113 | if (rect.width() != oldRect.width()) partially evaluated: rect.width() != oldRect.width() yes Evaluation Count:1620 | no Evaluation Count:0 |
| 0-1620 |
1114 | emit widthChanged(rect.width()); executed: widthChanged(rect.width()); Execution Count:1620 | 1620 |
1115 | if (rect.height() != oldRect.height()) partially evaluated: rect.height() != oldRect.height() yes Evaluation Count:1620 | no Evaluation Count:0 |
| 0-1620 |
1116 | emit heightChanged(rect.height()); executed: heightChanged(rect.height()); Execution Count:1620 | 1620 |
1117 | } executed: } Execution Count:1620 | 1620 |
1118 | } | - |
1119 | | - |
1120 | /*! | - |
1121 | Returns the geometry of the window, excluding its window frame. | - |
1122 | | - |
1123 | \sa frameMargins(), frameGeometry() | - |
1124 | */ | - |
1125 | QRect QWindow::geometry() const | - |
1126 | { | - |
1127 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1128 | if (d->platformWindow) evaluated: d->platformWindow yes Evaluation Count:33632 | yes Evaluation Count:6448 |
| 6448-33632 |
1129 | return d->platformWindow->geometry(); executed: return d->platformWindow->geometry(); Execution Count:33632 | 33632 |
1130 | return d->geometry; executed: return d->geometry; Execution Count:6448 | 6448 |
1131 | } | - |
1132 | | - |
1133 | /*! | - |
1134 | Returns the window frame margins surrounding the window. | - |
1135 | | - |
1136 | \sa geometry(), frameGeometry() | - |
1137 | */ | - |
1138 | QMargins QWindow::frameMargins() const | - |
1139 | { | - |
1140 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1141 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:1444 | no Evaluation Count:0 |
| 0-1444 |
1142 | return d->platformWindow->frameMargins(); executed: return d->platformWindow->frameMargins(); Execution Count:1444 | 1444 |
1143 | return QMargins(); never executed: return QMargins(); | 0 |
1144 | } | - |
1145 | | - |
1146 | /*! | - |
1147 | Returns the geometry of the window, including its window frame. | - |
1148 | | - |
1149 | \sa geometry(), frameMargins() | - |
1150 | */ | - |
1151 | QRect QWindow::frameGeometry() const | - |
1152 | { | - |
1153 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1154 | if (d->platformWindow) { partially evaluated: d->platformWindow yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1155 | QMargins m = frameMargins(); executed (the execution status of this line is deduced): QMargins m = frameMargins(); | - |
1156 | 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 |
1157 | } | - |
1158 | return d->geometry; never executed: return d->geometry; | 0 |
1159 | } | - |
1160 | | - |
1161 | /*! | - |
1162 | Returns the top left position of the window, including its window frame. | - |
1163 | | - |
1164 | This returns the same value as frameGeometry().topLeft(). | - |
1165 | | - |
1166 | \sa geometry(), frameGeometry() | - |
1167 | */ | - |
1168 | QPoint QWindow::framePosition() const | - |
1169 | { | - |
1170 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1171 | if (d->platformWindow) { partially evaluated: d->platformWindow yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
1172 | QMargins margins = frameMargins(); executed (the execution status of this line is deduced): QMargins margins = frameMargins(); | - |
1173 | 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 |
1174 | } | - |
1175 | return d->geometry.topLeft(); never executed: return d->geometry.topLeft(); | 0 |
1176 | } | - |
1177 | | - |
1178 | /*! | - |
1179 | Sets the upper left position of the window (\a point) including its window frame. | - |
1180 | | - |
1181 | \sa setGeometry(), frameGeometry() | - |
1182 | */ | - |
1183 | void QWindow::setFramePosition(const QPoint &point) | - |
1184 | { | - |
1185 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1186 | d->positionPolicy = QWindowPrivate::WindowFrameInclusive; executed (the execution status of this line is deduced): d->positionPolicy = QWindowPrivate::WindowFrameInclusive; | - |
1187 | if (d->platformWindow) { partially evaluated: d->platformWindow yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1188 | d->platformWindow->setGeometry(QRect(point, size())); executed (the execution status of this line is deduced): d->platformWindow->setGeometry(QRect(point, size())); | - |
1189 | } else { executed: } Execution Count:1 | 1 |
1190 | d->geometry.setTopLeft(point); never executed (the execution status of this line is deduced): d->geometry.setTopLeft(point); | - |
1191 | } | 0 |
1192 | } | - |
1193 | | - |
1194 | /*! | - |
1195 | \brief set the position of the window on the desktop to \a pt | - |
1196 | | - |
1197 | \sa position() | - |
1198 | */ | - |
1199 | void QWindow::setPosition(const QPoint &pt) | - |
1200 | { | - |
1201 | setGeometry(QRect(pt, size())); executed (the execution status of this line is deduced): setGeometry(QRect(pt, size())); | - |
1202 | } executed: } Execution Count:1 | 1 |
1203 | | - |
1204 | /*! | - |
1205 | \brief set the position of the window on the desktop to \a posx, \a posy | - |
1206 | | - |
1207 | \sa position() | - |
1208 | */ | - |
1209 | void QWindow::setPosition(int posx, int posy) | - |
1210 | { | - |
1211 | setPosition(QPoint(posx, posy)); never executed (the execution status of this line is deduced): setPosition(QPoint(posx, posy)); | - |
1212 | } | 0 |
1213 | | - |
1214 | /*! | - |
1215 | \fn QPoint QWindow::position() const | - |
1216 | \brief get the position of the window on the desktop excluding any window frame | - |
1217 | | - |
1218 | \sa setPosition() | - |
1219 | */ | - |
1220 | | - |
1221 | /*! | - |
1222 | \fn QSize QWindow::size() const | - |
1223 | \brief get the size of the window excluding any window frame | - |
1224 | | - |
1225 | \sa resize() | - |
1226 | */ | - |
1227 | | - |
1228 | /*! | - |
1229 | set the size of the window, excluding any window frame, to a QSize | - |
1230 | constructed from width \a w and height \a h | - |
1231 | | - |
1232 | \sa size(), geometry() | - |
1233 | */ | - |
1234 | void QWindow::resize(int w, int h) | - |
1235 | { | - |
1236 | resize(QSize(w, h)); never executed (the execution status of this line is deduced): resize(QSize(w, h)); | - |
1237 | } | 0 |
1238 | | - |
1239 | /*! | - |
1240 | \brief set the size of the window, excluding any window frame, to \a newSize | - |
1241 | | - |
1242 | \sa size(), geometry() | - |
1243 | */ | - |
1244 | void QWindow::resize(const QSize &newSize) | - |
1245 | { | - |
1246 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1247 | if (d->platformWindow) { never evaluated: d->platformWindow | 0 |
1248 | d->platformWindow->setGeometry(QRect(position(), newSize)); never executed (the execution status of this line is deduced): d->platformWindow->setGeometry(QRect(position(), newSize)); | - |
1249 | } else { | 0 |
1250 | d->geometry.setSize(newSize); never executed (the execution status of this line is deduced): d->geometry.setSize(newSize); | - |
1251 | } | 0 |
1252 | } | - |
1253 | | - |
1254 | /*! | - |
1255 | Releases the native platform resources associated with this window. | - |
1256 | | - |
1257 | \sa create() | - |
1258 | */ | - |
1259 | void QWindow::destroy() | - |
1260 | { | - |
1261 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1262 | QObjectList childrenWindows = children(); executed (the execution status of this line is deduced): QObjectList childrenWindows = children(); | - |
1263 | for (int i = 0; i < childrenWindows.size(); i++) { evaluated: i < childrenWindows.size() yes Evaluation Count:3 | yes Evaluation Count:4376 |
| 3-4376 |
1264 | QObject *object = childrenWindows.at(i); executed (the execution status of this line is deduced): QObject *object = childrenWindows.at(i); | - |
1265 | if (object->isWindowType()) { partially evaluated: object->isWindowType() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1266 | QWindow *w = static_cast<QWindow*>(object); executed (the execution status of this line is deduced): QWindow *w = static_cast<QWindow*>(object); | - |
1267 | QGuiApplicationPrivate::window_list.removeAll(w); executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.removeAll(w); | - |
1268 | w->destroy(); executed (the execution status of this line is deduced): w->destroy(); | - |
1269 | } executed: } Execution Count:3 | 3 |
1270 | } executed: } Execution Count:3 | 3 |
1271 | setVisible(false); executed (the execution status of this line is deduced): setVisible(false); | - |
1272 | delete d->platformWindow; executed (the execution status of this line is deduced): delete d->platformWindow; | - |
1273 | d->resizeEventPending = true; executed (the execution status of this line is deduced): d->resizeEventPending = true; | - |
1274 | d->receivedExpose = false; executed (the execution status of this line is deduced): d->receivedExpose = false; | - |
1275 | d->exposed = false; executed (the execution status of this line is deduced): d->exposed = false; | - |
1276 | d->platformWindow = 0; executed (the execution status of this line is deduced): d->platformWindow = 0; | - |
1277 | } executed: } Execution Count:4376 | 4376 |
1278 | | - |
1279 | /*! | - |
1280 | Returns the platform window corresponding to the window. | - |
1281 | | - |
1282 | \internal | - |
1283 | */ | - |
1284 | QPlatformWindow *QWindow::handle() const | - |
1285 | { | - |
1286 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1287 | return d->platformWindow; executed: return d->platformWindow; Execution Count:347027 | 347027 |
1288 | } | - |
1289 | | - |
1290 | /*! | - |
1291 | Returns the platform surface corresponding to the window. | - |
1292 | | - |
1293 | \internal | - |
1294 | */ | - |
1295 | QPlatformSurface *QWindow::surfaceHandle() const | - |
1296 | { | - |
1297 | Q_D(const QWindow); never executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1298 | return d->platformWindow; never executed: return d->platformWindow; | 0 |
1299 | } | - |
1300 | | - |
1301 | /*! | - |
1302 | Set whether keyboard grab should be enabled or not (\a grab). | - |
1303 | | - |
1304 | If the return value is true, the window receives all key events until | - |
1305 | setKeyboardGrabEnabled(false) is called; other windows get no key events at | - |
1306 | all. Mouse events are not affected. Use setMouseGrabEnabled() if you want | - |
1307 | to grab that. | - |
1308 | | - |
1309 | \sa setMouseGrabEnabled() | - |
1310 | */ | - |
1311 | bool QWindow::setKeyboardGrabEnabled(bool grab) | - |
1312 | { | - |
1313 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1314 | if (grab && QGuiApplicationPrivate::noGrab) evaluated: grab yes Evaluation Count:83 | yes Evaluation Count:62 |
partially evaluated: QGuiApplicationPrivate::noGrab no Evaluation Count:0 | yes Evaluation Count:83 |
| 0-83 |
1315 | return false; never executed: return false; | 0 |
1316 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:145 | no Evaluation Count:0 |
| 0-145 |
1317 | return d->platformWindow->setKeyboardGrabEnabled(grab); executed: return d->platformWindow->setKeyboardGrabEnabled(grab); Execution Count:145 | 145 |
1318 | return false; never executed: return false; | 0 |
1319 | } | - |
1320 | | - |
1321 | /*! | - |
1322 | Sets whether mouse grab should be enabled or not (\a grab). | - |
1323 | | - |
1324 | If the return value is true, the window receives all mouse events until setMouseGrabEnabled(false) is | - |
1325 | called; other windows get no mouse events at all. Keyboard events are not affected. | - |
1326 | Use setKeyboardGrabEnabled() if you want to grab that. | - |
1327 | | - |
1328 | \sa setKeyboardGrabEnabled() | - |
1329 | */ | - |
1330 | bool QWindow::setMouseGrabEnabled(bool grab) | - |
1331 | { | - |
1332 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1333 | if (grab && QGuiApplicationPrivate::noGrab) evaluated: grab yes Evaluation Count:82 | yes Evaluation Count:64 |
partially evaluated: QGuiApplicationPrivate::noGrab no Evaluation Count:0 | yes Evaluation Count:82 |
| 0-82 |
1334 | return false; never executed: return false; | 0 |
1335 | if (d->platformWindow) partially evaluated: d->platformWindow yes Evaluation Count:146 | no Evaluation Count:0 |
| 0-146 |
1336 | return d->platformWindow->setMouseGrabEnabled(grab); executed: return d->platformWindow->setMouseGrabEnabled(grab); Execution Count:146 | 146 |
1337 | return false; never executed: return false; | 0 |
1338 | } | - |
1339 | | - |
1340 | /*! | - |
1341 | Returns the screen on which the window is shown. | - |
1342 | | - |
1343 | The value returned will not change when the window is moved | - |
1344 | between virtual screens (as returned by QScreen::virtualSiblings()). | - |
1345 | | - |
1346 | \sa setScreen(), QScreen::virtualSiblings() | - |
1347 | */ | - |
1348 | QScreen *QWindow::screen() const | - |
1349 | { | - |
1350 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1351 | return d->screen; executed: return d->screen; Execution Count:45265 | 45265 |
1352 | } | - |
1353 | | - |
1354 | /*! | - |
1355 | Sets the screen on which the window should be shown. | - |
1356 | | - |
1357 | If the window has been created, it will be recreated on the \a newScreen. | - |
1358 | | - |
1359 | Note that if the screen is part of a virtual desktop of multiple screens, | - |
1360 | the window can appear on any of the screens returned by QScreen::virtualSiblings(). | - |
1361 | | - |
1362 | \sa screen(), QScreen::virtualSiblings() | - |
1363 | */ | - |
1364 | void QWindow::setScreen(QScreen *newScreen) | - |
1365 | { | - |
1366 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1367 | if (!newScreen) evaluated: !newScreen yes Evaluation Count:7 | yes Evaluation Count:1598 |
| 7-1598 |
1368 | newScreen = QGuiApplication::primaryScreen(); executed: newScreen = QGuiApplication::primaryScreen(); Execution Count:7 | 7 |
1369 | if (newScreen != screen()) { evaluated: newScreen != screen() yes Evaluation Count:7 | yes Evaluation Count:1598 |
| 7-1598 |
1370 | const bool wasCreated = d->platformWindow != 0; executed (the execution status of this line is deduced): const bool wasCreated = d->platformWindow != 0; | - |
1371 | if (wasCreated) evaluated: wasCreated yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
1372 | destroy(); executed: destroy(); Execution Count:4 | 4 |
1373 | if (d->screen) partially evaluated: d->screen yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
1374 | disconnect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); executed: disconnect(d->screen, "2""destroyed(QObject*)", this, "1""screenDestroyed(QObject*)"); Execution Count:7 | 7 |
1375 | d->screen = newScreen; executed (the execution status of this line is deduced): d->screen = newScreen; | - |
1376 | if (newScreen) { partially evaluated: newScreen no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
1377 | 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*)"); | - |
1378 | if (wasCreated) never evaluated: wasCreated | 0 |
1379 | create(); never executed: create(); | 0 |
1380 | } | 0 |
1381 | emit screenChanged(newScreen); executed (the execution status of this line is deduced): screenChanged(newScreen); | - |
1382 | } executed: } Execution Count:7 | 7 |
1383 | } executed: } Execution Count:1605 | 1605 |
1384 | | - |
1385 | void QWindow::screenDestroyed(QObject *object) | - |
1386 | { | - |
1387 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1388 | if (object == static_cast<QObject *>(d->screen)) { partially evaluated: object == static_cast<QObject *>(d->screen) yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
1389 | const bool wasVisible = isVisible(); executed (the execution status of this line is deduced): const bool wasVisible = isVisible(); | - |
1390 | setScreen(0); executed (the execution status of this line is deduced): setScreen(0); | - |
1391 | // destroy() might have hidden our window, show it again. | - |
1392 | // This might not be the best behavior if the new screen isn't a virtual sibling | - |
1393 | // of the old one. This can be removed once platform plugins have the power to | - |
1394 | // update the QScreen of its QWindows itself. | - |
1395 | if (wasVisible && d->platformWindow) evaluated: wasVisible yes Evaluation Count:4 | yes Evaluation Count:3 |
partially evaluated: d->platformWindow no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
1396 | setVisible(true); never executed: setVisible(true); | 0 |
1397 | } executed: } Execution Count:7 | 7 |
1398 | } executed: } Execution Count:7 | 7 |
1399 | | - |
1400 | /*! | - |
1401 | \fn QWindow::screenChanged(QScreen *screen) | - |
1402 | | - |
1403 | This signal is emitted when a window's \a screen changes, either | - |
1404 | by being set explicitly with setScreen(), or automatically when | - |
1405 | the window's screen is removed. | - |
1406 | */ | - |
1407 | | - |
1408 | /*! | - |
1409 | Returns the accessibility interface for the object that the window represents | - |
1410 | \internal | - |
1411 | \sa QAccessible | - |
1412 | */ | - |
1413 | QAccessibleInterface *QWindow::accessibleRoot() const | - |
1414 | { | - |
1415 | return 0; never executed: return 0; | 0 |
1416 | } | - |
1417 | | - |
1418 | /*! | - |
1419 | \fn QWindow::focusObjectChanged(QObject *focusObject) | - |
1420 | | - |
1421 | This signal is emitted when final receiver of events tied to focus is | - |
1422 | changed to \a focusObject. | - |
1423 | | - |
1424 | \sa focusObject() | - |
1425 | */ | - |
1426 | | - |
1427 | /*! | - |
1428 | Returns the QObject that will be the final receiver of events tied focus, such | - |
1429 | as key events. | - |
1430 | */ | - |
1431 | QObject *QWindow::focusObject() const | - |
1432 | { | - |
1433 | return const_cast<QWindow *>(this); executed: return const_cast<QWindow *>(this); Execution Count:113 | 113 |
1434 | } | - |
1435 | | - |
1436 | /*! | - |
1437 | Shows the window. | - |
1438 | | - |
1439 | This equivalent to calling showFullScreen() or showNormal(), depending | - |
1440 | on whether the platform defaults to windows being fullscreen or not. | - |
1441 | | - |
1442 | \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen() | - |
1443 | */ | - |
1444 | void QWindow::show() | - |
1445 | { | - |
1446 | if (qApp->styleHints()->showIsFullScreen()) partially evaluated: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints()->showIsFullScreen() no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
1447 | showFullScreen(); never executed: showFullScreen(); | 0 |
1448 | else | - |
1449 | showNormal(); executed: showNormal(); Execution Count:55 | 55 |
1450 | } | - |
1451 | | - |
1452 | /*! | - |
1453 | Hides the window. | - |
1454 | | - |
1455 | Equivalent to calling setVisible(false). | - |
1456 | | - |
1457 | \sa show(), setVisible() | - |
1458 | */ | - |
1459 | void QWindow::hide() | - |
1460 | { | - |
1461 | setVisible(false); executed (the execution status of this line is deduced): setVisible(false); | - |
1462 | } executed: } Execution Count:10 | 10 |
1463 | | - |
1464 | /*! | - |
1465 | Shows the window as minimized. | - |
1466 | | - |
1467 | Equivalent to calling setWindowState(Qt::WindowMinimized) and then | - |
1468 | setVisible(true). | - |
1469 | | - |
1470 | \sa setWindowState(), setVisible() | - |
1471 | */ | - |
1472 | void QWindow::showMinimized() | - |
1473 | { | - |
1474 | setWindowState(Qt::WindowMinimized); never executed (the execution status of this line is deduced): setWindowState(Qt::WindowMinimized); | - |
1475 | setVisible(true); never executed (the execution status of this line is deduced): setVisible(true); | - |
1476 | } | 0 |
1477 | | - |
1478 | /*! | - |
1479 | Shows the window as maximized. | - |
1480 | | - |
1481 | Equivalent to calling setWindowState(Qt::WindowMaximized) and then | - |
1482 | setVisible(true). | - |
1483 | | - |
1484 | \sa setWindowState(), setVisible() | - |
1485 | */ | - |
1486 | void QWindow::showMaximized() | - |
1487 | { | - |
1488 | setWindowState(Qt::WindowMaximized); executed (the execution status of this line is deduced): setWindowState(Qt::WindowMaximized); | - |
1489 | setVisible(true); executed (the execution status of this line is deduced): setVisible(true); | - |
1490 | } executed: } Execution Count:1 | 1 |
1491 | | - |
1492 | /*! | - |
1493 | Shows the window as fullscreen. | - |
1494 | | - |
1495 | Equivalent to calling setWindowState(Qt::WindowFullScreen) and then | - |
1496 | setVisible(true). | - |
1497 | | - |
1498 | \sa setWindowState(), setVisible() | - |
1499 | */ | - |
1500 | void QWindow::showFullScreen() | - |
1501 | { | - |
1502 | setWindowState(Qt::WindowFullScreen); never executed (the execution status of this line is deduced): setWindowState(Qt::WindowFullScreen); | - |
1503 | setVisible(true); never executed (the execution status of this line is deduced): setVisible(true); | - |
1504 | requestActivate(); never executed (the execution status of this line is deduced): requestActivate(); | - |
1505 | } | 0 |
1506 | | - |
1507 | /*! | - |
1508 | Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen. | - |
1509 | | - |
1510 | Equivalent to calling setWindowState(Qt::WindowNoState) and then | - |
1511 | setVisible(true). | - |
1512 | | - |
1513 | \sa setWindowState(), setVisible() | - |
1514 | */ | - |
1515 | void QWindow::showNormal() | - |
1516 | { | - |
1517 | setWindowState(Qt::WindowNoState); executed (the execution status of this line is deduced): setWindowState(Qt::WindowNoState); | - |
1518 | setVisible(true); executed (the execution status of this line is deduced): setVisible(true); | - |
1519 | } executed: } Execution Count:55 | 55 |
1520 | | - |
1521 | /*! | - |
1522 | Close the window. | - |
1523 | | - |
1524 | This closes the window, effectively calling destroy(), and potentially | - |
1525 | quitting the application. Returns true on success, false if it has a parent | - |
1526 | window (in which case the top level window should be closed instead). | - |
1527 | | - |
1528 | \sa destroy(), QGuiApplication::quitOnLastWindowClosed() | - |
1529 | */ | - |
1530 | bool QWindow::close() | - |
1531 | { | - |
1532 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1533 | | - |
1534 | // Do not close non top level windows | - |
1535 | if (parent()) evaluated: parent() yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
1536 | return false; executed: return false; Execution Count:1 | 1 |
1537 | | - |
1538 | if (QGuiApplicationPrivate::focus_window == this) evaluated: QGuiApplicationPrivate::focus_window == this yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-6 |
1539 | QGuiApplicationPrivate::focus_window = 0; executed: QGuiApplicationPrivate::focus_window = 0; Execution Count:1 | 1 |
1540 | if (QGuiApplicationPrivate::currentMouseWindow == this) partially evaluated: QGuiApplicationPrivate::currentMouseWindow == this no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
1541 | QGuiApplicationPrivate::currentMouseWindow = 0; never executed: QGuiApplicationPrivate::currentMouseWindow = 0; | 0 |
1542 | | - |
1543 | QGuiApplicationPrivate::window_list.removeAll(this); executed (the execution status of this line is deduced): QGuiApplicationPrivate::window_list.removeAll(this); | - |
1544 | destroy(); executed (the execution status of this line is deduced): destroy(); | - |
1545 | d->maybeQuitOnLastWindowClosed(); executed (the execution status of this line is deduced): d->maybeQuitOnLastWindowClosed(); | - |
1546 | return true; executed: return true; Execution Count:7 | 7 |
1547 | } | - |
1548 | | - |
1549 | /*! | - |
1550 | The expose event (\a ev) is sent by the window system whenever the window's | - |
1551 | exposure on screen changes. | - |
1552 | | - |
1553 | The application can start rendering into the window with QBackingStore | - |
1554 | and QOpenGLContext as soon as it gets an exposeEvent() such that | - |
1555 | isExposed() is true. | - |
1556 | | - |
1557 | If the window is moved off screen, is made totally obscured by another | - |
1558 | window, iconified or similar, this function might be called and the | - |
1559 | value of isExposed() might change to false. When this happens, | - |
1560 | an application should stop its rendering as it is no longer visible | - |
1561 | to the user. | - |
1562 | | - |
1563 | A resize event will always be sent before the expose event the first time | - |
1564 | a window is shown. | - |
1565 | | - |
1566 | \sa isExposed() | - |
1567 | */ | - |
1568 | void QWindow::exposeEvent(QExposeEvent *ev) | - |
1569 | { | - |
1570 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1571 | } executed: } Execution Count:92 | 92 |
1572 | | - |
1573 | /*! | - |
1574 | Override this to handle mouse events (\a ev). | - |
1575 | */ | - |
1576 | void QWindow::moveEvent(QMoveEvent *ev) | - |
1577 | { | - |
1578 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1579 | } executed: } Execution Count:5 | 5 |
1580 | | - |
1581 | /*! | - |
1582 | Override this to handle resize events (\a ev). | - |
1583 | | - |
1584 | The resize event is called whenever the window is resized in the windowing system, | - |
1585 | either directly through the windowing system acknowledging a setGeometry() or resize() request, | - |
1586 | or indirectly through the user resizing the window manually. | - |
1587 | */ | - |
1588 | void QWindow::resizeEvent(QResizeEvent *ev) | - |
1589 | { | - |
1590 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1591 | } executed: } Execution Count:45 | 45 |
1592 | | - |
1593 | /*! | - |
1594 | Override this to handle show events (\a ev). | - |
1595 | | - |
1596 | The function is called when the window has requested becoming visible. | - |
1597 | | - |
1598 | If the window is successfully shown by the windowing system, this will | - |
1599 | be followed by a resize and an expose event. | - |
1600 | */ | - |
1601 | void QWindow::showEvent(QShowEvent *ev) | - |
1602 | { | - |
1603 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1604 | } executed: } Execution Count:1590 | 1590 |
1605 | | - |
1606 | /*! | - |
1607 | Override this to handle hide events (\a ev). | - |
1608 | | - |
1609 | The function is called when the window has requested being hidden in the | - |
1610 | windowing system. | - |
1611 | */ | - |
1612 | void QWindow::hideEvent(QHideEvent *ev) | - |
1613 | { | - |
1614 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1615 | } executed: } Execution Count:1542 | 1542 |
1616 | | - |
1617 | /*! | - |
1618 | Override this to handle any event (\a ev) sent to the window. | - |
1619 | Return \c true if the event was recognized and processed. | - |
1620 | | - |
1621 | Remember to call the base class version if you wish for mouse events, | - |
1622 | key events, resize events, etc to be dispatched as usual. | - |
1623 | */ | - |
1624 | bool QWindow::event(QEvent *ev) | - |
1625 | { | - |
1626 | switch (ev->type()) { | - |
1627 | case QEvent::MouseMove: | - |
1628 | mouseMoveEvent(static_cast<QMouseEvent*>(ev)); executed (the execution status of this line is deduced): mouseMoveEvent(static_cast<QMouseEvent*>(ev)); | - |
1629 | break; executed: break; Execution Count:8 | 8 |
1630 | | - |
1631 | case QEvent::MouseButtonPress: | - |
1632 | mousePressEvent(static_cast<QMouseEvent*>(ev)); executed (the execution status of this line is deduced): mousePressEvent(static_cast<QMouseEvent*>(ev)); | - |
1633 | break; executed: break; Execution Count:57 | 57 |
1634 | | - |
1635 | case QEvent::MouseButtonRelease: | - |
1636 | mouseReleaseEvent(static_cast<QMouseEvent*>(ev)); executed (the execution status of this line is deduced): mouseReleaseEvent(static_cast<QMouseEvent*>(ev)); | - |
1637 | break; executed: break; Execution Count:57 | 57 |
1638 | | - |
1639 | case QEvent::MouseButtonDblClick: | - |
1640 | mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev)); executed (the execution status of this line is deduced): mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev)); | - |
1641 | break; executed: break; Execution Count:19 | 19 |
1642 | | - |
1643 | case QEvent::TouchBegin: | - |
1644 | case QEvent::TouchUpdate: | - |
1645 | case QEvent::TouchEnd: | - |
1646 | case QEvent::TouchCancel: | - |
1647 | touchEvent(static_cast<QTouchEvent *>(ev)); executed (the execution status of this line is deduced): touchEvent(static_cast<QTouchEvent *>(ev)); | - |
1648 | break; executed: break; Execution Count:25 | 25 |
1649 | | - |
1650 | case QEvent::Move: | - |
1651 | moveEvent(static_cast<QMoveEvent*>(ev)); executed (the execution status of this line is deduced): moveEvent(static_cast<QMoveEvent*>(ev)); | - |
1652 | break; executed: break; Execution Count:5 | 5 |
1653 | | - |
1654 | case QEvent::Resize: | - |
1655 | resizeEvent(static_cast<QResizeEvent*>(ev)); executed (the execution status of this line is deduced): resizeEvent(static_cast<QResizeEvent*>(ev)); | - |
1656 | break; executed: break; Execution Count:46 | 46 |
1657 | | - |
1658 | case QEvent::KeyPress: | - |
1659 | keyPressEvent(static_cast<QKeyEvent *>(ev)); executed (the execution status of this line is deduced): keyPressEvent(static_cast<QKeyEvent *>(ev)); | - |
1660 | break; executed: break; Execution Count:7 | 7 |
1661 | | - |
1662 | case QEvent::KeyRelease: | - |
1663 | keyReleaseEvent(static_cast<QKeyEvent *>(ev)); executed (the execution status of this line is deduced): keyReleaseEvent(static_cast<QKeyEvent *>(ev)); | - |
1664 | break; executed: break; Execution Count:7 | 7 |
1665 | | - |
1666 | case QEvent::FocusIn: { | - |
1667 | focusInEvent(static_cast<QFocusEvent *>(ev)); executed (the execution status of this line is deduced): focusInEvent(static_cast<QFocusEvent *>(ev)); | - |
1668 | #ifndef QT_NO_ACCESSIBILITY | - |
1669 | QAccessible::State state; executed (the execution status of this line is deduced): QAccessible::State state; | - |
1670 | state.active = true; executed (the execution status of this line is deduced): state.active = true; | - |
1671 | QAccessibleStateChangeEvent event(this, state); executed (the execution status of this line is deduced): QAccessibleStateChangeEvent event(this, state); | - |
1672 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
1673 | #endif | - |
1674 | break; } executed: break; Execution Count:48 | 48 |
1675 | | - |
1676 | case QEvent::FocusOut: { | - |
1677 | focusOutEvent(static_cast<QFocusEvent *>(ev)); executed (the execution status of this line is deduced): focusOutEvent(static_cast<QFocusEvent *>(ev)); | - |
1678 | #ifndef QT_NO_ACCESSIBILITY | - |
1679 | QAccessible::State state; executed (the execution status of this line is deduced): QAccessible::State state; | - |
1680 | state.active = true; executed (the execution status of this line is deduced): state.active = true; | - |
1681 | QAccessibleStateChangeEvent event(this, state); executed (the execution status of this line is deduced): QAccessibleStateChangeEvent event(this, state); | - |
1682 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
1683 | #endif | - |
1684 | break; } executed: break; Execution Count:17 | 17 |
1685 | | - |
1686 | #ifndef QT_NO_WHEELEVENT | - |
1687 | case QEvent::Wheel: | - |
1688 | wheelEvent(static_cast<QWheelEvent*>(ev)); executed (the execution status of this line is deduced): wheelEvent(static_cast<QWheelEvent*>(ev)); | - |
1689 | break; executed: break; Execution Count:3 | 3 |
1690 | #endif | - |
1691 | | - |
1692 | case QEvent::Close: { | - |
1693 | Q_D(QWindow); never executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1694 | bool wasVisible = isVisible(); never executed (the execution status of this line is deduced): bool wasVisible = isVisible(); | - |
1695 | destroy(); never executed (the execution status of this line is deduced): destroy(); | - |
1696 | if (wasVisible) never evaluated: wasVisible | 0 |
1697 | d->maybeQuitOnLastWindowClosed(); never executed: d->maybeQuitOnLastWindowClosed(); | 0 |
1698 | break; } | 0 |
1699 | | - |
1700 | case QEvent::Expose: | - |
1701 | exposeEvent(static_cast<QExposeEvent *>(ev)); executed (the execution status of this line is deduced): exposeEvent(static_cast<QExposeEvent *>(ev)); | - |
1702 | break; executed: break; Execution Count:94 | 94 |
1703 | | - |
1704 | case QEvent::Show: | - |
1705 | showEvent(static_cast<QShowEvent *>(ev)); executed (the execution status of this line is deduced): showEvent(static_cast<QShowEvent *>(ev)); | - |
1706 | break; executed: break; Execution Count:1590 | 1590 |
1707 | | - |
1708 | case QEvent::Hide: | - |
1709 | hideEvent(static_cast<QHideEvent *>(ev)); executed (the execution status of this line is deduced): hideEvent(static_cast<QHideEvent *>(ev)); | - |
1710 | break; executed: break; Execution Count:1542 | 1542 |
1711 | | - |
1712 | case QEvent::WindowStateChange: { | - |
1713 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1714 | emit windowStateChanged(d->windowState); executed (the execution status of this line is deduced): windowStateChanged(d->windowState); | - |
1715 | break; executed: break; Execution Count:48 | 48 |
1716 | } | - |
1717 | | - |
1718 | #ifndef QT_NO_TABLETEVENT | - |
1719 | case QEvent::TabletPress: | - |
1720 | case QEvent::TabletMove: | - |
1721 | case QEvent::TabletRelease: | - |
1722 | tabletEvent(static_cast<QTabletEvent *>(ev)); executed (the execution status of this line is deduced): tabletEvent(static_cast<QTabletEvent *>(ev)); | - |
1723 | break; executed: break; Execution Count:2 | 2 |
1724 | #endif | - |
1725 | | - |
1726 | default: | - |
1727 | return QObject::event(ev); executed: return QObject::event(ev); Execution Count:2147 | 2147 |
1728 | } | - |
1729 | return true; executed: return true; Execution Count:3575 | 3575 |
1730 | } | - |
1731 | | - |
1732 | /*! | - |
1733 | Override this to handle key press events (\a ev). | - |
1734 | | - |
1735 | \sa keyReleaseEvent() | - |
1736 | */ | - |
1737 | void QWindow::keyPressEvent(QKeyEvent *ev) | - |
1738 | { | - |
1739 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1740 | } executed: } Execution Count:6 | 6 |
1741 | | - |
1742 | /*! | - |
1743 | Override this to handle key release events (\a ev). | - |
1744 | | - |
1745 | \sa keyPressEvent() | - |
1746 | */ | - |
1747 | void QWindow::keyReleaseEvent(QKeyEvent *ev) | - |
1748 | { | - |
1749 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1750 | } executed: } Execution Count:6 | 6 |
1751 | | - |
1752 | /*! | - |
1753 | Override this to handle focus in events (\a ev). | - |
1754 | | - |
1755 | Focus in events are sent when the window receives keyboard focus. | - |
1756 | | - |
1757 | \sa focusOutEvent() | - |
1758 | */ | - |
1759 | void QWindow::focusInEvent(QFocusEvent *ev) | - |
1760 | { | - |
1761 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1762 | } executed: } Execution Count:48 | 48 |
1763 | | - |
1764 | /*! | - |
1765 | Override this to handle focus out events (\a ev). | - |
1766 | | - |
1767 | Focus out events are sent when the window loses keyboard focus. | - |
1768 | | - |
1769 | \sa focusInEvent() | - |
1770 | */ | - |
1771 | void QWindow::focusOutEvent(QFocusEvent *ev) | - |
1772 | { | - |
1773 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1774 | } executed: } Execution Count:14 | 14 |
1775 | | - |
1776 | /*! | - |
1777 | Override this to handle mouse press events (\a ev). | - |
1778 | | - |
1779 | \sa mouseReleaseEvent() | - |
1780 | */ | - |
1781 | void QWindow::mousePressEvent(QMouseEvent *ev) | - |
1782 | { | - |
1783 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1784 | } executed: } Execution Count:32 | 32 |
1785 | | - |
1786 | /*! | - |
1787 | Override this to handle mouse release events (\a ev). | - |
1788 | | - |
1789 | \sa mousePressEvent() | - |
1790 | */ | - |
1791 | void QWindow::mouseReleaseEvent(QMouseEvent *ev) | - |
1792 | { | - |
1793 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1794 | } executed: } Execution Count:32 | 32 |
1795 | | - |
1796 | /*! | - |
1797 | Override this to handle mouse double click events (\a ev). | - |
1798 | | - |
1799 | \sa mousePressEvent(), QStyleHints::mouseDoubleClickInterval() | - |
1800 | */ | - |
1801 | void QWindow::mouseDoubleClickEvent(QMouseEvent *ev) | - |
1802 | { | - |
1803 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1804 | } executed: } Execution Count:12 | 12 |
1805 | | - |
1806 | /*! | - |
1807 | Override this to handle mouse move events (\a ev). | - |
1808 | */ | - |
1809 | void QWindow::mouseMoveEvent(QMouseEvent *ev) | - |
1810 | { | - |
1811 | ev->ignore(); never executed (the execution status of this line is deduced): ev->ignore(); | - |
1812 | } | 0 |
1813 | | - |
1814 | #ifndef QT_NO_WHEELEVENT | - |
1815 | /*! | - |
1816 | Override this to handle mouse wheel or other wheel events (\a ev). | - |
1817 | */ | - |
1818 | void QWindow::wheelEvent(QWheelEvent *ev) | - |
1819 | { | - |
1820 | ev->ignore(); executed (the execution status of this line is deduced): ev->ignore(); | - |
1821 | } executed: } Execution Count:3 | 3 |
1822 | #endif //QT_NO_WHEELEVENT | - |
1823 | | - |
1824 | /*! | - |
1825 | Override this to handle touch events (\a ev). | - |
1826 | */ | - |
1827 | void QWindow::touchEvent(QTouchEvent *ev) | - |
1828 | { | - |
1829 | ev->ignore(); never executed (the execution status of this line is deduced): ev->ignore(); | - |
1830 | } | 0 |
1831 | | - |
1832 | #ifndef QT_NO_TABLETEVENT | - |
1833 | /*! | - |
1834 | Override this to handle tablet press, move, and release events (\a ev). | - |
1835 | | - |
1836 | Proximity enter and leave events are not sent to windows, they are | - |
1837 | delivered to the application instance. | - |
1838 | */ | - |
1839 | void QWindow::tabletEvent(QTabletEvent *ev) | - |
1840 | { | - |
1841 | ev->ignore(); never executed (the execution status of this line is deduced): ev->ignore(); | - |
1842 | } | 0 |
1843 | #endif | - |
1844 | | - |
1845 | /*! | - |
1846 | Override this to handle platform dependent events. | - |
1847 | Will be given \a eventType, \a message and \a result. | - |
1848 | | - |
1849 | This might make your application non-portable. | - |
1850 | | - |
1851 | Should return true only if the event was handled. | - |
1852 | */ | - |
1853 | bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) | - |
1854 | { | - |
1855 | Q_UNUSED(eventType); executed (the execution status of this line is deduced): (void)eventType;; | - |
1856 | Q_UNUSED(message); executed (the execution status of this line is deduced): (void)message;; | - |
1857 | Q_UNUSED(result); executed (the execution status of this line is deduced): (void)result;; | - |
1858 | return false; executed: return false; Execution Count:1385 | 1385 |
1859 | } | - |
1860 | | - |
1861 | /*! | - |
1862 | \fn QPoint QWindow::mapToGlobal(const QPoint &pos) const | - |
1863 | | - |
1864 | Translates the window coordinate \a pos to global screen | - |
1865 | coordinates. For example, \c{mapToGlobal(QPoint(0,0))} would give | - |
1866 | the global coordinates of the top-left pixel of the window. | - |
1867 | | - |
1868 | \sa mapFromGlobal() | - |
1869 | */ | - |
1870 | QPoint QWindow::mapToGlobal(const QPoint &pos) const | - |
1871 | { | - |
1872 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1873 | if (d->platformWindow && d->platformWindow->isEmbedded(0)) evaluated: d->platformWindow yes Evaluation Count:13617 | yes Evaluation Count:4 |
partially evaluated: d->platformWindow->isEmbedded(0) no Evaluation Count:0 | yes Evaluation Count:13617 |
| 0-13617 |
1874 | return d->platformWindow->mapToGlobal(pos); never executed: return d->platformWindow->mapToGlobal(pos); | 0 |
1875 | else | - |
1876 | return pos + d_func()->globalPosition(); executed: return pos + d_func()->globalPosition(); Execution Count:13621 | 13621 |
1877 | } | - |
1878 | | - |
1879 | | - |
1880 | /*! | - |
1881 | \fn QPoint QWindow::mapFromGlobal(const QPoint &pos) const | - |
1882 | | - |
1883 | Translates the global screen coordinate \a pos to window | - |
1884 | coordinates. | - |
1885 | | - |
1886 | \sa mapToGlobal() | - |
1887 | */ | - |
1888 | QPoint QWindow::mapFromGlobal(const QPoint &pos) const | - |
1889 | { | - |
1890 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1891 | if (d->platformWindow && d->platformWindow->isEmbedded(0)) evaluated: d->platformWindow yes Evaluation Count:4751 | yes Evaluation Count:3 |
partially evaluated: d->platformWindow->isEmbedded(0) no Evaluation Count:0 | yes Evaluation Count:4751 |
| 0-4751 |
1892 | return d->platformWindow->mapFromGlobal(pos); never executed: return d->platformWindow->mapFromGlobal(pos); | 0 |
1893 | else | - |
1894 | return pos - d_func()->globalPosition(); executed: return pos - d_func()->globalPosition(); Execution Count:4754 | 4754 |
1895 | } | - |
1896 | | - |
1897 | | - |
1898 | Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window) | - |
1899 | { | - |
1900 | return window->d_func(); executed: return window->d_func(); Execution Count:11113 | 11113 |
1901 | } | - |
1902 | | - |
1903 | void QWindowPrivate::maybeQuitOnLastWindowClosed() | - |
1904 | { | - |
1905 | Q_Q(QWindow); executed (the execution status of this line is deduced): QWindow * const q = q_func(); | - |
1906 | | - |
1907 | // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent | - |
1908 | 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 |
1909 | | - |
1910 | if (quitOnClose) { partially evaluated: quitOnClose yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
1911 | QWindowList list = QGuiApplication::topLevelWindows(); executed (the execution status of this line is deduced): QWindowList list = QGuiApplication::topLevelWindows(); | - |
1912 | bool lastWindowClosed = true; executed (the execution status of this line is deduced): bool lastWindowClosed = true; | - |
1913 | for (int i = 0; i < list.size(); ++i) { evaluated: i < list.size() yes Evaluation Count:4 | yes Evaluation Count:5 |
| 4-5 |
1914 | QWindow *w = list.at(i); executed (the execution status of this line is deduced): QWindow *w = list.at(i); | - |
1915 | 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 |
1916 | continue; executed: continue; Execution Count:2 | 2 |
1917 | lastWindowClosed = false; executed (the execution status of this line is deduced): lastWindowClosed = false; | - |
1918 | break; executed: break; Execution Count:2 | 2 |
1919 | } | - |
1920 | if (lastWindowClosed) { evaluated: lastWindowClosed yes Evaluation Count:5 | yes Evaluation Count:2 |
| 2-5 |
1921 | QGuiApplicationPrivate::emitLastWindowClosed(); executed (the execution status of this line is deduced): QGuiApplicationPrivate::emitLastWindowClosed(); | - |
1922 | 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())); | - |
1923 | applicationPrivate->maybeQuit(); executed (the execution status of this line is deduced): applicationPrivate->maybeQuit(); | - |
1924 | } executed: } Execution Count:5 | 5 |
1925 | } executed: } Execution Count:7 | 7 |
1926 | | - |
1927 | } executed: } Execution Count:7 | 7 |
1928 | | - |
1929 | #ifndef QT_NO_CURSOR | - |
1930 | /*! | - |
1931 | \brief set the cursor shape for this window | - |
1932 | | - |
1933 | The mouse \a cursor will assume this shape when it is over this | - |
1934 | window, unless an override cursor is set. | - |
1935 | See the \l{Qt::CursorShape}{list of predefined cursor objects} for a | - |
1936 | range of useful shapes. | - |
1937 | | - |
1938 | By default, the cursor has the Qt::ArrowCursor shape. | - |
1939 | | - |
1940 | Some underlying window implementations will reset the cursor if it | - |
1941 | leaves a window even if the mouse is grabbed. If you want to have | - |
1942 | a cursor set for all windows, even when outside the window, consider | - |
1943 | QGuiApplication::setOverrideCursor(). | - |
1944 | | - |
1945 | \sa QGuiApplication::setOverrideCursor() | - |
1946 | */ | - |
1947 | void QWindow::setCursor(const QCursor &cursor) | - |
1948 | { | - |
1949 | Q_D(QWindow); executed (the execution status of this line is deduced): QWindowPrivate * const d = d_func(); | - |
1950 | d->cursor = cursor; executed (the execution status of this line is deduced): d->cursor = cursor; | - |
1951 | // Only attempt to set cursor and emit signal if there is an actual platform cursor | - |
1952 | if (d->screen->handle()->cursor()) { partially evaluated: d->screen->handle()->cursor() yes Evaluation Count:2029 | no Evaluation Count:0 |
| 0-2029 |
1953 | d->applyCursor(); executed (the execution status of this line is deduced): d->applyCursor(); | - |
1954 | QEvent event(QEvent::CursorChange); executed (the execution status of this line is deduced): QEvent event(QEvent::CursorChange); | - |
1955 | QGuiApplication::sendEvent(this, &event); executed (the execution status of this line is deduced): QGuiApplication::sendEvent(this, &event); | - |
1956 | } executed: } Execution Count:2029 | 2029 |
1957 | } executed: } Execution Count:2029 | 2029 |
1958 | | - |
1959 | /*! | - |
1960 | \brief Restores the default arrow cursor for this window. | - |
1961 | */ | - |
1962 | void QWindow::unsetCursor() | - |
1963 | { | - |
1964 | setCursor(Qt::ArrowCursor); never executed (the execution status of this line is deduced): setCursor(Qt::ArrowCursor); | - |
1965 | } | 0 |
1966 | | - |
1967 | /*! | - |
1968 | \brief the cursor shape for this window | - |
1969 | | - |
1970 | \sa setCursor(), unsetCursor() | - |
1971 | */ | - |
1972 | QCursor QWindow::cursor() const | - |
1973 | { | - |
1974 | Q_D(const QWindow); executed (the execution status of this line is deduced): const QWindowPrivate * const d = d_func(); | - |
1975 | return d->cursor; executed: return d->cursor; Execution Count:2 | 2 |
1976 | } | - |
1977 | | - |
1978 | void QWindowPrivate::applyCursor() | - |
1979 | { | - |
1980 | Q_Q(QWindow); executed (the execution status of this line is deduced): QWindow * const q = q_func(); | - |
1981 | if (platformWindow) { partially evaluated: platformWindow yes Evaluation Count:3619 | no Evaluation Count:0 |
| 0-3619 |
1982 | if (QPlatformCursor *platformCursor = screen->handle()->cursor()) { partially evaluated: QPlatformCursor *platformCursor = screen->handle()->cursor() yes Evaluation Count:3619 | no Evaluation Count:0 |
| 0-3619 |
1983 | QCursor *oc = QGuiApplication::overrideCursor(); executed (the execution status of this line is deduced): QCursor *oc = QGuiApplication::overrideCursor(); | - |
1984 | QCursor c = oc ? *oc : cursor; partially evaluated: oc no Evaluation Count:0 | yes Evaluation Count:3619 |
| 0-3619 |
1985 | platformCursor->changeCursor(&c, q); executed (the execution status of this line is deduced): platformCursor->changeCursor(&c, q); | - |
1986 | } executed: } Execution Count:3619 | 3619 |
1987 | } executed: } Execution Count:3619 | 3619 |
1988 | } executed: } Execution Count:3619 | 3619 |
1989 | #endif // QT_NO_CURSOR | - |
1990 | | - |
1991 | QT_END_NAMESPACE | - |
1992 | | - |
| | |