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