qmessagebox.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5, Old_Retry = 6,-
12 Old_Ignore = 7, Old_YesAll = 8, Old_NoAll = 9, Old_ButtonMask = 0xFF,-
13 NewButtonMask = 0xFFFFFC00 };-
14-
15enum DetailButtonLabel { ShowLabel = 0, HideLabel = 1 };-
16-
17class QMessageBoxDetailsText : public QWidget-
18{-
19 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
20#pragma GCC diagnostic push-
21 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
22#pragma GCC diagnostic pop-
23 struct QPrivateSignal {};-
24public:-
25 class TextEdit : public QTextEdit-
26 {-
27 public:-
28 TextEdit(QWidget *parent=0) : QTextEdit(parent) { }
never executed: end of block
0
29-
30 void contextMenuEvent(QContextMenuEvent * e) override-
31 {-
32 QMenu *menu = createStandardContextMenu();-
33 menu->setAttribute(Qt::WA_DeleteOnClose);-
34 menu->popup(e->globalPos());-
35 }
never executed: end of block
0
36-
37 };-
38-
39 QMessageBoxDetailsText(QWidget *parent=0)-
40 : QWidget(parent)-
41 , copyAvailable(false)-
42 {-
43 QVBoxLayout *layout = new QVBoxLayout;-
44 layout->setMargin(0);-
45 QFrame *line = new QFrame(this);-
46 line->setFrameShape(QFrame::HLine);-
47 line->setFrameShadow(QFrame::Sunken);-
48 layout->addWidget(line);-
49 textEdit = new TextEdit();-
50 textEdit->setFixedHeight(100);-
51 textEdit->setFocusPolicy(Qt::NoFocus);-
52 textEdit->setReadOnly(true);-
53 layout->addWidget(textEdit);-
54 setLayout(layout);-
55-
56 connect(textEdit, qFlagLocation("2""copyAvailable(bool)" "\0" __FILE__ ":" "125"),-
57 this, qFlagLocation("1""textCopyAvailable(bool)" "\0" __FILE__ ":" "126"));-
58 }
never executed: end of block
0
59 void setText(const QString &text) { textEdit->setPlainText(text); }
never executed: end of block
0
60 QString text() const { return
never executed: return textEdit->toPlainText();
textEdit->toPlainText();
never executed: return textEdit->toPlainText();
}
0
61-
62 bool copy()-
63 {-
64-
65-
66-
67 if (!copyAvailable
!copyAvailableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
68 return
never executed: return false;
false;
never executed: return false;
0
69 textEdit->copy();-
70 return
never executed: return true;
true;
never executed: return true;
0
71-
72 }-
73-
74 void selectAll()-
75 {-
76 textEdit->selectAll();-
77 }
never executed: end of block
0
78-
79private :-
80 void textCopyAvailable(bool available)-
81 {-
82 copyAvailable = available;-
83 }
never executed: end of block
0
84-
85private:-
86 bool copyAvailable;-
87 TextEdit *textEdit;-
88};-
89-
90-
91class DetailButton : public QPushButton-
92{-
93public:-
94 DetailButton(QWidget *parent) : QPushButton(label(ShowLabel), parent)-
95 {-
96 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);-
97 }
never executed: end of block
0
98-
99 QString label(DetailButtonLabel label) const-
100 { return
never executed: return label == ShowLabel ? QMessageBox::tr("Show Details...") : QMessageBox::tr("Hide Details...");
label == ShowLabel ? QMessageBox::tr("Show Details...") : QMessageBox::tr("Hide Details...");
never executed: return label == ShowLabel ? QMessageBox::tr("Show Details...") : QMessageBox::tr("Hide Details...");
}
0
101-
102 void setLabel(DetailButtonLabel lbl)-
103 { setText(label(lbl)); }
never executed: end of block
0
104-
105 QSize sizeHint() const override-
106 {-
107 ensurePolished();-
108 QStyleOptionButton opt;-
109 initStyleOption(&opt);-
110 const QFontMetrics fm = fontMetrics();-
111 opt.text = label(ShowLabel);-
112 QSize sz = fm.size(Qt::TextShowMnemonic, opt.text);-
113 QSize ret = style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this).-
114 expandedTo(QApplication::globalStrut());-
115 opt.text = label(HideLabel);-
116 sz = fm.size(Qt::TextShowMnemonic, opt.text);-
117 ret = ret.expandedTo(style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this).-
118 expandedTo(QApplication::globalStrut()));-
119 return
never executed: return ret;
ret;
never executed: return ret;
0
120 }-
121};-
122-
123class QMessageBoxPrivate : public QDialogPrivate-
124{-
125 inline QMessageBox* q_func() { return static_cast<QMessageBox *>(q_ptr); } inline const QMessageBox* q_func() const { return static_cast<const QMessageBox *>(q_ptr); } friend class QMessageBox;-
126-
127public:-
128 QMessageBoxPrivate() : escapeButton(0), defaultButton(0), checkbox(0), clickedButton(0), detailsButton(0),-
129-
130 detailsText(0),-
131-
132 compatMode(false), autoAddOkButton(true),-
133 detectedEscapeButton(0), informativeLabel(0),-
134 options(new QMessageDialogOptions) { }
never executed: end of block
0
135-
136 void init(const QString &title = QString(), const QString &text = QString());-
137 void setupLayout();-
138 void _q_buttonClicked(QAbstractButton *);-
139 void _q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role);-
140-
141 QAbstractButton *findButton(int button0, int button1, int button2, int flags);-
142 void addOldButtons(int button0, int button1, int button2);-
143-
144 QAbstractButton *abstractButtonForId(int id) const;-
145 int execReturnCode(QAbstractButton *button);-
146-
147 void detectEscapeButton();-
148 void updateSize();-
149 int layoutMinimumWidth();-
150 void retranslateStrings();-
151-
152-
153-
154-
155 static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon,-
156 const QString &title, const QString &text,-
157 int button0, int button1, int button2);-
158 static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon,-
159 const QString &title, const QString &text,-
160 const QString &button0Text,-
161 const QString &button1Text,-
162 const QString &button2Text,-
163 int defaultButtonNumber,-
164 int escapeButtonNumber);-
165-
166 static QMessageBox::StandardButton showNewMessageBox(QWidget *parent,-
167 QMessageBox::Icon icon, const QString& title, const QString& text,-
168 QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton);-
169-
170 static QPixmap standardIcon(QMessageBox::Icon icon, QMessageBox *mb);-
171-
172 QLabel *label;-
173 QMessageBox::Icon icon;-
174 QLabel *iconLabel;-
175 QDialogButtonBox *buttonBox;-
176 QList<QAbstractButton *> customButtonList;-
177 QAbstractButton *escapeButton;-
178 QPushButton *defaultButton;-
179 QCheckBox *checkbox;-
180 QAbstractButton *clickedButton;-
181 DetailButton *detailsButton;-
182-
183 QMessageBoxDetailsText *detailsText;-
184-
185 bool compatMode;-
186 bool autoAddOkButton;-
187 QAbstractButton *detectedEscapeButton;-
188 QLabel *informativeLabel;-
189 QPointer<QObject> receiverToDisconnectOnClose;-
190 QByteArray memberToDisconnectOnClose;-
191 QByteArray signalToDisconnectOnClose;-
192 QSharedPointer<QMessageDialogOptions> options;-
193private:-
194 void initHelper(QPlatformDialogHelper *) override;-
195 void helperPrepareShow(QPlatformDialogHelper *) override;-
196 void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) override;-
197};-
198-
199void QMessageBoxPrivate::init(const QString &title, const QString &text)-
200{-
201 QMessageBox * const q = q_func();-
202-
203 label = new QLabel;-
204 label->setObjectName(QLatin1String("qt_msgbox_label"));-
205 label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q)));-
206 label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);-
207 label->setOpenExternalLinks(true);-
208 iconLabel = new QLabel(q);-
209 iconLabel->setObjectName(QLatin1String("qt_msgboxex_icon_label"));-
210 iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);-
211-
212 buttonBox = new QDialogButtonBox;-
213 buttonBox->setObjectName(QLatin1String("qt_msgbox_buttonbox"));-
214 buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, q));-
215 QObject::connect(buttonBox, qFlagLocation("2""clicked(QAbstractButton*)" "\0" __FILE__ ":" "284"),-
216 q, qFlagLocation("1""_q_buttonClicked(QAbstractButton*)" "\0" __FILE__ ":" "285"));-
217 setupLayout();-
218 if (!title.isEmpty()
!title.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| !text.isEmpty()
!text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
219 q->setWindowTitle(title);-
220 q->setText(text);-
221 }
never executed: end of block
0
222 q->setModal(true);-
223-
224-
225-
226-
227-
228 icon = QMessageBox::NoIcon;-
229}
never executed: end of block
0
230-
231void QMessageBoxPrivate::setupLayout()-
232{-
233 QMessageBox * const q = q_func();-
234 delete q->layout();-
235 QGridLayout *grid = new QGridLayout;-
236 bool hasIcon = iconLabel->pixmap()
iconLabel->pixmap()Description
TRUEnever evaluated
FALSEnever evaluated
&& !iconLabel->pixmap()->isNull()
!iconLabel->pixmap()->isNull()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
237-
238 if (hasIcon
hasIconDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
239 grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop);
never executed: grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop);
0
240 iconLabel->setVisible(hasIcon);-
241-
242-
243-
244 QSpacerItem *indentSpacer = new QSpacerItem(hasIcon ? 7 : 15, 1, QSizePolicy::Fixed, QSizePolicy::Fixed);-
245-
246 grid->addItem(indentSpacer, 0, hasIcon ? 1 : 0, 2, 1);-
247 grid->addWidget(label, 0, hasIcon ? 2 : 1, 1, 1);-
248 if (informativeLabel
informativeLabelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
249-
250 informativeLabel->setContentsMargins(0, 7, 0, 7);-
251-
252 grid->addWidget(informativeLabel, 1, hasIcon ? 2 : 1, 1, 1);-
253 }
never executed: end of block
0
254 if (checkbox
checkboxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
255 grid->addWidget(checkbox, informativeLabel ? 2 : 1, hasIcon ? 2 : 1, 1, 1, Qt::AlignLeft);-
256-
257-
258-
259 grid->addItem(new QSpacerItem(1, 7, QSizePolicy::Fixed, QSizePolicy::Fixed), grid->rowCount(), 0);-
260-
261 }
never executed: end of block
0
262 grid->addWidget(buttonBox, grid->rowCount(), 0, 1, grid->columnCount());-
263-
264 if (detailsText
detailsTextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
265 grid->addWidget(detailsText, grid->rowCount(), 0, 1, grid->columnCount());
never executed: grid->addWidget(detailsText, grid->rowCount(), 0, 1, grid->columnCount());
0
266 grid->setSizeConstraint(QLayout::SetNoConstraint);-
267 q->setLayout(grid);-
268-
269 retranslateStrings();-
270 updateSize();-
271}
never executed: end of block
0
272-
273int QMessageBoxPrivate::layoutMinimumWidth()-
274{-
275 layout->activate();-
276 return
never executed: return layout->totalMinimumSize().width();
layout->totalMinimumSize().width();
never executed: return layout->totalMinimumSize().width();
0
277}-
278-
279void QMessageBoxPrivate::updateSize()-
280{-
281 QMessageBox * const q = q_func();-
282-
283 if (!q->isVisible()
!q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
284 return;
never executed: return;
0
285-
286 QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();-
287-
288-
289-
290-
291 int hardLimit = qMin(screenSize.width() - 480, 1000);-
292-
293 if (screenSize.width() <= 1024
screenSize.width() <= 1024Description
TRUEnever evaluated
FALSEnever evaluated
)
0
294 hardLimit = screenSize.width();
never executed: hardLimit = screenSize.width();
0
295-
296-
297-
298-
299-
300-
301 int softLimit = qMin(screenSize.width()/2, 500);-
302-
303-
304-
305-
306-
307 if (informativeLabel
informativeLabelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
308 informativeLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
never executed: informativeLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
0
309-
310 label->setWordWrap(false);-
311 int width = layoutMinimumWidth();-
312-
313 if (width > softLimit
width > softLimitDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
314 label->setWordWrap(true);-
315 width = qMax(softLimit, layoutMinimumWidth());-
316-
317 if (width > hardLimit
width > hardLimitDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
318 label->d_func()->ensureTextControl();-
319 if (QWidgetTextControl *control = label->d_func()->control
QWidgetTextCon...unc()->controlDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
320 QTextOption opt = control->document()->defaultTextOption();-
321 opt.setWrapMode(QTextOption::WrapAnywhere);-
322 control->document()->setDefaultTextOption(opt);-
323 }
never executed: end of block
0
324 width = hardLimit;-
325 }
never executed: end of block
0
326 }
never executed: end of block
0
327-
328 if (informativeLabel
informativeLabelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
329 label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);-
330 QSizePolicy policy(QSizePolicy::Minimum, QSizePolicy::Preferred);-
331 policy.setHeightForWidth(true);-
332 informativeLabel->setSizePolicy(policy);-
333 width = qMax(width, layoutMinimumWidth());-
334 if (width > hardLimit
width > hardLimitDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
335 informativeLabel->d_func()->ensureTextControl();-
336 if (QWidgetTextControl *control = informativeLabel->d_func()->control
QWidgetTextCon...unc()->controlDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
337 QTextOption opt = control->document()->defaultTextOption();-
338 opt.setWrapMode(QTextOption::WrapAnywhere);-
339 control->document()->setDefaultTextOption(opt);-
340 }
never executed: end of block
0
341 width = hardLimit;-
342 }
never executed: end of block
0
343 policy.setHeightForWidth(label->wordWrap());-
344 label->setSizePolicy(policy);-
345 }
never executed: end of block
0
346-
347 QFontMetrics fm(QApplication::font("QMdiSubWindowTitleBar"));-
348 int windowTitleWidth = qMin(fm.width(q->windowTitle()) + 50, hardLimit);-
349 if (windowTitleWidth > width
windowTitleWidth > widthDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
350 width = windowTitleWidth;
never executed: width = windowTitleWidth;
0
351-
352 layout->activate();-
353 int height = (
(layout->hasHeightForWidth())Description
TRUEnever evaluated
FALSEnever evaluated
layout->hasHeightForWidth())
(layout->hasHeightForWidth())Description
TRUEnever evaluated
FALSEnever evaluated
0
354 ? layout->totalHeightForWidth(width)-
355 : layout->totalMinimumSize().height();-
356-
357 q->setFixedSize(width, height);-
358 QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);-
359}
never executed: end of block
0
360static int oldButton(int button)-
361{-
362 switch (button & QMessageBox::ButtonMask) {-
363 case
never executed: case QMessageBox::Ok:
QMessageBox::Ok:
never executed: case QMessageBox::Ok:
0
364 return
never executed: return Old_Ok;
Old_Ok;
never executed: return Old_Ok;
0
365 case
never executed: case QMessageBox::Cancel:
QMessageBox::Cancel:
never executed: case QMessageBox::Cancel:
0
366 return
never executed: return Old_Cancel;
Old_Cancel;
never executed: return Old_Cancel;
0
367 case
never executed: case QMessageBox::Yes:
QMessageBox::Yes:
never executed: case QMessageBox::Yes:
0
368 return
never executed: return Old_Yes;
Old_Yes;
never executed: return Old_Yes;
0
369 case
never executed: case QMessageBox::No:
QMessageBox::No:
never executed: case QMessageBox::No:
0
370 return
never executed: return Old_No;
Old_No;
never executed: return Old_No;
0
371 case
never executed: case QMessageBox::Abort:
QMessageBox::Abort:
never executed: case QMessageBox::Abort:
0
372 return
never executed: return Old_Abort;
Old_Abort;
never executed: return Old_Abort;
0
373 case
never executed: case QMessageBox::Retry:
QMessageBox::Retry:
never executed: case QMessageBox::Retry:
0
374 return
never executed: return Old_Retry;
Old_Retry;
never executed: return Old_Retry;
0
375 case
never executed: case QMessageBox::Ignore:
QMessageBox::Ignore:
never executed: case QMessageBox::Ignore:
0
376 return
never executed: return Old_Ignore;
Old_Ignore;
never executed: return Old_Ignore;
0
377 case
never executed: case QMessageBox::YesToAll:
QMessageBox::YesToAll:
never executed: case QMessageBox::YesToAll:
0
378 return
never executed: return Old_YesAll;
Old_YesAll;
never executed: return Old_YesAll;
0
379 case
never executed: case QMessageBox::NoToAll:
QMessageBox::NoToAll:
never executed: case QMessageBox::NoToAll:
0
380 return
never executed: return Old_NoAll;
Old_NoAll;
never executed: return Old_NoAll;
0
381 default
never executed: default:
:
never executed: default:
0
382 return
never executed: return 0;
0;
never executed: return 0;
0
383 }-
384}-
385-
386int QMessageBoxPrivate::execReturnCode(QAbstractButton *button)-
387{-
388 int ret = buttonBox->standardButton(button);-
389 if (ret == QMessageBox::NoButton
ret == QMessageBox::NoButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
390 ret = customButtonList.indexOf(button);-
391 }
never executed: end of block
else if (compatMode
compatModeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
392 ret = oldButton(ret);-
393 }
never executed: end of block
0
394 return
never executed: return ret;
ret;
never executed: return ret;
0
395}-
396-
397void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)-
398{-
399 QMessageBox * const q = q_func();-
400-
401 if (detailsButton
detailsButtonDescription
TRUEnever evaluated
FALSEnever evaluated
&& detailsText
detailsTextDescription
TRUEnever evaluated
FALSEnever evaluated
&& button == detailsButton
button == detailsButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
402 detailsButton->setLabel(detailsText->isHidden() ? HideLabel : ShowLabel);-
403 detailsText->setHidden(!detailsText->isHidden());-
404 updateSize();-
405 }
never executed: end of block
else
0
406-
407 {-
408 clickedButton = button;-
409 q->done(execReturnCode(button));-
410 q->buttonClicked(button);-
411-
412 if (receiverToDisconnectOnClose
receiverToDisconnectOnCloseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
413 QObject::disconnect(q, signalToDisconnectOnClose, receiverToDisconnectOnClose,-
414 memberToDisconnectOnClose);-
415 receiverToDisconnectOnClose = 0;-
416 }
never executed: end of block
0
417 signalToDisconnectOnClose.clear();-
418 memberToDisconnectOnClose.clear();-
419 }
never executed: end of block
0
420}-
421-
422void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)-
423{-
424 (void)role;;-
425 QMessageBox * const q = q_func();-
426 q->done(button);-
427}
never executed: end of block
0
428QMessageBox::QMessageBox(QWidget *parent)-
429 : QDialog(*new QMessageBoxPrivate, parent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)-
430{-
431 QMessageBoxPrivate * const d = d_func();-
432 d->init();-
433}
never executed: end of block
0
434QMessageBox::QMessageBox(Icon icon, const QString &title, const QString &text,-
435 StandardButtons buttons, QWidget *parent,-
436 Qt::WindowFlags f)-
437: QDialog(*new QMessageBoxPrivate, parent, f | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)-
438{-
439 QMessageBoxPrivate * const d = d_func();-
440 d->init(title, text);-
441 setIcon(icon);-
442 if (buttons != NoButton
buttons != NoButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
443 setStandardButtons(buttons);
never executed: setStandardButtons(buttons);
0
444}
never executed: end of block
0
445-
446-
447-
448-
449QMessageBox::~QMessageBox()-
450{-
451}-
452void QMessageBox::addButton(QAbstractButton *button, ButtonRole role)-
453{-
454 QMessageBoxPrivate * const d = d_func();-
455 if (!button
!buttonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
456 return;
never executed: return;
0
457 removeButton(button);-
458 d->buttonBox->addButton(button, (QDialogButtonBox::ButtonRole)role);-
459 d->customButtonList.append(button);-
460 d->autoAddOkButton = false;-
461}
never executed: end of block
0
462QPushButton *QMessageBox::addButton(const QString& text, ButtonRole role)-
463{-
464 QMessageBoxPrivate * const d = d_func();-
465 QPushButton *pushButton = new QPushButton(text);-
466 addButton(pushButton, role);-
467 d->updateSize();-
468 return
never executed: return pushButton;
pushButton;
never executed: return pushButton;
0
469}-
470QPushButton *QMessageBox::addButton(StandardButton button)-
471{-
472 QMessageBoxPrivate * const d = d_func();-
473 QPushButton *pushButton = d->buttonBox->addButton((QDialogButtonBox::StandardButton)button);-
474 if (pushButton
pushButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
475 d->autoAddOkButton = false;
never executed: d->autoAddOkButton = false;
0
476 return
never executed: return pushButton;
pushButton;
never executed: return pushButton;
0
477}-
478void QMessageBox::removeButton(QAbstractButton *button)-
479{-
480 QMessageBoxPrivate * const d = d_func();-
481 d->customButtonList.removeAll(button);-
482 if (d->escapeButton == button
d->escapeButton == buttonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
483 d->escapeButton = 0;
never executed: d->escapeButton = 0;
0
484 if (d->defaultButton == button
d->defaultButton == buttonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
485 d->defaultButton = 0;
never executed: d->defaultButton = 0;
0
486 d->buttonBox->removeButton(button);-
487 d->updateSize();-
488}
never executed: end of block
0
489void QMessageBox::setStandardButtons(StandardButtons buttons)-
490{-
491 QMessageBoxPrivate * const d = d_func();-
492 d->buttonBox->setStandardButtons(QDialogButtonBox::StandardButtons(int(buttons)));-
493-
494 QList<QAbstractButton *> buttonList = d->buttonBox->buttons();-
495 if (!buttonList.contains(d->escapeButton)
!buttonList.co...>escapeButton)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
496 d->escapeButton = 0;
never executed: d->escapeButton = 0;
0
497 if (!buttonList.contains(d->defaultButton)
!buttonList.co...defaultButton)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
498 d->defaultButton = 0;
never executed: d->defaultButton = 0;
0
499 d->autoAddOkButton = false;-
500 d->updateSize();-
501}
never executed: end of block
0
502-
503QMessageBox::StandardButtons QMessageBox::standardButtons() const-
504{-
505 const QMessageBoxPrivate * const d = d_func();-
506 return
never executed: return QMessageBox::StandardButtons(int(d->buttonBox->standardButtons()));
QMessageBox::StandardButtons(int(d->buttonBox->standardButtons()));
never executed: return QMessageBox::StandardButtons(int(d->buttonBox->standardButtons()));
0
507}-
508QMessageBox::StandardButton QMessageBox::standardButton(QAbstractButton *button) const-
509{-
510 const QMessageBoxPrivate * const d = d_func();-
511 return
never executed: return (QMessageBox::StandardButton)d->buttonBox->standardButton(button);
(QMessageBox::StandardButton)d->buttonBox->standardButton(button);
never executed: return (QMessageBox::StandardButton)d->buttonBox->standardButton(button);
0
512}-
513QAbstractButton *QMessageBox::button(StandardButton which) const-
514{-
515 const QMessageBoxPrivate * const d = d_func();-
516 return
never executed: return d->buttonBox->button(QDialogButtonBox::StandardButton(which));
d->buttonBox->button(QDialogButtonBox::StandardButton(which));
never executed: return d->buttonBox->button(QDialogButtonBox::StandardButton(which));
0
517}-
518QAbstractButton *QMessageBox::escapeButton() const-
519{-
520 const QMessageBoxPrivate * const d = d_func();-
521 return
never executed: return d->escapeButton;
d->escapeButton;
never executed: return d->escapeButton;
0
522}-
523void QMessageBox::setEscapeButton(QAbstractButton *button)-
524{-
525 QMessageBoxPrivate * const d = d_func();-
526 if (d->buttonBox->buttons().contains(button)
d->buttonBox->...ntains(button)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
527 d->escapeButton = button;
never executed: d->escapeButton = button;
0
528}
never executed: end of block
0
529void QMessageBox::setEscapeButton(QMessageBox::StandardButton button)-
530{-
531 QMessageBoxPrivate * const d = d_func();-
532 setEscapeButton(d->buttonBox->button(QDialogButtonBox::StandardButton(button)));-
533}
never executed: end of block
0
534-
535void QMessageBoxPrivate::detectEscapeButton()-
536{-
537 if (escapeButton
escapeButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
538 detectedEscapeButton = escapeButton;-
539 return;
never executed: return;
0
540 }-
541-
542-
543 detectedEscapeButton = buttonBox->button(QDialogButtonBox::Cancel);-
544 if (detectedEscapeButton
detectedEscapeButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
545 return;
never executed: return;
0
546-
547-
548 const QList<QAbstractButton *> buttons = buttonBox->buttons();-
549 if (buttons.count() == 1
buttons.count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
550 detectedEscapeButton = buttons.first();-
551 return;
never executed: return;
0
552 }-
553-
554-
555 for (auto *button : buttons) {-
556 if (buttonBox->buttonRole(button) == QDialogButtonBox::RejectRole
buttonBox->but...ox::RejectRoleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
557 if (detectedEscapeButton
detectedEscapeButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
558 detectedEscapeButton = 0;-
559 break;
never executed: break;
0
560 }-
561 detectedEscapeButton = button;-
562 }
never executed: end of block
0
563 }
never executed: end of block
0
564 if (detectedEscapeButton
detectedEscapeButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
565 return;
never executed: return;
0
566-
567-
568 for (auto *button : buttons) {-
569 if (buttonBox->buttonRole(button) == QDialogButtonBox::NoRole
buttonBox->but...tonBox::NoRoleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
570 if (detectedEscapeButton
detectedEscapeButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
571 detectedEscapeButton = 0;-
572 break;
never executed: break;
0
573 }-
574 detectedEscapeButton = button;-
575 }
never executed: end of block
0
576 }
never executed: end of block
0
577}
never executed: end of block
0
578QAbstractButton *QMessageBox::clickedButton() const-
579{-
580 const QMessageBoxPrivate * const d = d_func();-
581 return
never executed: return d->clickedButton;
d->clickedButton;
never executed: return d->clickedButton;
0
582}-
583QPushButton *QMessageBox::defaultButton() const-
584{-
585 const QMessageBoxPrivate * const d = d_func();-
586 return
never executed: return d->defaultButton;
d->defaultButton;
never executed: return d->defaultButton;
0
587}-
588void QMessageBox::setDefaultButton(QPushButton *button)-
589{-
590 QMessageBoxPrivate * const d = d_func();-
591 if (!d->buttonBox->buttons().contains(button)
!d->buttonBox-...ntains(button)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
592 return;
never executed: return;
0
593 d->defaultButton = button;-
594 button->setDefault(true);-
595 button->setFocus();-
596}
never executed: end of block
0
597void QMessageBox::setDefaultButton(QMessageBox::StandardButton button)-
598{-
599 QMessageBoxPrivate * const d = d_func();-
600 setDefaultButton(d->buttonBox->button(QDialogButtonBox::StandardButton(button)));-
601}
never executed: end of block
0
602void QMessageBox::setCheckBox(QCheckBox *cb)-
603{-
604 QMessageBoxPrivate * const d = d_func();-
605-
606 if (cb == d->checkbox
cb == d->checkboxDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
607 return;
never executed: return;
0
608-
609 if (d->checkbox
d->checkboxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
610 d->checkbox->hide();-
611 layout()->removeWidget(d->checkbox);-
612 if (d->checkbox->parentWidget() == this
d->checkbox->p...dget() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
613 d->checkbox->setParent(0);-
614 d->checkbox->deleteLater();-
615 }
never executed: end of block
0
616 }
never executed: end of block
0
617 d->checkbox = cb;-
618 if (d->checkbox
d->checkboxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
619 QSizePolicy sp = d->checkbox->sizePolicy();-
620 sp.setHorizontalPolicy(QSizePolicy::MinimumExpanding);-
621 d->checkbox->setSizePolicy(sp);-
622 }
never executed: end of block
0
623 d->setupLayout();-
624}
never executed: end of block
0
625QCheckBox* QMessageBox::checkBox() const-
626{-
627 const QMessageBoxPrivate * const d = d_func();-
628 return
never executed: return d->checkbox;
d->checkbox;
never executed: return d->checkbox;
0
629}-
630QString QMessageBox::text() const-
631{-
632 const QMessageBoxPrivate * const d = d_func();-
633 return
never executed: return d->label->text();
d->label->text();
never executed: return d->label->text();
0
634}-
635-
636void QMessageBox::setText(const QString &text)-
637{-
638 QMessageBoxPrivate * const d = d_func();-
639 d->label->setText(text);-
640 d->label->setWordWrap(d->label->textFormat() == Qt::RichText-
641 || (d->label->textFormat() == Qt::AutoText && Qt::mightBeRichText(text)));-
642 d->updateSize();-
643}
never executed: end of block
0
644QMessageBox::Icon QMessageBox::icon() const-
645{-
646 const QMessageBoxPrivate * const d = d_func();-
647 return
never executed: return d->icon;
d->icon;
never executed: return d->icon;
0
648}-
649-
650void QMessageBox::setIcon(Icon icon)-
651{-
652 QMessageBoxPrivate * const d = d_func();-
653 setIconPixmap(QMessageBoxPrivate::standardIcon((QMessageBox::Icon)icon,-
654 this));-
655 d->icon = icon;-
656}
never executed: end of block
0
657QPixmap QMessageBox::iconPixmap() const-
658{-
659 const QMessageBoxPrivate * const d = d_func();-
660 if (d->iconLabel
d->iconLabelDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->iconLabel->pixmap()
d->iconLabel->pixmap()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
661 return
never executed: return *d->iconLabel->pixmap();
*d->iconLabel->pixmap();
never executed: return *d->iconLabel->pixmap();
0
662 return
never executed: return QPixmap();
QPixmap();
never executed: return QPixmap();
0
663}-
664-
665void QMessageBox::setIconPixmap(const QPixmap &pixmap)-
666{-
667 QMessageBoxPrivate * const d = d_func();-
668 d->iconLabel->setPixmap(pixmap);-
669 d->icon = NoIcon;-
670 d->setupLayout();-
671}
never executed: end of block
0
672Qt::TextFormat QMessageBox::textFormat() const-
673{-
674 const QMessageBoxPrivate * const d = d_func();-
675 return
never executed: return d->label->textFormat();
d->label->textFormat();
never executed: return d->label->textFormat();
0
676}-
677-
678void QMessageBox::setTextFormat(Qt::TextFormat format)-
679{-
680 QMessageBoxPrivate * const d = d_func();-
681 d->label->setTextFormat(format);-
682 d->label->setWordWrap(format == Qt::RichText-
683 || (format == Qt::AutoText && Qt::mightBeRichText(d->label->text())));-
684 d->updateSize();-
685}
never executed: end of block
0
686Qt::TextInteractionFlags QMessageBox::textInteractionFlags() const-
687{-
688 const QMessageBoxPrivate * const d = d_func();-
689 return
never executed: return d->label->textInteractionFlags();
d->label->textInteractionFlags();
never executed: return d->label->textInteractionFlags();
0
690}-
691-
692void QMessageBox::setTextInteractionFlags(Qt::TextInteractionFlags flags)-
693{-
694 QMessageBoxPrivate * const d = d_func();-
695 d->label->setTextInteractionFlags(flags);-
696}
never executed: end of block
0
697-
698-
699-
700-
701bool QMessageBox::event(QEvent *e)-
702{-
703 bool result =QDialog::event(e);-
704 switch (e->type()) {-
705 case
never executed: case QEvent::LayoutRequest:
QEvent::LayoutRequest:
never executed: case QEvent::LayoutRequest:
0
706 d_func()->updateSize();-
707 break;
never executed: break;
0
708 case
never executed: case QEvent::LanguageChange:
QEvent::LanguageChange:
never executed: case QEvent::LanguageChange:
0
709 d_func()->retranslateStrings();-
710 break;
never executed: break;
0
711 default
never executed: default:
:
never executed: default:
0
712 break;
never executed: break;
0
713 }-
714 return
never executed: return result;
result;
never executed: return result;
0
715}-
716-
717-
718-
719-
720void QMessageBox::resizeEvent(QResizeEvent *event)-
721{-
722 QDialog::resizeEvent(event);-
723}
never executed: end of block
0
724-
725-
726-
727-
728void QMessageBox::closeEvent(QCloseEvent *e)-
729{-
730 QMessageBoxPrivate * const d = d_func();-
731 if (!d->detectedEscapeButton
!d->detectedEscapeButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
732 e->ignore();-
733 return;
never executed: return;
0
734 }-
735 QDialog::closeEvent(e);-
736 d->clickedButton = d->detectedEscapeButton;-
737 setResult(d->execReturnCode(d->detectedEscapeButton));-
738}
never executed: end of block
0
739-
740-
741-
742-
743void QMessageBox::changeEvent(QEvent *ev)-
744{-
745 QMessageBoxPrivate * const d = d_func();-
746 switch (ev->type()) {-
747 case
never executed: case QEvent::StyleChange:
QEvent::StyleChange:
never executed: case QEvent::StyleChange:
0
748 {-
749 if (d->icon != NoIcon
d->icon != NoIconDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
750 setIcon(d->icon);
never executed: setIcon(d->icon);
0
751 Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this));-
752 d->label->setTextInteractionFlags(flags);-
753 d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this));-
754 if (d->informativeLabel
d->informativeLabelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
755 d->informativeLabel->setTextInteractionFlags(flags);
never executed: d->informativeLabel->setTextInteractionFlags(flags);
0
756-
757 }-
758 case
never executed: case QEvent::FontChange:
QEvent::FontChange:
never executed: case QEvent::FontChange:
code before this statement never executed: case QEvent::FontChange:
0
759 case
never executed: case QEvent::ApplicationFontChange:
QEvent::ApplicationFontChange:
never executed: case QEvent::ApplicationFontChange:
0
760-
761-
762-
763-
764-
765-
766-
767 default
never executed: default:
:
never executed: default:
0
768 break;
never executed: break;
0
769 }-
770 QDialog::changeEvent(ev);-
771}
never executed: end of block
0
772-
773-
774-
775-
776void QMessageBox::keyPressEvent(QKeyEvent *e)-
777{-
778 QMessageBoxPrivate * const d = d_func();-
779-
780 if (e->matches(QKeySequence::Cancel)
e->matches(QKe...uence::Cancel)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
781 if (d->detectedEscapeButton
d->detectedEscapeButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
782-
783-
784-
785 d->detectedEscapeButton->click();-
786-
787 }
never executed: end of block
0
788 return;
never executed: return;
0
789 }-
790-
791-
792-
793-
794-
795 if (e == QKeySequence::Copy
e == QKeySequence::CopyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
796 if (d->detailsText
d->detailsTextDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->detailsText->isVisible()
d->detailsText->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->detailsText->copy()
d->detailsText->copy()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
797 e->setAccepted(true);-
798 return;
never executed: return;
0
799 }-
800 }
never executed: end of block
else if (e == QKeySequence::SelectAll
e == QKeySequence::SelectAllDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->detailsText
d->detailsTextDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->detailsText->isVisible()
d->detailsText->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
801 d->detailsText->selectAll();-
802 e->setAccepted(true);-
803 return;
never executed: return;
0
804 }-
805 if (!(e->modifiers() & (Qt::AltModifier | Qt::ControlModifier | Qt::MetaModifier))
!(e->modifiers...MetaModifier))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
806 int key = e->key() & ~Qt::MODIFIER_MASK;-
807 if (key
keyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
808 const QList<QAbstractButton *> buttons = d->buttonBox->buttons();-
809 for (auto *pb : buttons) {-
810 QKeySequence shortcut = pb->shortcut();-
811 if (!shortcut.isEmpty()
!shortcut.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& key == int(shortcut[0] & ~Qt::MODIFIER_MASK)
key == int(sho...MODIFIER_MASK)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
812 pb->animateClick();-
813 return;
never executed: return;
0
814 }-
815 }
never executed: end of block
0
816 }
never executed: end of block
0
817 }
never executed: end of block
0
818-
819 QDialog::keyPressEvent(e);-
820}
never executed: end of block
0
821void QMessageBox::open(QObject *receiver, const char *member)-
822{-
823 QMessageBoxPrivate * const d = d_func();-
824 const char *signal = member
memberDescription
TRUEnever evaluated
FALSEnever evaluated
&& strchr(member, '*')
strchr(member, '*')Description
TRUEnever evaluated
FALSEnever evaluated
? qFlagLocation("2""buttonClicked(QAbstractButton*)" "\0" __FILE__ ":" "1555")
0
825 : qFlagLocation("2""finished(int)" "\0" __FILE__ ":" "1556");-
826 connect(this, signal, receiver, member);-
827 d->signalToDisconnectOnClose = signal;-
828 d->receiverToDisconnectOnClose = receiver;-
829 d->memberToDisconnectOnClose = member;-
830 QDialog::open();-
831}
never executed: end of block
0
832QList<QAbstractButton *> QMessageBox::buttons() const-
833{-
834 const QMessageBoxPrivate * const d = d_func();-
835 return
never executed: return d->buttonBox->buttons();
d->buttonBox->buttons();
never executed: return d->buttonBox->buttons();
0
836}-
837QMessageBox::ButtonRole QMessageBox::buttonRole(QAbstractButton *button) const-
838{-
839 const QMessageBoxPrivate * const d = d_func();-
840 return
never executed: return QMessageBox::ButtonRole(d->buttonBox->buttonRole(button));
QMessageBox::ButtonRole(d->buttonBox->buttonRole(button));
never executed: return QMessageBox::ButtonRole(d->buttonBox->buttonRole(button));
0
841}-
842-
843-
844-
845-
846void QMessageBox::showEvent(QShowEvent *e)-
847{-
848 QMessageBoxPrivate * const d = d_func();-
849 if (d->autoAddOkButton
d->autoAddOkButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
850 addButton(Ok);-
851-
852-
853-
854 }
never executed: end of block
0
855 if (d->detailsButton
d->detailsButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
856 addButton(d->detailsButton, QMessageBox::ActionRole);
never executed: addButton(d->detailsButton, QMessageBox::ActionRole);
0
857 d->detectEscapeButton();-
858 d->updateSize();-
859-
860-
861 QAccessibleEvent event(this, QAccessible::Alert);-
862 QAccessible::updateAccessibility(&event);-
863-
864-
865-
866-
867-
868-
869-
870 QDialog::showEvent(e);-
871}
never executed: end of block
0
872-
873-
874static QMessageBox::StandardButton showNewMessageBox(QWidget *parent,-
875 QMessageBox::Icon icon,-
876 const QString& title, const QString& text,-
877 QMessageBox::StandardButtons buttons,-
878 QMessageBox::StandardButton defaultButton)-
879{-
880-
881-
882 if (defaultButton
defaultButtonDescription
TRUEnever evaluated
FALSEnever evaluated
&& !(buttons & defaultButton)
!(buttons & defaultButton)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
883 return
never executed: return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);
(QMessageBox::StandardButton)
never executed: return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);
0
884 QMessageBoxPrivate::showOldMessageBox(parent, icon, title,
never executed: return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);
0
885 text, int(buttons),
never executed: return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);
0
886 int(defaultButton), 0);
never executed: return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);
0
887-
888 QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent);-
889 QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox*>();-
890 ((!(buttonBox != 0)) ? qt_assert("buttonBox != 0",__FILE__,1638) : qt_noop());-
891-
892 uint mask = QMessageBox::FirstButton;-
893 while (mask <= QMessageBox::LastButton
mask <= QMessa...ox::LastButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
894 uint sb = buttons & mask;-
895 mask <<= 1;-
896 if (!sb
!sbDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
897 continue;
never executed: continue;
0
898 QPushButton *button = msgBox.addButton((QMessageBox::StandardButton)sb);-
899-
900 if (msgBox.defaultButton()
msgBox.defaultButton()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
901 continue;
never executed: continue;
0
902 if ((defaultButton == QMessageBox::NoButton
defaultButton ...eBox::NoButtonDescription
TRUEnever evaluated
FALSEnever evaluated
&& buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole
buttonBox->but...ox::AcceptRoleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
903 || (defaultButton != QMessageBox::NoButton
defaultButton ...eBox::NoButtonDescription
TRUEnever evaluated
FALSEnever evaluated
&& sb == uint(defaultButton)
sb == uint(defaultButton)Description
TRUEnever evaluated
FALSEnever evaluated
))
0
904 msgBox.setDefaultButton(button);
never executed: msgBox.setDefaultButton(button);
0
905 }
never executed: end of block
0
906 if (msgBox.exec() == -1
msgBox.exec() == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
907 return
never executed: return QMessageBox::Cancel;
QMessageBox::Cancel;
never executed: return QMessageBox::Cancel;
0
908 return
never executed: return msgBox.standardButton(msgBox.clickedButton());
msgBox.standardButton(msgBox.clickedButton());
never executed: return msgBox.standardButton(msgBox.clickedButton());
0
909}-
910QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QString &title,-
911 const QString& text, StandardButtons buttons,-
912 StandardButton defaultButton)-
913{-
914 return
never executed: return showNewMessageBox(parent, Information, title, text, buttons, defaultButton);
showNewMessageBox(parent, Information, title, text, buttons,
never executed: return showNewMessageBox(parent, Information, title, text, buttons, defaultButton);
0
915 defaultButton);
never executed: return showNewMessageBox(parent, Information, title, text, buttons, defaultButton);
0
916}-
917QMessageBox::StandardButton QMessageBox::question(QWidget *parent, const QString &title,-
918 const QString& text, StandardButtons buttons,-
919 StandardButton defaultButton)-
920{-
921 return
never executed: return showNewMessageBox(parent, Question, title, text, buttons, defaultButton);
showNewMessageBox(parent, Question, title, text, buttons, defaultButton);
never executed: return showNewMessageBox(parent, Question, title, text, buttons, defaultButton);
0
922}-
923QMessageBox::StandardButton QMessageBox::warning(QWidget *parent, const QString &title,-
924 const QString& text, StandardButtons buttons,-
925 StandardButton defaultButton)-
926{-
927 return
never executed: return showNewMessageBox(parent, Warning, title, text, buttons, defaultButton);
showNewMessageBox(parent, Warning, title, text, buttons, defaultButton);
never executed: return showNewMessageBox(parent, Warning, title, text, buttons, defaultButton);
0
928}-
929QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString &title,-
930 const QString& text, StandardButtons buttons,-
931 StandardButton defaultButton)-
932{-
933 return
never executed: return showNewMessageBox(parent, Critical, title, text, buttons, defaultButton);
showNewMessageBox(parent, Critical, title, text, buttons, defaultButton);
never executed: return showNewMessageBox(parent, Critical, title, text, buttons, defaultButton);
0
934}-
935void QMessageBox::about(QWidget *parent, const QString &title, const QString &text)-
936{-
937 QMessageBox *msgBox = new QMessageBox(title, text, Information, 0, 0, 0, parent-
938-
939-
940-
941 );-
942 msgBox->setAttribute(Qt::WA_DeleteOnClose);-
943 QIcon icon = msgBox->windowIcon();-
944 QSize size = icon.actualSize(QSize(64, 64));-
945 msgBox->setIconPixmap(icon.pixmap(size));-
946 msgBox->exec();-
947-
948}
never executed: end of block
0
949void QMessageBox::aboutQt(QWidget *parent, const QString &title)-
950{-
951 QString translatedTextAboutQtCaption;-
952 translatedTextAboutQtCaption = QMessageBox::tr(-
953 "<h3>About Qt</h3>"-
954 "<p>This program uses Qt version %1.</p>"-
955 ).arg(QLatin1String("5.7.1"));-
956 QString translatedTextAboutQtText;-
957 translatedTextAboutQtText = QMessageBox::tr(-
958 "<p>Qt is a C++ toolkit for cross-platform application "-
959 "development.</p>"-
960 "<p>Qt provides single-source portability across all major desktop "-
961 "operating systems. It is also available for embedded Linux and other "-
962 "embedded and mobile operating systems.</p>"-
963 "<p>Qt is available under three different licensing options designed "-
964 "to accommodate the needs of our various users.</p>"-
965 "<p>Qt licensed under our commercial license agreement is appropriate "-
966 "for development of proprietary/commercial software where you do not "-
967 "want to share any source code with third parties or otherwise cannot "-
968 "comply with the terms of the GNU LGPL version 3.</p>"-
969 "<p>Qt licensed under the GNU LGPL version 3 is appropriate for the "-
970 "development of Qt&nbsp;applications provided you can comply with the terms "-
971 "and conditions of the GNU LGPL version 3.</p>"-
972 "<p>Please see <a href=\"http://%2/\">%2</a> "-
973 "for an overview of Qt licensing.</p>"-
974 "<p>Copyright (C) %1 The Qt Company Ltd and other "-
975 "contributors.</p>"-
976 "<p>Qt and the Qt logo are trademarks of The Qt Company Ltd.</p>"-
977 "<p>Qt is The Qt Company Ltd product developed as an open source "-
978 "project. See <a href=\"http://%3/\">%3</a> for more information.</p>"-
979 ).arg(([]() -> QString { enum { Size = sizeof(u"" "2016")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "2016" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()),
0
980 ([]() -> QString { enum { Size = sizeof(u"" "qt.io/licensing")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "qt.io/licensing" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()),
0
981 ([]() -> QString { enum { Size = sizeof(u"" "qt.io")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "qt.io" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
0
982 QMessageBox *msgBox = new QMessageBox(parent);-
983 msgBox->setAttribute(Qt::WA_DeleteOnClose);-
984 msgBox->setWindowTitle(title.isEmpty() ? tr("About Qt") : title);-
985 msgBox->setText(translatedTextAboutQtCaption);-
986 msgBox->setInformativeText(translatedTextAboutQtText);-
987-
988 QPixmap pm(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));-
989 if (!pm.isNull()
!pm.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
990 msgBox->setIconPixmap(pm);
never executed: msgBox->setIconPixmap(pm);
0
991 msgBox->exec();-
992-
993}
never executed: end of block
0
994-
995-
996-
997-
998static QMessageBox::StandardButton newButton(int button)-
999{-
1000-
1001 if (button == QMessageBox::NoButton
button == QMes...eBox::NoButtonDescription
TRUEnever evaluated
FALSEnever evaluated
|| (
(button & NewButtonMask)Description
TRUEnever evaluated
FALSEnever evaluated
button & NewButtonMask)
(button & NewButtonMask)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1002 return
never executed: return QMessageBox::StandardButton(button & QMessageBox::ButtonMask);
QMessageBox::StandardButton(button & QMessageBox::ButtonMask);
never executed: return QMessageBox::StandardButton(button & QMessageBox::ButtonMask);
0
1003 return
never executed: return QMessageBox::NoButton;
QMessageBox::NoButton;
never executed: return QMessageBox::NoButton;
0
1004-
1005}-
1006-
1007static bool detectedCompat(int button0, int button1, int button2)-
1008{-
1009 if (button0 != 0
button0 != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& !(button0 & NewButtonMask)
!(button0 & NewButtonMask)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1010 return
never executed: return true;
true;
never executed: return true;
0
1011 if (button1 != 0
button1 != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& !(button1 & NewButtonMask)
!(button1 & NewButtonMask)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1012 return
never executed: return true;
true;
never executed: return true;
0
1013 if (button2 != 0
button2 != 0Description
TRUEnever evaluated
FALSEnever evaluated
&& !(button2 & NewButtonMask)
!(button2 & NewButtonMask)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1014 return
never executed: return true;
true;
never executed: return true;
0
1015 return
never executed: return false;
false;
never executed: return false;
0
1016}-
1017-
1018QAbstractButton *QMessageBoxPrivate::findButton(int button0, int button1, int button2, int flags)-
1019{-
1020 QMessageBox * const q = q_func();-
1021 int button = 0;-
1022-
1023 if (button0 & flags
button0 & flagsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1024 button = button0;-
1025 }
never executed: end of block
else if (button1 & flags
button1 & flagsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1026 button = button1;-
1027 }
never executed: end of block
else if (button2 & flags
button2 & flagsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1028 button = button2;-
1029 }
never executed: end of block
0
1030 return
never executed: return q->button(newButton(button));
q->button(newButton(button));
never executed: return q->button(newButton(button));
0
1031}-
1032-
1033void QMessageBoxPrivate::addOldButtons(int button0, int button1, int button2)-
1034{-
1035 QMessageBox * const q = q_func();-
1036 q->addButton(newButton(button0));-
1037 q->addButton(newButton(button1));-
1038 q->addButton(newButton(button2));-
1039 q->setDefaultButton(-
1040 static_cast<QPushButton *>(findButton(button0, button1, button2, QMessageBox::Default)));-
1041 q->setEscapeButton(findButton(button0, button1, button2, QMessageBox::Escape));-
1042 compatMode = detectedCompat(button0, button1, button2);-
1043}
never executed: end of block
0
1044-
1045QAbstractButton *QMessageBoxPrivate::abstractButtonForId(int id) const-
1046{-
1047 const QMessageBox * const q = q_func();-
1048 QAbstractButton *result = customButtonList.value(id);-
1049 if (result
resultDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1050 return
never executed: return result;
result;
never executed: return result;
0
1051 if (id & QMessageBox::FlagMask
id & QMessageBox::FlagMaskDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1052 return
never executed: return 0;
0;
never executed: return 0;
0
1053 return
never executed: return q->button(newButton(id));
q->button(newButton(id));
never executed: return q->button(newButton(id));
0
1054}-
1055-
1056int QMessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon icon,-
1057 const QString &title, const QString &text,-
1058 int button0, int button1, int button2)-
1059{-
1060 QMessageBox messageBox(icon, title, text, QMessageBox::NoButton, parent);-
1061 messageBox.d_func()->addOldButtons(button0, button1, button2);-
1062 return
never executed: return messageBox.exec();
messageBox.exec();
never executed: return messageBox.exec();
0
1063}-
1064-
1065int QMessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon icon,-
1066 const QString &title, const QString &text,-
1067 const QString &button0Text,-
1068 const QString &button1Text,-
1069 const QString &button2Text,-
1070 int defaultButtonNumber,-
1071 int escapeButtonNumber)-
1072{-
1073 QMessageBox messageBox(icon, title, text, QMessageBox::NoButton, parent);-
1074 QString myButton0Text = button0Text;-
1075 if (myButton0Text.isEmpty()
myButton0Text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1076 myButton0Text = QDialogButtonBox::tr("OK");
never executed: myButton0Text = QDialogButtonBox::tr("OK");
0
1077 messageBox.addButton(myButton0Text, QMessageBox::ActionRole);-
1078 if (!button1Text.isEmpty()
!button1Text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1079 messageBox.addButton(button1Text, QMessageBox::ActionRole);
never executed: messageBox.addButton(button1Text, QMessageBox::ActionRole);
0
1080 if (!button2Text.isEmpty()
!button2Text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1081 messageBox.addButton(button2Text, QMessageBox::ActionRole);
never executed: messageBox.addButton(button2Text, QMessageBox::ActionRole);
0
1082-
1083 const QList<QAbstractButton *> &buttonList = messageBox.d_func()->customButtonList;-
1084 messageBox.setDefaultButton(static_cast<QPushButton *>(buttonList.value(defaultButtonNumber)));-
1085 messageBox.setEscapeButton(buttonList.value(escapeButtonNumber));-
1086-
1087 return
never executed: return messageBox.exec();
messageBox.exec();
never executed: return messageBox.exec();
0
1088}-
1089-
1090void QMessageBoxPrivate::retranslateStrings()-
1091{-
1092-
1093 if (detailsButton
detailsButtonDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1094 detailsButton->setLabel(detailsText->isHidden() ? ShowLabel : HideLabel);
never executed: detailsButton->setLabel(detailsText->isHidden() ? ShowLabel : HideLabel);
0
1095-
1096}
never executed: end of block
0
1097QMessageBox::QMessageBox(const QString &title, const QString &text, Icon icon,-
1098 int button0, int button1, int button2, QWidget *parent,-
1099 Qt::WindowFlags f)-
1100 : QDialog(*new QMessageBoxPrivate, parent,-
1101 f | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)-
1102{-
1103 QMessageBoxPrivate * const d = d_func();-
1104 d->init(title, text);-
1105 setIcon(icon);-
1106 d->addOldButtons(button0, button1, button2);-
1107}
never executed: end of block
0
1108int QMessageBox::information(QWidget *parent, const QString &title, const QString& text,-
1109 int button0, int button1, int button2)-
1110{-
1111 return
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0, button1, button2);
QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0, button1, button2);
0
1112 button0, button1, button2);
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0, button1, button2);
0
1113}-
1114int QMessageBox::information(QWidget *parent, const QString &title, const QString& text,-
1115 const QString& button0Text, const QString& button1Text,-
1116 const QString& button2Text, int defaultButtonNumber,-
1117 int escapeButtonNumber)-
1118{-
1119 return
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1120 button0Text, button1Text, button2Text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1121 defaultButtonNumber, escapeButtonNumber);
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1122}-
1123int QMessageBox::question(QWidget *parent, const QString &title, const QString& text,-
1124 int button0, int button1, int button2)-
1125{-
1126 return
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0, button1, button2);
QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0, button1, button2);
0
1127 button0, button1, button2);
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0, button1, button2);
0
1128}-
1129int QMessageBox::question(QWidget *parent, const QString &title, const QString& text,-
1130 const QString& button0Text, const QString& button1Text,-
1131 const QString& button2Text, int defaultButtonNumber,-
1132 int escapeButtonNumber)-
1133{-
1134 return
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1135 button0Text, button1Text, button2Text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1136 defaultButtonNumber, escapeButtonNumber);
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1137}-
1138int QMessageBox::warning(QWidget *parent, const QString &title, const QString& text,-
1139 int button0, int button1, int button2)-
1140{-
1141 return
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0, button1, button2);
QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0, button1, button2);
0
1142 button0, button1, button2);
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0, button1, button2);
0
1143}-
1144int QMessageBox::warning(QWidget *parent, const QString &title, const QString& text,-
1145 const QString& button0Text, const QString& button1Text,-
1146 const QString& button2Text, int defaultButtonNumber,-
1147 int escapeButtonNumber)-
1148{-
1149 return
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1150 button0Text, button1Text, button2Text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1151 defaultButtonNumber, escapeButtonNumber);
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1152}-
1153int QMessageBox::critical(QWidget *parent, const QString &title, const QString& text,-
1154 int button0, int button1, int button2)-
1155{-
1156 return
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0, button1, button2);
QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0, button1, button2);
0
1157 button0, button1, button2);
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0, button1, button2);
0
1158}-
1159int QMessageBox::critical(QWidget *parent, const QString &title, const QString& text,-
1160 const QString& button0Text, const QString& button1Text,-
1161 const QString& button2Text, int defaultButtonNumber,-
1162 int escapeButtonNumber)-
1163{-
1164 return
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1165 button0Text, button1Text, button2Text,
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1166 defaultButtonNumber, escapeButtonNumber);
never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);
0
1167}-
1168QString QMessageBox::buttonText(int button) const-
1169{-
1170 const QMessageBoxPrivate * const d = d_func();-
1171-
1172 if (QAbstractButton *abstractButton = d->abstractButtonForId(button)
QAbstractButto...nForId(button)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1173 return
never executed: return abstractButton->text();
abstractButton->text();
never executed: return abstractButton->text();
0
1174 } else if (d->buttonBox->buttons().isEmpty()
d->buttonBox->...ns().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& (button == Ok
button == OkDescription
TRUEnever evaluated
FALSEnever evaluated
|| button == Old_Ok
button == Old_OkDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1175-
1176 return
never executed: return QDialogButtonBox::tr("OK");
QDialogButtonBox::tr("OK");
never executed: return QDialogButtonBox::tr("OK");
0
1177 }-
1178 return
never executed: return QString();
QString();
never executed: return QString();
0
1179}-
1180void QMessageBox::setButtonText(int button, const QString &text)-
1181{-
1182 QMessageBoxPrivate * const d = d_func();-
1183 if (QAbstractButton *abstractButton = d->abstractButtonForId(button)
QAbstractButto...nForId(button)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1184 abstractButton->setText(text);-
1185 }
never executed: end of block
else if (d->buttonBox->buttons().isEmpty()
d->buttonBox->...ns().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& (button == Ok
button == OkDescription
TRUEnever evaluated
FALSEnever evaluated
|| button == Old_Ok
button == Old_OkDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1186-
1187 addButton(QMessageBox::Ok)->setText(text);-
1188 }
never executed: end of block
0
1189}
never executed: end of block
0
1190QString QMessageBox::detailedText() const-
1191{-
1192 const QMessageBoxPrivate * const d = d_func();-
1193 return
never executed: return d->detailsText ? d->detailsText->text() : QString();
d->detailsText ? d->detailsText->text() : QString();
never executed: return d->detailsText ? d->detailsText->text() : QString();
0
1194}-
1195-
1196void QMessageBox::setDetailedText(const QString &text)-
1197{-
1198 QMessageBoxPrivate * const d = d_func();-
1199 if (text.isEmpty()
text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1200 if (d->detailsText
d->detailsTextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1201 d->detailsText->hide();-
1202 d->detailsText->deleteLater();-
1203 }
never executed: end of block
0
1204 d->detailsText = 0;-
1205 removeButton(d->detailsButton);-
1206 if (d->detailsButton
d->detailsButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1207 d->detailsButton->hide();-
1208 d->detailsButton->deleteLater();-
1209 }
never executed: end of block
0
1210 d->detailsButton = 0;-
1211 }
never executed: end of block
else {
0
1212 if (!d->detailsText
!d->detailsTextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1213 d->detailsText = new QMessageBoxDetailsText(this);-
1214 d->detailsText->hide();-
1215 }
never executed: end of block
0
1216 if (!d->detailsButton
!d->detailsButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1217 const bool autoAddOkButton = d->autoAddOkButton;-
1218 d->detailsButton = new DetailButton(this);-
1219 addButton(d->detailsButton, QMessageBox::ActionRole);-
1220 d->autoAddOkButton = autoAddOkButton;-
1221 }
never executed: end of block
0
1222 d->detailsText->setText(text);-
1223 }
never executed: end of block
0
1224 d->setupLayout();-
1225}
never executed: end of block
0
1226QString QMessageBox::informativeText() const-
1227{-
1228 const QMessageBoxPrivate * const d = d_func();-
1229 return
never executed: return d->informativeLabel ? d->informativeLabel->text() : QString();
d->informativeLabel ? d->informativeLabel->text() : QString();
never executed: return d->informativeLabel ? d->informativeLabel->text() : QString();
0
1230}-
1231-
1232void QMessageBox::setInformativeText(const QString &text)-
1233{-
1234 QMessageBoxPrivate * const d = d_func();-
1235 if (text.isEmpty()
text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1236 if (d->informativeLabel
d->informativeLabelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1237 d->informativeLabel->hide();-
1238 d->informativeLabel->deleteLater();-
1239 }
never executed: end of block
0
1240 d->informativeLabel = 0;-
1241 }
never executed: end of block
else {
0
1242 if (!d->informativeLabel
!d->informativeLabelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1243 QLabel *label = new QLabel;-
1244 label->setObjectName(QLatin1String("qt_msgbox_informativelabel"));-
1245 label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this)));-
1246 label->setAlignment(Qt::AlignTop | Qt::AlignLeft);-
1247 label->setOpenExternalLinks(true);-
1248 label->setWordWrap(true);-
1249-
1250-
1251-
1252-
1253 label->setWordWrap(true);-
1254 d->informativeLabel = label;-
1255 }
never executed: end of block
0
1256 d->informativeLabel->setText(text);-
1257 }
never executed: end of block
0
1258 d->setupLayout();-
1259}
never executed: end of block
0
1260void QMessageBox::setWindowTitle(const QString &title)-
1261{-
1262-
1263-
1264 QDialog::setWindowTitle(title);-
1265-
1266-
1267-
1268}
never executed: end of block
0
1269void QMessageBox::setWindowModality(Qt::WindowModality windowModality)-
1270{-
1271 QDialog::setWindowModality(windowModality);-
1272-
1273 if (parentWidget()
parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
&& windowModality == Qt::WindowModal
windowModality...t::WindowModalDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1274 setParent(parentWidget(), Qt::Sheet);
never executed: setParent(parentWidget(), Qt::Sheet);
0
1275 else-
1276 setParent(parentWidget(), Qt::Dialog);
never executed: setParent(parentWidget(), Qt::Dialog);
0
1277 setDefaultButton(d_func()->defaultButton);-
1278}
never executed: end of block
0
1279-
1280-
1281QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb)-
1282{-
1283 QStyle *style = mb
mbDescription
TRUEnever evaluated
FALSEnever evaluated
? mb->style() : QApplication::style();
0
1284 int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, mb);-
1285 QIcon tmpIcon;-
1286 switch (icon) {-
1287 case
never executed: case QMessageBox::Information:
QMessageBox::Information:
never executed: case QMessageBox::Information:
0
1288 tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, mb);-
1289 break;
never executed: break;
0
1290 case
never executed: case QMessageBox::Warning:
QMessageBox::Warning:
never executed: case QMessageBox::Warning:
0
1291 tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, mb);-
1292 break;
never executed: break;
0
1293 case
never executed: case QMessageBox::Critical:
QMessageBox::Critical:
never executed: case QMessageBox::Critical:
0
1294 tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, mb);-
1295 break;
never executed: break;
0
1296 case
never executed: case QMessageBox::Question:
QMessageBox::Question:
never executed: case QMessageBox::Question:
0
1297 tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mb);-
1298 default
never executed: default:
:
never executed: default:
code before this statement never executed: default:
0
1299 break;
never executed: break;
0
1300 }-
1301 if (!tmpIcon.isNull()
!tmpIcon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1302 QWindow *window = nullptr;-
1303 if (mb
mbDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1304 window = mb->windowHandle();-
1305 if (!window
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1306 if (const
const QWidget ...ParentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
QWidget *nativeParent = mb->nativeParentWidget()
const QWidget ...ParentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1307 window = nativeParent->windowHandle();
never executed: window = nativeParent->windowHandle();
0
1308 }
never executed: end of block
0
1309 }
never executed: end of block
0
1310 return
never executed: return tmpIcon.pixmap(window, QSize(iconSize, iconSize));
tmpIcon.pixmap(window, QSize(iconSize, iconSize));
never executed: return tmpIcon.pixmap(window, QSize(iconSize, iconSize));
0
1311 }-
1312 return
never executed: return QPixmap();
QPixmap();
never executed: return QPixmap();
0
1313}-
1314-
1315void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h)-
1316{-
1317 QMessageBox * const q = q_func();-
1318 QObject::connect(h, qFlagLocation("2""clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)" "\0" __FILE__ ":" "2694"),-
1319 q, qFlagLocation("1""_q_clicked(QPlatformDialogHelper::StandardButton,QPlatformDialogHelper::ButtonRole)" "\0" __FILE__ ":" "2695"));-
1320 static_cast<QPlatformMessageDialogHelper *>(h)->setOptions(options);-
1321}
never executed: end of block
0
1322-
1323static QMessageDialogOptions::Icon helperIcon(QMessageBox::Icon i)-
1324{-
1325 switch (i) {-
1326 case
never executed: case QMessageBox::NoIcon:
QMessageBox::NoIcon:
never executed: case QMessageBox::NoIcon:
0
1327 return
never executed: return QMessageDialogOptions::NoIcon;
QMessageDialogOptions::NoIcon;
never executed: return QMessageDialogOptions::NoIcon;
0
1328 case
never executed: case QMessageBox::Information:
QMessageBox::Information:
never executed: case QMessageBox::Information:
0
1329 return
never executed: return QMessageDialogOptions::Information;
QMessageDialogOptions::Information;
never executed: return QMessageDialogOptions::Information;
0
1330 case
never executed: case QMessageBox::Warning:
QMessageBox::Warning:
never executed: case QMessageBox::Warning:
0
1331 return
never executed: return QMessageDialogOptions::Warning;
QMessageDialogOptions::Warning;
never executed: return QMessageDialogOptions::Warning;
0
1332 case
never executed: case QMessageBox::Critical:
QMessageBox::Critical:
never executed: case QMessageBox::Critical:
0
1333 return
never executed: return QMessageDialogOptions::Critical;
QMessageDialogOptions::Critical;
never executed: return QMessageDialogOptions::Critical;
0
1334 case
never executed: case QMessageBox::Question:
QMessageBox::Question:
never executed: case QMessageBox::Question:
0
1335 return
never executed: return QMessageDialogOptions::Question;
QMessageDialogOptions::Question;
never executed: return QMessageDialogOptions::Question;
0
1336 }-
1337 return
never executed: return QMessageDialogOptions::NoIcon;
QMessageDialogOptions::NoIcon;
never executed: return QMessageDialogOptions::NoIcon;
0
1338}-
1339-
1340static QPlatformDialogHelper::StandardButtons helperStandardButtons(QMessageBox * q)-
1341{-
1342 QPlatformDialogHelper::StandardButtons buttons(int(q->standardButtons()));-
1343 return
never executed: return buttons;
buttons;
never executed: return buttons;
0
1344}-
1345-
1346void QMessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper *)-
1347{-
1348 QMessageBox * const q = q_func();-
1349 options->setWindowTitle(q->windowTitle());-
1350 options->setText(q->text());-
1351 options->setInformativeText(q->informativeText());-
1352 options->setDetailedText(q->detailedText());-
1353 options->setIcon(helperIcon(q->icon()));-
1354 options->setStandardButtons(helperStandardButtons(q));-
1355}
never executed: end of block
0
1356-
1357void QMessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)-
1358{-
1359 QMessageBox * const q = q_func();-
1360 clickedButton = q->button(QMessageBox::StandardButton(code));-
1361}
never executed: end of block
0
1362QPixmap QMessageBox::standardIcon(Icon icon)-
1363{-
1364 return
never executed: return QMessageBoxPrivate::standardIcon(icon, 0);
QMessageBoxPrivate::standardIcon(icon, 0);
never executed: return QMessageBoxPrivate::standardIcon(icon, 0);
0
1365}-
1366-
1367-
Switch to Source codePreprocessed file

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