Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | static inline int themeDialogType(const QDialog *dialog) | - |
8 | { | - |
9 | | - |
10 | if (qobject_cast<const QFileDialog *>(dialog)) evaluated: qobject_cast<const QFileDialog *>(dialog) yes Evaluation Count:189 | yes Evaluation Count:5 |
| 5-189 |
11 | return QPlatformTheme::FileDialog; executed: return QPlatformTheme::FileDialog; Execution Count:189 | 189 |
12 | | - |
13 | | - |
14 | if (qobject_cast<const QColorDialog *>(dialog)) evaluated: qobject_cast<const QColorDialog *>(dialog) yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
15 | return QPlatformTheme::ColorDialog; executed: return QPlatformTheme::ColorDialog; Execution Count:3 | 3 |
16 | | - |
17 | | - |
18 | if (qobject_cast<const QFontDialog *>(dialog)) partially evaluated: qobject_cast<const QFontDialog *>(dialog) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
19 | return QPlatformTheme::FontDialog; executed: return QPlatformTheme::FontDialog; Execution Count:2 | 2 |
20 | | - |
21 | return -1; never executed: return -1; | 0 |
22 | } | - |
23 | | - |
24 | QPlatformDialogHelper *QDialogPrivate::platformHelper() const | - |
25 | { | - |
26 | | - |
27 | | - |
28 | if (!m_platformHelperCreated) { evaluated: !m_platformHelperCreated yes Evaluation Count:194 | yes Evaluation Count:10 |
| 10-194 |
29 | m_platformHelperCreated = true; | - |
30 | QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this); | - |
31 | QDialog *dialog = ncThis->q_func(); | - |
32 | const int type = themeDialogType(dialog); | - |
33 | if (type >= 0) { partially evaluated: type >= 0 yes Evaluation Count:194 | no Evaluation Count:0 |
| 0-194 |
34 | m_platformHelper = QGuiApplicationPrivate::platformTheme() | - |
35 | ->createPlatformDialogHelper(static_cast<QPlatformTheme::DialogType>(type)); | - |
36 | if (m_platformHelper) { partially evaluated: m_platformHelper no Evaluation Count:0 | yes Evaluation Count:194 |
| 0-194 |
37 | QObject::connect(m_platformHelper, "2""accept()", dialog, "1""accept()"); | - |
38 | QObject::connect(m_platformHelper, "2""reject()", dialog, "1""reject()"); | - |
39 | ncThis->initHelper(m_platformHelper); | - |
40 | } | 0 |
41 | } executed: } Execution Count:194 | 194 |
42 | } executed: } Execution Count:194 | 194 |
43 | return m_platformHelper; executed: return m_platformHelper; Execution Count:204 | 204 |
44 | } | - |
45 | | - |
46 | QWindow *QDialogPrivate::parentWindow() const | - |
47 | { | - |
48 | if (const QWidget *parent = q_func()->nativeParentWidget()) never evaluated: const QWidget *parent = q_func()->nativeParentWidget() | 0 |
49 | return parent->windowHandle(); never executed: return parent->windowHandle(); | 0 |
50 | return 0; never executed: return 0; | 0 |
51 | } | - |
52 | | - |
53 | bool QDialogPrivate::setNativeDialogVisible(bool visible) | - |
54 | { | - |
55 | if (QPlatformDialogHelper *helper = platformHelper()) { partially evaluated: QPlatformDialogHelper *helper = platformHelper() no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
56 | if (visible) { | 0 |
57 | QDialog * const q = q_func(); | - |
58 | helperPrepareShow(helper); | - |
59 | nativeDialogInUse = helper->show(q->windowFlags(), q->windowModality(), parentWindow()); | - |
60 | } else { | 0 |
61 | helper->hide(); | - |
62 | } | 0 |
63 | } | - |
64 | return nativeDialogInUse; executed: return nativeDialogInUse; Execution Count:8 | 8 |
65 | } | - |
66 | | - |
67 | QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const | - |
68 | { | - |
69 | if (const QPlatformDialogHelper *helper = platformHelper()) never evaluated: const QPlatformDialogHelper *helper = platformHelper() | 0 |
70 | return helper->styleHint(hint); never executed: return helper->styleHint(hint); | 0 |
71 | return QPlatformDialogHelper::defaultStyleHint(hint); never executed: return QPlatformDialogHelper::defaultStyleHint(hint); | 0 |
72 | } | - |
73 | | - |
74 | void QDialogPrivate::deletePlatformHelper() | - |
75 | { | - |
76 | delete m_platformHelper; | - |
77 | m_platformHelper = 0; | - |
78 | m_platformHelperCreated = false; | - |
79 | nativeDialogInUse = false; | - |
80 | } executed: } Execution Count:217 | 217 |
81 | QDialog::QDialog(QWidget *parent, Qt::WindowFlags f) | - |
82 | : QWidget(*new QDialogPrivate, parent, | - |
83 | f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))) | - |
84 | { | - |
85 | } executed: } Execution Count:48 | 48 |
86 | | - |
87 | | - |
88 | | - |
89 | | - |
90 | | - |
91 | QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f) | - |
92 | : QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))) | - |
93 | { | - |
94 | } executed: } Execution Count:337 | 337 |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | | - |
100 | QDialog::~QDialog() | - |
101 | { | - |
102 | if (true) { partially evaluated: true yes Evaluation Count:382 | no Evaluation Count:0 |
| 0-382 |
103 | | - |
104 | | - |
105 | hide(); | - |
106 | } else { executed: } Execution Count:382 | 382 |
107 | | - |
108 | } | 0 |
109 | } | - |
110 | void QDialogPrivate::setDefault(QPushButton *pushButton) | - |
111 | { | - |
112 | QDialog * const q = q_func(); | - |
113 | bool hasMain = false; | - |
114 | QList<QPushButton*> list = q->findChildren<QPushButton*>(); | - |
115 | for (int i=0; i<list.size(); ++i) { evaluated: i<list.size() yes Evaluation Count:1933 | yes Evaluation Count:518 |
| 518-1933 |
116 | QPushButton *pb = list.at(i); | - |
117 | if (pb->window() == q) { partially evaluated: pb->window() == q yes Evaluation Count:1933 | no Evaluation Count:0 |
| 0-1933 |
118 | if (pb == mainDef) evaluated: pb == mainDef yes Evaluation Count:81 | yes Evaluation Count:1852 |
| 81-1852 |
119 | hasMain = true; executed: hasMain = true; Execution Count:81 | 81 |
120 | if (pb != pushButton) evaluated: pb != pushButton yes Evaluation Count:1486 | yes Evaluation Count:447 |
| 447-1486 |
121 | pb->setDefault(false); executed: pb->setDefault(false); Execution Count:1486 | 1486 |
122 | } executed: } Execution Count:1933 | 1933 |
123 | } executed: } Execution Count:1933 | 1933 |
124 | if (!pushButton && hasMain) evaluated: !pushButton yes Evaluation Count:71 | yes Evaluation Count:447 |
partially evaluated: hasMain yes Evaluation Count:71 | no Evaluation Count:0 |
| 0-447 |
125 | mainDef->setDefault(true); executed: mainDef->setDefault(true); Execution Count:71 | 71 |
126 | if (!hasMain) evaluated: !hasMain yes Evaluation Count:437 | yes Evaluation Count:81 |
| 81-437 |
127 | mainDef = pushButton; executed: mainDef = pushButton; Execution Count:437 | 437 |
128 | } executed: } Execution Count:518 | 518 |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | | - |
134 | | - |
135 | void QDialogPrivate::setMainDefault(QPushButton *pushButton) | - |
136 | { | - |
137 | mainDef = 0; | - |
138 | setDefault(pushButton); | - |
139 | } executed: } Execution Count:435 | 435 |
140 | | - |
141 | | - |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | void QDialogPrivate::hideDefault() | - |
147 | { | - |
148 | QDialog * const q = q_func(); | - |
149 | QList<QPushButton*> list = q->findChildren<QPushButton*>(); | - |
150 | for (int i=0; i<list.size(); ++i) { never evaluated: i<list.size() | 0 |
151 | list.at(i)->setDefault(false); | - |
152 | } | 0 |
153 | } | 0 |
154 | | - |
155 | void QDialogPrivate::resetModalitySetByOpen() | - |
156 | { | - |
157 | QDialog * const q = q_func(); | - |
158 | if (resetModalityTo != -1 && !q->testAttribute(Qt::WA_SetWindowModality)) { partially evaluated: resetModalityTo != -1 no Evaluation Count:0 | yes Evaluation Count:210 |
never evaluated: !q->testAttribute(Qt::WA_SetWindowModality) | 0-210 |
159 | | - |
160 | q->setWindowModality(Qt::WindowModality(resetModalityTo)); | - |
161 | q->setAttribute(Qt::WA_SetWindowModality, wasModalitySet); | - |
162 | | - |
163 | | - |
164 | | - |
165 | | - |
166 | } | 0 |
167 | resetModalityTo = -1; | - |
168 | } executed: } Execution Count:210 | 210 |
169 | int QDialog::result() const | - |
170 | { | - |
171 | const QDialogPrivate * const d = d_func(); | - |
172 | return d->rescode; executed: return d->rescode; Execution Count:99 | 99 |
173 | } | - |
174 | void QDialog::setResult(int r) | - |
175 | { | - |
176 | QDialogPrivate * const d = d_func(); | - |
177 | d->rescode = r; | - |
178 | } executed: } Execution Count:227 | 227 |
179 | void QDialog::open() | - |
180 | { | - |
181 | QDialogPrivate * const d = d_func(); | - |
182 | | - |
183 | Qt::WindowModality modality = windowModality(); | - |
184 | if (modality != Qt::WindowModal) { partially evaluated: modality != Qt::WindowModal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
185 | d->resetModalityTo = modality; | - |
186 | d->wasModalitySet = testAttribute(Qt::WA_SetWindowModality); | - |
187 | setWindowModality(Qt::WindowModal); | - |
188 | setAttribute(Qt::WA_SetWindowModality, false); | - |
189 | | - |
190 | | - |
191 | | - |
192 | } executed: } Execution Count:1 | 1 |
193 | | - |
194 | setResult(0); | - |
195 | show(); | - |
196 | } executed: } Execution Count:1 | 1 |
197 | int QDialog::exec() | - |
198 | { | - |
199 | QDialogPrivate * const d = d_func(); | - |
200 | | - |
201 | if (d->eventLoop) { partially evaluated: d->eventLoop no Evaluation Count:0 | yes Evaluation Count:97 |
| 0-97 |
202 | QMessageLogger("dialogs/qdialog.cpp", 508, __PRETTY_FUNCTION__).warning("QDialog::exec: Recursive call detected"); | - |
203 | return -1; never executed: return -1; | 0 |
204 | } | - |
205 | | - |
206 | bool deleteOnClose = testAttribute(Qt::WA_DeleteOnClose); | - |
207 | setAttribute(Qt::WA_DeleteOnClose, false); | - |
208 | | - |
209 | d->resetModalitySetByOpen(); | - |
210 | | - |
211 | bool wasShowModal = testAttribute(Qt::WA_ShowModal); | - |
212 | setAttribute(Qt::WA_ShowModal, true); | - |
213 | setResult(0); | - |
214 | | - |
215 | show(); | - |
216 | | - |
217 | QPointer<QDialog> guard = this; | - |
218 | if (d->nativeDialogInUse) { partially evaluated: d->nativeDialogInUse no Evaluation Count:0 | yes Evaluation Count:97 |
| 0-97 |
219 | d->platformHelper()->exec(); | - |
220 | } else { | 0 |
221 | QEventLoop eventLoop; | - |
222 | d->eventLoop = &eventLoop; | - |
223 | (void) eventLoop.exec(QEventLoop::DialogExec); | - |
224 | } executed: } Execution Count:97 | 97 |
225 | if (guard.isNull()) evaluated: guard.isNull() yes Evaluation Count:1 | yes Evaluation Count:96 |
| 1-96 |
226 | return QDialog::Rejected; executed: return QDialog::Rejected; Execution Count:1 | 1 |
227 | d->eventLoop = 0; | - |
228 | | - |
229 | setAttribute(Qt::WA_ShowModal, wasShowModal); | - |
230 | | - |
231 | int res = result(); | - |
232 | if (d->nativeDialogInUse) partially evaluated: d->nativeDialogInUse no Evaluation Count:0 | yes Evaluation Count:96 |
| 0-96 |
233 | d->helperDone(static_cast<QDialog::DialogCode>(res), d->platformHelper()); never executed: d->helperDone(static_cast<QDialog::DialogCode>(res), d->platformHelper()); | 0 |
234 | if (deleteOnClose) evaluated: deleteOnClose yes Evaluation Count:2 | yes Evaluation Count:94 |
| 2-94 |
235 | delete this; executed: delete this; Execution Count:2 | 2 |
236 | return res; executed: return res; Execution Count:96 | 96 |
237 | } | - |
238 | void QDialog::done(int r) | - |
239 | { | - |
240 | QDialogPrivate * const d = d_func(); | - |
241 | hide(); | - |
242 | setResult(r); | - |
243 | | - |
244 | d->close_helper(QWidgetPrivate::CloseNoEvent); | - |
245 | d->resetModalitySetByOpen(); | - |
246 | | - |
247 | finished(r); | - |
248 | if (r == Accepted) evaluated: r == Accepted yes Evaluation Count:52 | yes Evaluation Count:61 |
| 52-61 |
249 | accepted(); executed: accepted(); Execution Count:52 | 52 |
250 | else if (r == Rejected) evaluated: r == Rejected yes Evaluation Count:32 | yes Evaluation Count:29 |
| 29-32 |
251 | rejected(); executed: rejected(); Execution Count:32 | 32 |
252 | } | - |
253 | | - |
254 | | - |
255 | | - |
256 | | - |
257 | | - |
258 | | - |
259 | | - |
260 | void QDialog::accept() | - |
261 | { | - |
262 | done(Accepted); | - |
263 | } executed: } Execution Count:20 | 20 |
264 | | - |
265 | | - |
266 | | - |
267 | | - |
268 | | - |
269 | | - |
270 | | - |
271 | void QDialog::reject() | - |
272 | { | - |
273 | done(Rejected); | - |
274 | } executed: } Execution Count:30 | 30 |
275 | | - |
276 | | - |
277 | bool QDialog::eventFilter(QObject *o, QEvent *e) | - |
278 | { | - |
279 | return QWidget::eventFilter(o, e); executed: return QWidget::eventFilter(o, e); Execution Count:303 | 303 |
280 | } | - |
281 | | - |
282 | | - |
283 | | - |
284 | | - |
285 | | - |
286 | | - |
287 | | - |
288 | void QDialog::contextMenuEvent(QContextMenuEvent *e) | - |
289 | { | - |
290 | | - |
291 | | - |
292 | | - |
293 | QWidget *w = childAt(e->pos()); | - |
294 | if (!w) { | 0 |
295 | w = rect().contains(e->pos()) ? this : 0; never evaluated: rect().contains(e->pos()) | 0 |
296 | if (!w) | 0 |
297 | return; | 0 |
298 | } | 0 |
299 | while (w && w->whatsThis().size() == 0 && !w->testAttribute(Qt::WA_CustomWhatsThis)) never evaluated: w->whatsThis().size() == 0 never evaluated: !w->testAttribute(Qt::WA_CustomWhatsThis) | 0 |
300 | w = w->isWindow() ? 0 : w->parentWidget(); never evaluated: w->isWindow() never executed: w = w->isWindow() ? 0 : w->parentWidget(); | 0 |
301 | if (w) { | 0 |
302 | QPointer<QMenu> p = new QMenu(this); | - |
303 | QAction *wt = p.data()->addAction(tr("What's This?")); | - |
304 | if (p.data()->exec(e->globalPos()) == wt) { never evaluated: p.data()->exec(e->globalPos()) == wt | 0 |
305 | QHelpEvent e(QEvent::WhatsThis, w->rect().center(), | - |
306 | w->mapToGlobal(w->rect().center())); | - |
307 | QApplication::sendEvent(w, &e); | - |
308 | } | 0 |
309 | delete p.data(); | - |
310 | } | 0 |
311 | | - |
312 | } | 0 |
313 | | - |
314 | | - |
315 | | - |
316 | void QDialog::keyPressEvent(QKeyEvent *e) | - |
317 | { | - |
318 | if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) { partially evaluated: !e->modifiers() yes Evaluation Count:35 | no Evaluation Count:0 |
never evaluated: e->modifiers() & Qt::KeypadModifier never evaluated: e->key() == Qt::Key_Enter | 0-35 |
319 | switch (e->key()) { | - |
320 | case Qt::Key_Enter: | - |
321 | case Qt::Key_Return: { | - |
322 | QList<QPushButton*> list = findChildren<QPushButton*>(); | - |
323 | for (int i=0; i<list.size(); ++i) { partially evaluated: i<list.size() yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
324 | QPushButton *pb = list.at(i); | - |
325 | if (pb->isDefault() && pb->isVisible()) { evaluated: pb->isDefault() yes Evaluation Count:29 | yes Evaluation Count:15 |
partially evaluated: pb->isVisible() yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
326 | if (pb->isEnabled()) evaluated: pb->isEnabled() yes Evaluation Count:28 | yes Evaluation Count:1 |
| 1-28 |
327 | pb->click(); executed: pb->click(); Execution Count:28 | 28 |
328 | return; executed: return; Execution Count:29 | 29 |
329 | } | - |
330 | } executed: } Execution Count:15 | 15 |
331 | } | - |
332 | break; | 0 |
333 | case Qt::Key_Escape: | - |
334 | reject(); | - |
335 | break; executed: break; Execution Count:1 | 1 |
336 | default: | - |
337 | e->ignore(); | - |
338 | return; executed: return; Execution Count:5 | 5 |
339 | } | - |
340 | } else { executed: } Execution Count:1 | 1 |
341 | e->ignore(); | - |
342 | } | 0 |
343 | } | - |
344 | | - |
345 | | - |
346 | void QDialog::closeEvent(QCloseEvent *e) | - |
347 | { | - |
348 | | - |
349 | if (isModal() && QWhatsThis::inWhatsThisMode()) evaluated: isModal() yes Evaluation Count:17 | yes Evaluation Count:10 |
partially evaluated: QWhatsThis::inWhatsThisMode() no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
350 | QWhatsThis::leaveWhatsThisMode(); never executed: QWhatsThis::leaveWhatsThisMode(); | 0 |
351 | | - |
352 | if (isVisible()) { partially evaluated: isVisible() yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
353 | QPointer<QObject> that = this; | - |
354 | reject(); | - |
355 | if (that && isVisible()) partially evaluated: that yes Evaluation Count:27 | no Evaluation Count:0 |
evaluated: isVisible() yes Evaluation Count:1 | yes Evaluation Count:26 |
| 0-27 |
356 | e->ignore(); executed: e->ignore(); Execution Count:1 | 1 |
357 | } else { executed: } Execution Count:27 | 27 |
358 | e->accept(); | - |
359 | } | 0 |
360 | } | - |
361 | void QDialog::setVisible(bool visible) | - |
362 | { | - |
363 | QDialogPrivate * const d = d_func(); | - |
364 | if (visible) { evaluated: visible yes Evaluation Count:243 | yes Evaluation Count:516 |
| 243-516 |
365 | if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide) yes Evaluation Count:38 | yes Evaluation Count:205 |
evaluated: !testAttribute(Qt::WA_WState_Hidden) yes Evaluation Count:8 | yes Evaluation Count:30 |
| 8-205 |
366 | return; executed: return; Execution Count:8 | 8 |
367 | | - |
368 | if (!testAttribute(Qt::WA_Moved)) { evaluated: !testAttribute(Qt::WA_Moved) yes Evaluation Count:231 | yes Evaluation Count:4 |
| 4-231 |
369 | Qt::WindowStates state = windowState(); | - |
370 | adjustPosition(parentWidget()); | - |
371 | setAttribute(Qt::WA_Moved, false); | - |
372 | if (state != windowState()) partially evaluated: state != windowState() no Evaluation Count:0 | yes Evaluation Count:231 |
| 0-231 |
373 | setWindowState(state); never executed: setWindowState(state); | 0 |
374 | } executed: } Execution Count:231 | 231 |
375 | QWidget::setVisible(visible); | - |
376 | showExtension(d->doShowExtension); | - |
377 | QWidget *fw = window()->focusWidget(); | - |
378 | if (!fw) evaluated: !fw yes Evaluation Count:77 | yes Evaluation Count:158 |
| 77-158 |
379 | fw = this; executed: fw = this; Execution Count:77 | 77 |
380 | if (d->mainDef && fw->focusPolicy() == Qt::NoFocus) { evaluated: d->mainDef yes Evaluation Count:166 | yes Evaluation Count:69 |
evaluated: fw->focusPolicy() == Qt::NoFocus yes Evaluation Count:10 | yes Evaluation Count:156 |
| 10-166 |
381 | QWidget *first = fw; | - |
382 | while ((first = first->nextInFocusChain()) != fw && first->focusPolicy() == Qt::NoFocus) partially evaluated: (first = first->nextInFocusChain()) != fw yes Evaluation Count:24 | no Evaluation Count:0 |
evaluated: first->focusPolicy() == Qt::NoFocus yes Evaluation Count:14 | yes Evaluation Count:10 |
| 0-24 |
383 | ; executed: ; Execution Count:14 | 14 |
384 | if (first != d->mainDef && qobject_cast<QPushButton*>(first)) evaluated: first != d->mainDef yes Evaluation Count:7 | yes Evaluation Count:3 |
evaluated: qobject_cast<QPushButton*>(first) yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-7 |
385 | d->mainDef->setFocus(); executed: d->mainDef->setFocus(); Execution Count:1 | 1 |
386 | } executed: } Execution Count:10 | 10 |
387 | if (!d->mainDef && isWindow()) { evaluated: !d->mainDef yes Evaluation Count:69 | yes Evaluation Count:166 |
evaluated: isWindow() yes Evaluation Count:68 | yes Evaluation Count:1 |
| 1-166 |
388 | QWidget *w = fw; | - |
389 | while ((w = w->nextInFocusChain()) != fw) { evaluated: (w = w->nextInFocusChain()) != fw yes Evaluation Count:145 | yes Evaluation Count:38 |
| 38-145 |
390 | QPushButton *pb = qobject_cast<QPushButton *>(w); | - |
391 | if (pb && pb->autoDefault() && pb->focusPolicy() != Qt::NoFocus) { evaluated: pb yes Evaluation Count:30 | yes Evaluation Count:115 |
partially evaluated: pb->autoDefault() yes Evaluation Count:30 | no Evaluation Count:0 |
partially evaluated: pb->focusPolicy() != Qt::NoFocus yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-115 |
392 | pb->setDefault(true); | - |
393 | break; executed: break; Execution Count:30 | 30 |
394 | } | - |
395 | } executed: } Execution Count:115 | 115 |
396 | } executed: } Execution Count:68 | 68 |
397 | if (fw && !fw->hasFocus()) { partially evaluated: fw yes Evaluation Count:235 | no Evaluation Count:0 |
partially evaluated: !fw->hasFocus() yes Evaluation Count:235 | no Evaluation Count:0 |
| 0-235 |
398 | QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason); | - |
399 | QApplication::sendEvent(fw, &e); | - |
400 | } executed: } Execution Count:235 | 235 |
401 | | - |
402 | | - |
403 | QAccessibleEvent event(this, QAccessible::DialogStart); | - |
404 | QAccessible::updateAccessibility(&event); | - |
405 | | - |
406 | | - |
407 | } else { executed: } Execution Count:235 | 235 |
408 | if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide) yes Evaluation Count:336 | yes Evaluation Count:180 |
evaluated: testAttribute(Qt::WA_WState_Hidden) yes Evaluation Count:104 | yes Evaluation Count:232 |
| 104-336 |
409 | return; executed: return; Execution Count:104 | 104 |
410 | | - |
411 | | - |
412 | if (isVisible()) { evaluated: isVisible() yes Evaluation Count:231 | yes Evaluation Count:181 |
| 181-231 |
413 | QAccessibleEvent event(this, QAccessible::DialogEnd); | - |
414 | QAccessible::updateAccessibility(&event); | - |
415 | } executed: } Execution Count:231 | 231 |
416 | | - |
417 | | - |
418 | | - |
419 | QWidget::setVisible(visible); | - |
420 | if (d->eventLoop) evaluated: d->eventLoop yes Evaluation Count:97 | yes Evaluation Count:315 |
| 97-315 |
421 | d->eventLoop->exit(); executed: d->eventLoop->exit(); Execution Count:97 | 97 |
422 | } executed: } Execution Count:412 | 412 |
423 | if (d->mainDef && isActiveWindow() evaluated: d->mainDef yes Evaluation Count:407 | yes Evaluation Count:240 |
partially evaluated: isActiveWindow() no Evaluation Count:0 | yes Evaluation Count:407 |
| 0-407 |
424 | && d->styleHint(QPlatformDialogHelper::SnapToDefaultButton).toBool()) never evaluated: d->styleHint(QPlatformDialogHelper::SnapToDefaultButton).toBool() | 0 |
425 | QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center())); never executed: QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center())); | 0 |
426 | } executed: } Execution Count:647 | 647 |
427 | | - |
428 | | - |
429 | void QDialog::showEvent(QShowEvent *event) | - |
430 | { | - |
431 | if (!event->spontaneous() && !testAttribute(Qt::WA_Moved)) { partially evaluated: !event->spontaneous() yes Evaluation Count:231 | no Evaluation Count:0 |
evaluated: !testAttribute(Qt::WA_Moved) yes Evaluation Count:227 | yes Evaluation Count:4 |
| 0-231 |
432 | Qt::WindowStates state = windowState(); | - |
433 | adjustPosition(parentWidget()); | - |
434 | setAttribute(Qt::WA_Moved, false); | - |
435 | if (state != windowState()) partially evaluated: state != windowState() no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
436 | setWindowState(state); never executed: setWindowState(state); | 0 |
437 | } executed: } Execution Count:227 | 227 |
438 | } executed: } Execution Count:231 | 231 |
439 | | - |
440 | | - |
441 | void QDialog::adjustPosition(QWidget* w) | - |
442 | { | - |
443 | | - |
444 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme() yes Evaluation Count:458 | no Evaluation Count:0 |
| 0-458 |
445 | if (theme->themeHint(QPlatformTheme::WindowAutoPlacement).toBool()) partially evaluated: theme->themeHint(QPlatformTheme::WindowAutoPlacement).toBool() no Evaluation Count:0 | yes Evaluation Count:458 |
| 0-458 |
446 | return; | 0 |
447 | QPoint p(0, 0); | - |
448 | int extraw = 0, extrah = 0, scrn = 0; | - |
449 | if (w) evaluated: w yes Evaluation Count:78 | yes Evaluation Count:380 |
| 78-380 |
450 | w = w->window(); executed: w = w->window(); Execution Count:78 | 78 |
451 | QRect desk; | - |
452 | if (w) { evaluated: w yes Evaluation Count:78 | yes Evaluation Count:380 |
| 78-380 |
453 | scrn = QApplication::desktop()->screenNumber(w); | - |
454 | } else if (QApplication::desktop()->isVirtualDesktop()) { partially evaluated: QApplication::desktop()->isVirtualDesktop() no Evaluation Count:0 | yes Evaluation Count:380 |
executed: } Execution Count:78 | 0-380 |
455 | scrn = QApplication::desktop()->screenNumber(QCursor::pos()); | - |
456 | } else { | 0 |
457 | scrn = QApplication::desktop()->screenNumber(this); | - |
458 | } executed: } Execution Count:380 | 380 |
459 | desk = QApplication::desktop()->availableGeometry(scrn); | - |
460 | | - |
461 | QWidgetList list = QApplication::topLevelWidgets(); | - |
462 | for (int i = 0; (extraw == 0 || extrah == 0) && i < list.size(); ++i) { evaluated: extraw == 0 yes Evaluation Count:1133 | yes Evaluation Count:60 |
partially evaluated: extrah == 0 no Evaluation Count:0 | yes Evaluation Count:60 |
evaluated: i < list.size() yes Evaluation Count:735 | yes Evaluation Count:398 |
| 0-1133 |
463 | QWidget * current = list.at(i); | - |
464 | if (current->isVisible()) { evaluated: current->isVisible() yes Evaluation Count:292 | yes Evaluation Count:443 |
| 292-443 |
465 | int framew = current->geometry().x() - current->x(); | - |
466 | int frameh = current->geometry().y() - current->y(); | - |
467 | | - |
468 | extraw = qMax(extraw, framew); | - |
469 | extrah = qMax(extrah, frameh); | - |
470 | } executed: } Execution Count:292 | 292 |
471 | } executed: } Execution Count:735 | 735 |
472 | | - |
473 | | - |
474 | | - |
475 | if (extraw == 0 || extrah == 0 || extraw >= 10 || extrah >= 40) { evaluated: extraw == 0 yes Evaluation Count:398 | yes Evaluation Count:60 |
partially evaluated: extrah == 0 no Evaluation Count:0 | yes Evaluation Count:60 |
partially evaluated: extraw >= 10 no Evaluation Count:0 | yes Evaluation Count:60 |
partially evaluated: extrah >= 40 no Evaluation Count:0 | yes Evaluation Count:60 |
| 0-398 |
476 | extrah = 40; | - |
477 | extraw = 10; | - |
478 | } executed: } Execution Count:398 | 398 |
479 | | - |
480 | | - |
481 | if (w) { evaluated: w yes Evaluation Count:78 | yes Evaluation Count:380 |
| 78-380 |
482 | | - |
483 | QPoint pp; | - |
484 | if (w->windowHandle() && w->windowHandle()->property("_q_embedded_native_parent_handle").value<WId>()) evaluated: w->windowHandle() yes Evaluation Count:46 | yes Evaluation Count:32 |
partially evaluated: w->windowHandle()->property("_q_embedded_native_parent_handle").value<WId>() no Evaluation Count:0 | yes Evaluation Count:46 |
| 0-46 |
485 | pp = w->pos(); never executed: pp = w->pos(); | 0 |
486 | else | - |
487 | pp = w->mapToGlobal(QPoint(0,0)); executed: pp = w->mapToGlobal(QPoint(0,0)); Execution Count:78 | 78 |
488 | p = QPoint(pp.x() + w->width()/2, | - |
489 | pp.y() + w->height()/ 2); | - |
490 | } else { executed: } Execution Count:78 | 78 |
491 | | - |
492 | p = QPoint(desk.x() + desk.width()/2, desk.y() + desk.height()/2); | - |
493 | } executed: } Execution Count:380 | 380 |
494 | | - |
495 | | - |
496 | p = QPoint(p.x()-width()/2 - extraw, | - |
497 | p.y()-height()/2 - extrah); | - |
498 | | - |
499 | | - |
500 | if (p.x() + extraw + width() > desk.x() + desk.width()) evaluated: p.x() + extraw + width() > desk.x() + desk.width() yes Evaluation Count:12 | yes Evaluation Count:446 |
| 12-446 |
501 | p.setX(desk.x() + desk.width() - width() - extraw); executed: p.setX(desk.x() + desk.width() - width() - extraw); Execution Count:12 | 12 |
502 | if (p.x() < desk.x()) evaluated: p.x() < desk.x() yes Evaluation Count:12 | yes Evaluation Count:446 |
| 12-446 |
503 | p.setX(desk.x()); executed: p.setX(desk.x()); Execution Count:12 | 12 |
504 | | - |
505 | if (p.y() + extrah + height() > desk.y() + desk.height()) evaluated: p.y() + extrah + height() > desk.y() + desk.height() yes Evaluation Count:12 | yes Evaluation Count:446 |
| 12-446 |
506 | p.setY(desk.y() + desk.height() - height() - extrah); executed: p.setY(desk.y() + desk.height() - height() - extrah); Execution Count:12 | 12 |
507 | if (p.y() < desk.y()) evaluated: p.y() < desk.y() yes Evaluation Count:12 | yes Evaluation Count:446 |
| 12-446 |
508 | p.setY(desk.y()); executed: p.setY(desk.y()); Execution Count:12 | 12 |
509 | | - |
510 | move(p); | - |
511 | } executed: } Execution Count:458 | 458 |
512 | void QDialog::setOrientation(Qt::Orientation orientation) | - |
513 | { | - |
514 | QDialogPrivate * const d = d_func(); | - |
515 | d->orientation = orientation; | - |
516 | } executed: } Execution Count:4 | 4 |
517 | Qt::Orientation QDialog::orientation() const | - |
518 | { | - |
519 | const QDialogPrivate * const d = d_func(); | - |
520 | return d->orientation; never executed: return d->orientation; | 0 |
521 | } | - |
522 | void QDialog::setExtension(QWidget* extension) | - |
523 | { | - |
524 | QDialogPrivate * const d = d_func(); | - |
525 | delete d->extension; | - |
526 | d->extension = extension; | - |
527 | | - |
528 | if (!extension) evaluated: !extension yes Evaluation Count:5 | yes Evaluation Count:6 |
| 5-6 |
529 | return; executed: return; Execution Count:5 | 5 |
530 | | - |
531 | if (extension->parentWidget() != this) evaluated: extension->parentWidget() != this yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
532 | extension->setParent(this); executed: extension->setParent(this); Execution Count:1 | 1 |
533 | extension->hide(); | - |
534 | } executed: } Execution Count:6 | 6 |
535 | QWidget* QDialog::extension() const | - |
536 | { | - |
537 | const QDialogPrivate * const d = d_func(); | - |
538 | return d->extension; executed: return d->extension; Execution Count:13 | 13 |
539 | } | - |
540 | void QDialog::showExtension(bool showIt) | - |
541 | { | - |
542 | QDialogPrivate * const d = d_func(); | - |
543 | d->doShowExtension = showIt; | - |
544 | if (!d->extension) evaluated: !d->extension yes Evaluation Count:234 | yes Evaluation Count:13 |
| 13-234 |
545 | return; executed: return; Execution Count:234 | 234 |
546 | if (!testAttribute(Qt::WA_WState_Visible)) partially evaluated: !testAttribute(Qt::WA_WState_Visible) no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
547 | return; | 0 |
548 | if (d->extension->isVisible() == showIt) evaluated: d->extension->isVisible() == showIt yes Evaluation Count:1 | yes Evaluation Count:12 |
| 1-12 |
549 | return; executed: return; Execution Count:1 | 1 |
550 | | - |
551 | if (showIt) { evaluated: showIt yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
552 | d->size = size(); | - |
553 | d->min = minimumSize(); | - |
554 | d->max = maximumSize(); | - |
555 | if (layout()) partially evaluated: layout() no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
556 | layout()->setEnabled(false); never executed: layout()->setEnabled(false); | 0 |
557 | QSize s(d->extension->sizeHint() | - |
558 | .expandedTo(d->extension->minimumSize()) | - |
559 | .boundedTo(d->extension->maximumSize())); | - |
560 | if (d->orientation == Qt::Horizontal) { evaluated: d->orientation == Qt::Horizontal yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
561 | int h = qMax(height(), s.height()); | - |
562 | d->extension->setGeometry(width(), 0, s.width(), h); | - |
563 | setFixedSize(width() + s.width(), h); | - |
564 | } else { executed: } Execution Count:4 | 4 |
565 | int w = qMax(width(), s.width()); | - |
566 | d->extension->setGeometry(0, height(), w, s.height()); | - |
567 | setFixedSize(w, height() + s.height()); | - |
568 | } executed: } Execution Count:2 | 2 |
569 | d->extension->show(); | - |
570 | | - |
571 | const bool sizeGripEnabled = isSizeGripEnabled(); | - |
572 | setSizeGripEnabled(false); | - |
573 | d->sizeGripEnabled = sizeGripEnabled; | - |
574 | | - |
575 | } else { executed: } Execution Count:6 | 6 |
576 | d->extension->hide(); | - |
577 | | - |
578 | setMinimumSize(d->min.expandedTo(QSize(1, 1))); | - |
579 | setMaximumSize(d->max); | - |
580 | resize(d->size); | - |
581 | if (layout()) partially evaluated: layout() no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
582 | layout()->setEnabled(true); never executed: layout()->setEnabled(true); | 0 |
583 | | - |
584 | setSizeGripEnabled(d->sizeGripEnabled); | - |
585 | | - |
586 | } executed: } Execution Count:6 | 6 |
587 | } | - |
588 | | - |
589 | | - |
590 | | - |
591 | QSize QDialog::sizeHint() const | - |
592 | { | - |
593 | const QDialogPrivate * const d = d_func(); | - |
594 | if (d->extension) { partially evaluated: d->extension no Evaluation Count:0 | yes Evaluation Count:315 |
| 0-315 |
595 | if (d->orientation == Qt::Horizontal) never evaluated: d->orientation == Qt::Horizontal | 0 |
596 | return QSize(QWidget::sizeHint().width(), | 0 |
597 | qMax(QWidget::sizeHint().height(),d->extension->sizeHint().height())); never executed: return QSize(QWidget::sizeHint().width(), qMax(QWidget::sizeHint().height(),d->extension->sizeHint().height())); | 0 |
598 | else | - |
599 | return QSize(qMax(QWidget::sizeHint().width(), d->extension->sizeHint().width()), | 0 |
600 | QWidget::sizeHint().height()); never executed: return QSize(qMax(QWidget::sizeHint().width(), d->extension->sizeHint().width()), QWidget::sizeHint().height()); | 0 |
601 | } | - |
602 | return QWidget::sizeHint(); executed: return QWidget::sizeHint(); Execution Count:315 | 315 |
603 | } | - |
604 | | - |
605 | | - |
606 | | - |
607 | QSize QDialog::minimumSizeHint() const | - |
608 | { | - |
609 | const QDialogPrivate * const d = d_func(); | - |
610 | if (d->extension) { partially evaluated: d->extension no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
611 | if (d->orientation == Qt::Horizontal) never evaluated: d->orientation == Qt::Horizontal | 0 |
612 | return QSize(QWidget::minimumSizeHint().width(), | 0 |
613 | qMax(QWidget::minimumSizeHint().height(), d->extension->minimumSizeHint().height())); never executed: return QSize(QWidget::minimumSizeHint().width(), qMax(QWidget::minimumSizeHint().height(), d->extension->minimumSizeHint().height())); | 0 |
614 | else | - |
615 | return QSize(qMax(QWidget::minimumSizeHint().width(), d->extension->minimumSizeHint().width()), | 0 |
616 | QWidget::minimumSizeHint().height()); never executed: return QSize(qMax(QWidget::minimumSizeHint().width(), d->extension->minimumSizeHint().width()), QWidget::minimumSizeHint().height()); | 0 |
617 | } | - |
618 | | - |
619 | return QWidget::minimumSizeHint(); executed: return QWidget::minimumSizeHint(); Execution Count:7 | 7 |
620 | } | - |
621 | void QDialog::setModal(bool modal) | - |
622 | { | - |
623 | setAttribute(Qt::WA_ShowModal, modal); | - |
624 | } executed: } Execution Count:42 | 42 |
625 | | - |
626 | | - |
627 | bool QDialog::isSizeGripEnabled() const | - |
628 | { | - |
629 | | - |
630 | const QDialogPrivate * const d = d_func(); | - |
631 | return !!d->resizer; executed: return !!d->resizer; Execution Count:14 | 14 |
632 | | - |
633 | | - |
634 | | - |
635 | } | - |
636 | | - |
637 | | - |
638 | void QDialog::setSizeGripEnabled(bool enabled) | - |
639 | { | - |
640 | | - |
641 | | - |
642 | | - |
643 | QDialogPrivate * const d = d_func(); | - |
644 | | - |
645 | d->sizeGripEnabled = enabled; | - |
646 | if (enabled && d->doShowExtension) evaluated: enabled yes Evaluation Count:197 | yes Evaluation Count:15 |
partially evaluated: d->doShowExtension no Evaluation Count:0 | yes Evaluation Count:197 |
| 0-197 |
647 | return; | 0 |
648 | | - |
649 | if (!enabled != !d->resizer) { evaluated: !enabled != !d->resizer yes Evaluation Count:199 | yes Evaluation Count:13 |
| 13-199 |
650 | if (enabled) { evaluated: enabled yes Evaluation Count:197 | yes Evaluation Count:2 |
| 2-197 |
651 | d->resizer = new QSizeGrip(this); | - |
652 | | - |
653 | d->resizer->resize(d->resizer->sizeHint()); | - |
654 | if (isRightToLeft()) partially evaluated: isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:197 |
| 0-197 |
655 | d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft()); never executed: d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft()); | 0 |
656 | else | - |
657 | d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight()); executed: d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight()); Execution Count:197 | 197 |
658 | d->resizer->raise(); | - |
659 | d->resizer->show(); | - |
660 | } else { executed: } Execution Count:197 | 197 |
661 | delete d->resizer; | - |
662 | d->resizer = 0; | - |
663 | } executed: } Execution Count:2 | 2 |
664 | } | - |
665 | | - |
666 | } executed: } Execution Count:212 | 212 |
667 | | - |
668 | | - |
669 | | - |
670 | | - |
671 | void QDialog::resizeEvent(QResizeEvent *) | - |
672 | { | - |
673 | | - |
674 | QDialogPrivate * const d = d_func(); | - |
675 | if (d->resizer) { evaluated: d->resizer yes Evaluation Count:82 | yes Evaluation Count:255 |
| 82-255 |
676 | if (isRightToLeft()) partially evaluated: isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:82 |
| 0-82 |
677 | d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft()); never executed: d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft()); | 0 |
678 | else | - |
679 | d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight()); executed: d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight()); Execution Count:82 | 82 |
680 | d->resizer->raise(); | - |
681 | } executed: } Execution Count:82 | 82 |
682 | | - |
683 | } executed: } Execution Count:337 | 337 |
684 | | - |
685 | | - |
| | |