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