qdialog.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9