| Line | Source Code | Coverage | 
|---|
| 1 | /**************************************************************************** | - | 
| 2 | ** | - | 
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - | 
| 4 | ** Contact: http://www.qt-project.org/legal | - | 
| 5 | ** | - | 
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | 
| 7 | ** | - | 
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | 
| 9 | ** Commercial License Usage | - | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | 
| 11 | ** accordance with the commercial license agreement provided with the | - | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | 
| 13 | ** a written agreement between you and Digia.  For licensing terms and | - | 
| 14 | ** conditions see http://qt.digia.com/licensing.  For further information | - | 
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - | 
| 16 | ** | - | 
| 17 | ** GNU Lesser General Public License Usage | - | 
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | 
| 19 | ** General Public License version 2.1 as published by the Free Software | - | 
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - | 
| 21 | ** packaging of this file.  Please review the following information to | - | 
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - | 
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | 
| 24 | ** | - | 
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - | 
| 26 | ** rights.  These rights are described in the Digia Qt LGPL Exception | - | 
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | 
| 28 | ** | - | 
| 29 | ** GNU General Public License Usage | - | 
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - | 
| 31 | ** General Public License version 3.0 as published by the Free Software | - | 
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - | 
| 33 | ** packaging of this file.  Please review the following information to | - | 
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - | 
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - | 
| 36 | ** | - | 
| 37 | ** | - | 
| 38 | ** $QT_END_LICENSE$ | - | 
| 39 | ** | - | 
| 40 | ****************************************************************************/ | - | 
| 41 |  | - | 
| 42 | #include <QtWidgets/qmessagebox.h> | - | 
| 43 |  | - | 
| 44 | #ifndef QT_NO_MESSAGEBOX | - | 
| 45 |  | - | 
| 46 | #include <QtWidgets/qdialogbuttonbox.h> | - | 
| 47 | #include "private/qlabel_p.h" | - | 
| 48 | #include "private/qapplication_p.h" | - | 
| 49 | #include <QtCore/qlist.h> | - | 
| 50 | #include <QtCore/qdebug.h> | - | 
| 51 | #include <QtWidgets/qstyle.h> | - | 
| 52 | #include <QtWidgets/qstyleoption.h> | - | 
| 53 | #include <QtWidgets/qgridlayout.h> | - | 
| 54 | #include <QtWidgets/qdesktopwidget.h> | - | 
| 55 | #include <QtWidgets/qpushbutton.h> | - | 
| 56 | #include <QtGui/qaccessible.h> | - | 
| 57 | #include <QtGui/qicon.h> | - | 
| 58 | #include <QtGui/qtextdocument.h> | - | 
| 59 | #include <QtWidgets/qapplication.h> | - | 
| 60 | #include <QtWidgets/qtextedit.h> | - | 
| 61 | #include <QtWidgets/qtextbrowser.h> | - | 
| 62 | #include <QtWidgets/qmenu.h> | - | 
| 63 | #include "qdialog_p.h" | - | 
| 64 | #include <QtGui/qfont.h> | - | 
| 65 | #include <QtGui/qfontmetrics.h> | - | 
| 66 | #include <QtGui/qclipboard.h> | - | 
| 67 |  | - | 
| 68 | #ifdef Q_OS_WIN | - | 
| 69 | #    include <QtCore/qt_windows.h> | - | 
| 70 | #include <qpa/qplatformnativeinterface.h> | - | 
| 71 | #endif | - | 
| 72 |  | - | 
| 73 | QT_BEGIN_NAMESPACE | - | 
| 74 |  | - | 
| 75 | #ifdef Q_OS_WIN | - | 
| 76 | HMENU qt_getWindowsSystemMenu(const QWidget *w) | - | 
| 77 | { | - | 
| 78 | if (QWindow *window = QApplicationPrivate::windowForWidget(w)) | - | 
| 79 | if (void *handle = QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window)) | - | 
| 80 | return GetSystemMenu(reinterpret_cast<HWND>(handle), false); | - | 
| 81 | return 0; | - | 
| 82 | } | - | 
| 83 | #endif | - | 
| 84 |  | - | 
| 85 | enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5, Old_Retry = 6, | - | 
| 86 | Old_Ignore = 7, Old_YesAll = 8, Old_NoAll = 9, Old_ButtonMask = 0xFF, | - | 
| 87 | NewButtonMask = 0xFFFFFC00 }; | - | 
| 88 |  | - | 
| 89 | enum DetailButtonLabel { ShowLabel = 0, HideLabel = 1 }; | - | 
| 90 | #ifndef QT_NO_TEXTEDIT | - | 
| 91 | class QMessageBoxDetailsText : public QWidget | - | 
| 92 | { | - | 
| 93 | public: | - | 
| 94 | class TextEdit : public QTextEdit | - | 
| 95 | { | - | 
| 96 | public: | - | 
| 97 | TextEdit(QWidget *parent=0) : QTextEdit(parent) { } executed:  }Execution Count:2 | 2 | 
| 98 | void contextMenuEvent(QContextMenuEvent * e) | - | 
| 99 | { | - | 
| 100 | #ifndef QT_NO_CONTEXTMENU | - | 
| 101 | QMenu *menu = createStandardContextMenu(); never executed (the execution status of this line is deduced):  QMenu *menu = createStandardContextMenu(); | - | 
| 102 | menu->setAttribute(Qt::WA_DeleteOnClose); never executed (the execution status of this line is deduced):  menu->setAttribute(Qt::WA_DeleteOnClose); | - | 
| 103 | menu->popup(e->globalPos()); never executed (the execution status of this line is deduced):  menu->popup(e->globalPos()); | - | 
| 104 | #else | - | 
| 105 | Q_UNUSED(e); | - | 
| 106 | #endif | - | 
| 107 | } | 0 | 
| 108 | }; | - | 
| 109 |  | - | 
| 110 | QMessageBoxDetailsText(QWidget *parent=0) | - | 
| 111 | : QWidget(parent) | - | 
| 112 | { | - | 
| 113 | QVBoxLayout *layout = new QVBoxLayout; executed (the execution status of this line is deduced):  QVBoxLayout *layout = new QVBoxLayout; | - | 
| 114 | layout->setMargin(0); executed (the execution status of this line is deduced):  layout->setMargin(0); | - | 
| 115 | QFrame *line = new QFrame(this); executed (the execution status of this line is deduced):  QFrame *line = new QFrame(this); | - | 
| 116 | line->setFrameShape(QFrame::HLine); executed (the execution status of this line is deduced):  line->setFrameShape(QFrame::HLine); | - | 
| 117 | line->setFrameShadow(QFrame::Sunken); executed (the execution status of this line is deduced):  line->setFrameShadow(QFrame::Sunken); | - | 
| 118 | layout->addWidget(line); executed (the execution status of this line is deduced):  layout->addWidget(line); | - | 
| 119 | textEdit = new TextEdit(); executed (the execution status of this line is deduced):  textEdit = new TextEdit(); | - | 
| 120 | textEdit->setFixedHeight(100); executed (the execution status of this line is deduced):  textEdit->setFixedHeight(100); | - | 
| 121 | textEdit->setFocusPolicy(Qt::NoFocus); executed (the execution status of this line is deduced):  textEdit->setFocusPolicy(Qt::NoFocus); | - | 
| 122 | textEdit->setReadOnly(true); executed (the execution status of this line is deduced):  textEdit->setReadOnly(true); | - | 
| 123 | layout->addWidget(textEdit); executed (the execution status of this line is deduced):  layout->addWidget(textEdit); | - | 
| 124 | setLayout(layout); executed (the execution status of this line is deduced):  setLayout(layout); | - | 
| 125 | } executed:  }Execution Count:2 | 2 | 
| 126 | void setText(const QString &text) { textEdit->setPlainText(text); } executed:  }Execution Count:2 | 2 | 
| 127 | QString text() const { return textEdit->toPlainText(); } executed:  return textEdit->toPlainText();Execution Count:1 | 1 | 
| 128 | private: | - | 
| 129 | TextEdit *textEdit; | - | 
| 130 | }; | - | 
| 131 | #endif // QT_NO_TEXTEDIT | - | 
| 132 |  | - | 
| 133 | class DetailButton : public QPushButton | - | 
| 134 | { | - | 
| 135 | public: | - | 
| 136 | DetailButton(QWidget *parent) : QPushButton(label(ShowLabel), parent) | - | 
| 137 | { | - | 
| 138 | setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); executed (the execution status of this line is deduced):  setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); | - | 
| 139 | } executed:  }Execution Count:2 | 2 | 
| 140 |  | - | 
| 141 | QString label(DetailButtonLabel label) const | - | 
| 142 | { return label == ShowLabel ? QMessageBox::tr("Show Details...") : QMessageBox::tr("Hide Details..."); } executed:  return label == ShowLabel ? QMessageBox::tr("Show Details...") : QMessageBox::tr("Hide Details...");Execution Count:11 | 11 | 
| 143 |  | - | 
| 144 | void setLabel(DetailButtonLabel lbl) | - | 
| 145 | { setText(label(lbl)); } executed:  }Execution Count:1 | 1 | 
| 146 |  | - | 
| 147 | QSize sizeHint() const | - | 
| 148 | { | - | 
| 149 | ensurePolished(); executed (the execution status of this line is deduced):  ensurePolished(); | - | 
| 150 | QStyleOptionButton opt; executed (the execution status of this line is deduced):  QStyleOptionButton opt; | - | 
| 151 | initStyleOption(&opt); executed (the execution status of this line is deduced):  initStyleOption(&opt); | - | 
| 152 | const QFontMetrics fm = fontMetrics(); executed (the execution status of this line is deduced):  const QFontMetrics fm = fontMetrics(); | - | 
| 153 | opt.text = label(ShowLabel); executed (the execution status of this line is deduced):  opt.text = label(ShowLabel); | - | 
| 154 | QSize sz = fm.size(Qt::TextShowMnemonic, opt.text); executed (the execution status of this line is deduced):  QSize sz = fm.size(Qt::TextShowMnemonic, opt.text); | - | 
| 155 | QSize ret = style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this). executed (the execution status of this line is deduced):  QSize ret = style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this). | - | 
| 156 | expandedTo(QApplication::globalStrut()); executed (the execution status of this line is deduced):  expandedTo(QApplication::globalStrut()); | - | 
| 157 | opt.text = label(HideLabel); executed (the execution status of this line is deduced):  opt.text = label(HideLabel); | - | 
| 158 | sz = fm.size(Qt::TextShowMnemonic, opt.text); executed (the execution status of this line is deduced):  sz = fm.size(Qt::TextShowMnemonic, opt.text); | - | 
| 159 | ret = ret.expandedTo(style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this). executed (the execution status of this line is deduced):  ret = ret.expandedTo(style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this). | - | 
| 160 | expandedTo(QApplication::globalStrut())); executed (the execution status of this line is deduced):  expandedTo(QApplication::globalStrut())); | - | 
| 161 | return ret; executed:  return ret;Execution Count:4 | 4 | 
| 162 | } | - | 
| 163 | }; | - | 
| 164 |  | - | 
| 165 |  | - | 
| 166 | class QMessageBoxPrivate : public QDialogPrivate | - | 
| 167 | { | - | 
| 168 | Q_DECLARE_PUBLIC(QMessageBox) | - | 
| 169 |  | - | 
| 170 | public: | - | 
| 171 | QMessageBoxPrivate() : escapeButton(0), defaultButton(0), clickedButton(0), detailsButton(0), | - | 
| 172 | #ifndef QT_NO_TEXTEDIT | - | 
| 173 | detailsText(0), | - | 
| 174 | #endif | - | 
| 175 | compatMode(false), autoAddOkButton(true), | - | 
| 176 | detectedEscapeButton(0), informativeLabel(0) { } executed:  }Execution Count:41 | 41 | 
| 177 |  | - | 
| 178 | void init(const QString &title = QString(), const QString &text = QString()); | - | 
| 179 | void _q_buttonClicked(QAbstractButton *); | - | 
| 180 |  | - | 
| 181 | QAbstractButton *findButton(int button0, int button1, int button2, int flags); | - | 
| 182 | void addOldButtons(int button0, int button1, int button2); | - | 
| 183 |  | - | 
| 184 | QAbstractButton *abstractButtonForId(int id) const; | - | 
| 185 | int execReturnCode(QAbstractButton *button); | - | 
| 186 |  | - | 
| 187 | void detectEscapeButton(); | - | 
| 188 | void updateSize(); | - | 
| 189 | int layoutMinimumWidth(); | - | 
| 190 | void retranslateStrings(); | - | 
| 191 |  | - | 
| 192 | #ifdef Q_OS_WINCE | - | 
| 193 | void hideSpecial(); | - | 
| 194 | #endif | - | 
| 195 |  | - | 
| 196 | static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, | - | 
| 197 | const QString &title, const QString &text, | - | 
| 198 | int button0, int button1, int button2); | - | 
| 199 | static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, | - | 
| 200 | const QString &title, const QString &text, | - | 
| 201 | const QString &button0Text, | - | 
| 202 | const QString &button1Text, | - | 
| 203 | const QString &button2Text, | - | 
| 204 | int defaultButtonNumber, | - | 
| 205 | int escapeButtonNumber); | - | 
| 206 |  | - | 
| 207 | static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, | - | 
| 208 | QMessageBox::Icon icon, const QString& title, const QString& text, | - | 
| 209 | QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton); | - | 
| 210 |  | - | 
| 211 | static QPixmap standardIcon(QMessageBox::Icon icon, QMessageBox *mb); | - | 
| 212 |  | - | 
| 213 | QLabel *label; | - | 
| 214 | QMessageBox::Icon icon; | - | 
| 215 | QLabel *iconLabel; | - | 
| 216 | QDialogButtonBox *buttonBox; | - | 
| 217 | QList<QAbstractButton *> customButtonList; | - | 
| 218 | QAbstractButton *escapeButton; | - | 
| 219 | QPushButton *defaultButton; | - | 
| 220 | QAbstractButton *clickedButton; | - | 
| 221 | DetailButton *detailsButton; | - | 
| 222 | #ifndef QT_NO_TEXTEDIT | - | 
| 223 | QMessageBoxDetailsText *detailsText; | - | 
| 224 | #endif | - | 
| 225 | bool compatMode; | - | 
| 226 | bool autoAddOkButton; | - | 
| 227 | QAbstractButton *detectedEscapeButton; | - | 
| 228 | QLabel *informativeLabel; | - | 
| 229 | QPointer<QObject> receiverToDisconnectOnClose; | - | 
| 230 | QByteArray memberToDisconnectOnClose; | - | 
| 231 | QByteArray signalToDisconnectOnClose; | - | 
| 232 | }; | - | 
| 233 |  | - | 
| 234 | void QMessageBoxPrivate::init(const QString &title, const QString &text) | - | 
| 235 | { | - | 
| 236 | Q_Q(QMessageBox); executed (the execution status of this line is deduced):  QMessageBox * const q = q_func(); | - | 
| 237 |  | - | 
| 238 | label = new QLabel; executed (the execution status of this line is deduced):  label = new QLabel; | - | 
| 239 | label->setObjectName(QLatin1String("qt_msgbox_label")); executed (the execution status of this line is deduced):  label->setObjectName(QLatin1String("qt_msgbox_label")); | - | 
| 240 | label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q))); executed (the execution status of this line is deduced):  label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q))); | - | 
| 241 | label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); executed (the execution status of this line is deduced):  label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); | - | 
| 242 | label->setOpenExternalLinks(true); executed (the execution status of this line is deduced):  label->setOpenExternalLinks(true); | - | 
| 243 | #if defined(Q_OS_MAC) | - | 
| 244 | label->setContentsMargins(16, 0, 0, 0); | - | 
| 245 | #else | - | 
| 246 | label->setContentsMargins(2, 0, 0, 0); executed (the execution status of this line is deduced):  label->setContentsMargins(2, 0, 0, 0); | - | 
| 247 | label->setIndent(9); executed (the execution status of this line is deduced):  label->setIndent(9); | - | 
| 248 | #endif | - | 
| 249 | icon = QMessageBox::NoIcon; executed (the execution status of this line is deduced):  icon = QMessageBox::NoIcon; | - | 
| 250 | iconLabel = new QLabel; executed (the execution status of this line is deduced):  iconLabel = new QLabel; | - | 
| 251 | iconLabel->setObjectName(QLatin1String("qt_msgboxex_icon_label")); executed (the execution status of this line is deduced):  iconLabel->setObjectName(QLatin1String("qt_msgboxex_icon_label")); | - | 
| 252 | iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); executed (the execution status of this line is deduced):  iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); | - | 
| 253 |  | - | 
| 254 | buttonBox = new QDialogButtonBox; executed (the execution status of this line is deduced):  buttonBox = new QDialogButtonBox; | - | 
| 255 | buttonBox->setObjectName(QLatin1String("qt_msgbox_buttonbox")); executed (the execution status of this line is deduced):  buttonBox->setObjectName(QLatin1String("qt_msgbox_buttonbox")); | - | 
| 256 | buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, q)); executed (the execution status of this line is deduced):  buttonBox->setCenterButtons(q->style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, q)); | - | 
| 257 | QObject::connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), executed (the execution status of this line is deduced):  QObject::connect(buttonBox, "2""clicked(QAbstractButton*)", | - | 
| 258 | q, SLOT(_q_buttonClicked(QAbstractButton*))); executed (the execution status of this line is deduced):  q, "1""_q_buttonClicked(QAbstractButton*)"); | - | 
| 259 |  | - | 
| 260 | QGridLayout *grid = new QGridLayout; executed (the execution status of this line is deduced):  QGridLayout *grid = new QGridLayout; | - | 
| 261 | #ifndef Q_OS_MAC | - | 
| 262 | grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop); executed (the execution status of this line is deduced):  grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop); | - | 
| 263 | grid->addWidget(label, 0, 1, 1, 1); executed (the execution status of this line is deduced):  grid->addWidget(label, 0, 1, 1, 1); | - | 
| 264 | // -- leave space for information label -- | - | 
| 265 | grid->addWidget(buttonBox, 2, 0, 1, 2); executed (the execution status of this line is deduced):  grid->addWidget(buttonBox, 2, 0, 1, 2); | - | 
| 266 | #else | - | 
| 267 | grid->setMargin(0); | - | 
| 268 | grid->setVerticalSpacing(8); | - | 
| 269 | grid->setHorizontalSpacing(0); | - | 
| 270 | q->setContentsMargins(24, 15, 24, 20); | - | 
| 271 | grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop | Qt::AlignLeft); | - | 
| 272 | grid->addWidget(label, 0, 1, 1, 1); | - | 
| 273 | // -- leave space for information label -- | - | 
| 274 | grid->setRowStretch(1, 100); | - | 
| 275 | grid->setRowMinimumHeight(2, 6); | - | 
| 276 | grid->addWidget(buttonBox, 3, 1, 1, 1); | - | 
| 277 | #endif | - | 
| 278 |  | - | 
| 279 | grid->setSizeConstraint(QLayout::SetNoConstraint); executed (the execution status of this line is deduced):  grid->setSizeConstraint(QLayout::SetNoConstraint); | - | 
| 280 | q->setLayout(grid); executed (the execution status of this line is deduced):  q->setLayout(grid); | - | 
| 281 |  | - | 
| 282 | if (!title.isEmpty() || !text.isEmpty()) { evaluated:  !title.isEmpty()| yes Evaluation Count:24 | yes Evaluation Count:17 | 
 evaluated:  !text.isEmpty()| yes Evaluation Count:3 | yes Evaluation Count:14 | 
 | 3-24 | 
| 283 | q->setWindowTitle(title); executed (the execution status of this line is deduced):  q->setWindowTitle(title); | - | 
| 284 | q->setText(text); executed (the execution status of this line is deduced):  q->setText(text); | - | 
| 285 | } executed:  }Execution Count:27 | 27 | 
| 286 | q->setModal(true); executed (the execution status of this line is deduced):  q->setModal(true); | - | 
| 287 |  | - | 
| 288 | #ifdef Q_OS_MAC | - | 
| 289 | QFont f = q->font(); | - | 
| 290 | f.setBold(true); | - | 
| 291 | label->setFont(f); | - | 
| 292 | #endif | - | 
| 293 | retranslateStrings(); executed (the execution status of this line is deduced):  retranslateStrings(); | - | 
| 294 | } executed:  }Execution Count:41 | 41 | 
| 295 |  | - | 
| 296 | int QMessageBoxPrivate::layoutMinimumWidth() | - | 
| 297 | { | - | 
| 298 | layout->activate(); executed (the execution status of this line is deduced):  layout->activate(); | - | 
| 299 | return layout->totalMinimumSize().width(); executed:  return layout->totalMinimumSize().width();Execution Count:96 | 96 | 
| 300 | } | - | 
| 301 |  | - | 
| 302 | void QMessageBoxPrivate::updateSize() | - | 
| 303 | { | - | 
| 304 | Q_Q(QMessageBox); executed (the execution status of this line is deduced):  QMessageBox * const q = q_func(); | - | 
| 305 |  | - | 
| 306 | if (!q->isVisible()) evaluated:  !q->isVisible()| yes Evaluation Count:101 | yes Evaluation Count:91 | 
 | 91-101 | 
| 307 | return; executed:  return;Execution Count:101 | 101 | 
| 308 |  | - | 
| 309 | QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); executed (the execution status of this line is deduced):  QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); | - | 
| 310 | #if defined(Q_OS_WINCE) | - | 
| 311 | // the width of the screen, less the window border. | - | 
| 312 | int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width()); | - | 
| 313 | #else | - | 
| 314 | int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this executed (the execution status of this line is deduced):  int hardLimit = qMin(screenSize.width() - 480, 1000); | - | 
| 315 | // on small screens allows the messagebox be the same size as the screen | - | 
| 316 | if (screenSize.width() <= 1024) partially evaluated:  screenSize.width() <= 1024| yes Evaluation Count:91 | no Evaluation Count:0 | 
 | 0-91 | 
| 317 | hardLimit = screenSize.width(); executed:  hardLimit = screenSize.width();Execution Count:91 | 91 | 
| 318 | #endif | - | 
| 319 | #ifdef Q_OS_MAC | - | 
| 320 | int softLimit = qMin(screenSize.width()/2, 420); | - | 
| 321 | #else | - | 
| 322 | // note: ideally on windows, hard and soft limits but it breaks compat | - | 
| 323 | #ifndef Q_OS_WINCE | - | 
| 324 | int softLimit = qMin(screenSize.width()/2, 500); executed (the execution status of this line is deduced):  int softLimit = qMin(screenSize.width()/2, 500); | - | 
| 325 | #else | - | 
| 326 | int softLimit = qMin(screenSize.width() * 3 / 4, 500); | - | 
| 327 | #endif //Q_OS_WINCE | - | 
| 328 | #endif | - | 
| 329 |  | - | 
| 330 | if (informativeLabel) evaluated:  informativeLabel| yes Evaluation Count:3 | yes Evaluation Count:88 | 
 | 3-88 | 
| 331 | informativeLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); executed:  informativeLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);Execution Count:3 | 3 | 
| 332 |  | - | 
| 333 | label->setWordWrap(false); // makes the label return min size executed (the execution status of this line is deduced):  label->setWordWrap(false); | - | 
| 334 | int width = layoutMinimumWidth(); executed (the execution status of this line is deduced):  int width = layoutMinimumWidth(); | - | 
| 335 |  | - | 
| 336 | if (width > softLimit) { evaluated:  width > softLimit| yes Evaluation Count:2 | yes Evaluation Count:89 | 
 | 2-89 | 
| 337 | label->setWordWrap(true); executed (the execution status of this line is deduced):  label->setWordWrap(true); | - | 
| 338 | width = qMax(softLimit, layoutMinimumWidth()); executed (the execution status of this line is deduced):  width = qMax(softLimit, layoutMinimumWidth()); | - | 
| 339 |  | - | 
| 340 | if (width > hardLimit) { partially evaluated:  width > hardLimit| no Evaluation Count:0 | yes Evaluation Count:2 | 
 | 0-2 | 
| 341 | label->d_func()->ensureTextControl(); never executed (the execution status of this line is deduced):  label->d_func()->ensureTextControl(); | - | 
| 342 | if (QWidgetTextControl *control = label->d_func()->control) { never evaluated: QWidgetTextControl *control = label->d_func()->control | 0 | 
| 343 | QTextOption opt = control->document()->defaultTextOption(); never executed (the execution status of this line is deduced):  QTextOption opt = control->document()->defaultTextOption(); | - | 
| 344 | opt.setWrapMode(QTextOption::WrapAnywhere); never executed (the execution status of this line is deduced):  opt.setWrapMode(QTextOption::WrapAnywhere); | - | 
| 345 | control->document()->setDefaultTextOption(opt); never executed (the execution status of this line is deduced):  control->document()->setDefaultTextOption(opt); | - | 
| 346 | } | 0 | 
| 347 | width = hardLimit; never executed (the execution status of this line is deduced):  width = hardLimit; | - | 
| 348 | } | 0 | 
| 349 | } executed:  }Execution Count:2 | 2 | 
| 350 |  | - | 
| 351 | if (informativeLabel) { evaluated:  informativeLabel| yes Evaluation Count:3 | yes Evaluation Count:88 | 
 | 3-88 | 
| 352 | label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); executed (the execution status of this line is deduced):  label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); | - | 
| 353 | QSizePolicy policy(QSizePolicy::Minimum, QSizePolicy::Preferred); executed (the execution status of this line is deduced):  QSizePolicy policy(QSizePolicy::Minimum, QSizePolicy::Preferred); | - | 
| 354 | policy.setHeightForWidth(true); executed (the execution status of this line is deduced):  policy.setHeightForWidth(true); | - | 
| 355 | informativeLabel->setSizePolicy(policy); executed (the execution status of this line is deduced):  informativeLabel->setSizePolicy(policy); | - | 
| 356 | width = qMax(width, layoutMinimumWidth()); executed (the execution status of this line is deduced):  width = qMax(width, layoutMinimumWidth()); | - | 
| 357 | if (width > hardLimit) { // longest word is really big, so wrap anywhere partially evaluated:  width > hardLimit| no Evaluation Count:0 | yes Evaluation Count:3 | 
 | 0-3 | 
| 358 | informativeLabel->d_func()->ensureTextControl(); never executed (the execution status of this line is deduced):  informativeLabel->d_func()->ensureTextControl(); | - | 
| 359 | if (QWidgetTextControl *control = informativeLabel->d_func()->control) { never evaluated: QWidgetTextControl *control = informativeLabel->d_func()->control | 0 | 
| 360 | QTextOption opt = control->document()->defaultTextOption(); never executed (the execution status of this line is deduced):  QTextOption opt = control->document()->defaultTextOption(); | - | 
| 361 | opt.setWrapMode(QTextOption::WrapAnywhere); never executed (the execution status of this line is deduced):  opt.setWrapMode(QTextOption::WrapAnywhere); | - | 
| 362 | control->document()->setDefaultTextOption(opt); never executed (the execution status of this line is deduced):  control->document()->setDefaultTextOption(opt); | - | 
| 363 | } | 0 | 
| 364 | width = hardLimit; never executed (the execution status of this line is deduced):  width = hardLimit; | - | 
| 365 | } | 0 | 
| 366 | policy.setHeightForWidth(label->wordWrap()); executed (the execution status of this line is deduced):  policy.setHeightForWidth(label->wordWrap()); | - | 
| 367 | label->setSizePolicy(policy); executed (the execution status of this line is deduced):  label->setSizePolicy(policy); | - | 
| 368 | } executed:  }Execution Count:3 | 3 | 
| 369 |  | - | 
| 370 | QFontMetrics fm(QApplication::font("QMdiSubWindowTitleBar")); executed (the execution status of this line is deduced):  QFontMetrics fm(QApplication::font("QMdiSubWindowTitleBar")); | - | 
| 371 | int windowTitleWidth = qMin(fm.width(q->windowTitle()) + 50, hardLimit); executed (the execution status of this line is deduced):  int windowTitleWidth = qMin(fm.width(q->windowTitle()) + 50, hardLimit); | - | 
| 372 | if (windowTitleWidth > width) partially evaluated:  windowTitleWidth > width| no Evaluation Count:0 | yes Evaluation Count:91 | 
 | 0-91 | 
| 373 | width = windowTitleWidth; never executed: width = windowTitleWidth; | 0 | 
| 374 |  | - | 
| 375 | layout->activate(); executed (the execution status of this line is deduced):  layout->activate(); | - | 
| 376 | int height = (layout->hasHeightForWidth()) evaluated:  (layout->hasHeightForWidth())| yes Evaluation Count:5 | yes Evaluation Count:86 | 
 | 5-86 | 
| 377 | ? layout->totalHeightForWidth(width) executed (the execution status of this line is deduced):  ? layout->totalHeightForWidth(width) | - | 
| 378 | : layout->totalMinimumSize().height(); executed (the execution status of this line is deduced):  : layout->totalMinimumSize().height(); | - | 
| 379 |  | - | 
| 380 | q->setFixedSize(width, height); executed (the execution status of this line is deduced):  q->setFixedSize(width, height); | - | 
| 381 | QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); executed (the execution status of this line is deduced):  QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); | - | 
| 382 | } executed:  }Execution Count:91 | 91 | 
| 383 |  | - | 
| 384 |  | - | 
| 385 | #ifdef Q_OS_WINCE | - | 
| 386 | /*! | - | 
| 387 | \internal | - | 
| 388 | Hides special buttons which are rather shown in the title bar | - | 
| 389 | on WinCE, to conserve screen space. | - | 
| 390 | */ | - | 
| 391 |  | - | 
| 392 | void QMessageBoxPrivate::hideSpecial() | - | 
| 393 | { | - | 
| 394 | Q_Q(QMessageBox); | - | 
| 395 | QList<QPushButton*> list = q->findChildren<QPushButton*>(); | - | 
| 396 | for (int i=0; i<list.size(); ++i) { | - | 
| 397 | QPushButton *pb = list.at(i); | - | 
| 398 | QString text = pb->text(); | - | 
| 399 | text.remove(QChar::fromLatin1('&')); | - | 
| 400 | if (text == QApplication::translate("QMessageBox", "OK" )) | - | 
| 401 | pb->setFixedSize(0,0); | - | 
| 402 | } | - | 
| 403 | } | - | 
| 404 | #endif | - | 
| 405 |  | - | 
| 406 | static int oldButton(int button) | - | 
| 407 | { | - | 
| 408 | switch (button & QMessageBox::ButtonMask) { | - | 
| 409 | case QMessageBox::Ok: | - | 
| 410 | return Old_Ok; never executed: return Old_Ok; | 0 | 
| 411 | case QMessageBox::Cancel: | - | 
| 412 | return Old_Cancel; never executed: return Old_Cancel; | 0 | 
| 413 | case QMessageBox::Yes: | - | 
| 414 | return Old_Yes; never executed: return Old_Yes; | 0 | 
| 415 | case QMessageBox::No: | - | 
| 416 | return Old_No; never executed: return Old_No; | 0 | 
| 417 | case QMessageBox::Abort: | - | 
| 418 | return Old_Abort; never executed: return Old_Abort; | 0 | 
| 419 | case QMessageBox::Retry: | - | 
| 420 | return Old_Retry; never executed: return Old_Retry; | 0 | 
| 421 | case QMessageBox::Ignore: | - | 
| 422 | return Old_Ignore; never executed: return Old_Ignore; | 0 | 
| 423 | case QMessageBox::YesToAll: | - | 
| 424 | return Old_YesAll; never executed: return Old_YesAll; | 0 | 
| 425 | case QMessageBox::NoToAll: | - | 
| 426 | return Old_NoAll; never executed: return Old_NoAll; | 0 | 
| 427 | default: | - | 
| 428 | return 0; never executed: return 0; | 0 | 
| 429 | } | - | 
| 430 | } | 0 | 
| 431 |  | - | 
| 432 | int QMessageBoxPrivate::execReturnCode(QAbstractButton *button) | - | 
| 433 | { | - | 
| 434 | int ret = buttonBox->standardButton(button); executed (the execution status of this line is deduced):  int ret = buttonBox->standardButton(button); | - | 
| 435 | if (ret == QMessageBox::NoButton) { evaluated:  ret == QMessageBox::NoButton| yes Evaluation Count:5 | yes Evaluation Count:40 | 
 | 5-40 | 
| 436 | ret = customButtonList.indexOf(button); // if button == 0, correctly sets ret = -1 executed (the execution status of this line is deduced):  ret = customButtonList.indexOf(button); | - | 
| 437 | } else if (compatMode) { executed:  }Execution Count:5 partially evaluated:  compatMode| no Evaluation Count:0 | yes Evaluation Count:40 | 
 | 0-40 | 
| 438 | ret = oldButton(ret); never executed (the execution status of this line is deduced):  ret = oldButton(ret); | - | 
| 439 | } | 0 | 
| 440 | return ret; executed:  return ret;Execution Count:45 | 45 | 
| 441 | } | - | 
| 442 |  | - | 
| 443 | void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button) | - | 
| 444 | { | - | 
| 445 | Q_Q(QMessageBox); executed (the execution status of this line is deduced):  QMessageBox * const q = q_func(); | - | 
| 446 | #ifndef QT_NO_TEXTEDIT | - | 
| 447 | if (detailsButton && detailsText && button == detailsButton) { partially evaluated:  detailsButton| no Evaluation Count:0 | yes Evaluation Count:32 | 
 never evaluated: detailsText never evaluated: button == detailsButton | 0-32 | 
| 448 | detailsButton->setLabel(detailsText->isHidden() ? HideLabel : ShowLabel); never executed (the execution status of this line is deduced):  detailsButton->setLabel(detailsText->isHidden() ? HideLabel : ShowLabel); | - | 
| 449 | detailsText->setHidden(!detailsText->isHidden()); never executed (the execution status of this line is deduced):  detailsText->setHidden(!detailsText->isHidden()); | - | 
| 450 | updateSize(); never executed (the execution status of this line is deduced):  updateSize(); | - | 
| 451 | } else | 0 | 
| 452 | #endif | - | 
| 453 | { | - | 
| 454 | clickedButton = button; executed (the execution status of this line is deduced):  clickedButton = button; | - | 
| 455 | q->done(execReturnCode(button)); // does not trigger closeEvent executed (the execution status of this line is deduced):  q->done(execReturnCode(button)); | - | 
| 456 | emit q->buttonClicked(button); executed (the execution status of this line is deduced):  q->buttonClicked(button); | - | 
| 457 |  | - | 
| 458 | if (receiverToDisconnectOnClose) { partially evaluated:  receiverToDisconnectOnClose| no Evaluation Count:0 | yes Evaluation Count:32 | 
 | 0-32 | 
| 459 | QObject::disconnect(q, signalToDisconnectOnClose, receiverToDisconnectOnClose, never executed (the execution status of this line is deduced):  QObject::disconnect(q, signalToDisconnectOnClose, receiverToDisconnectOnClose, | - | 
| 460 | memberToDisconnectOnClose); never executed (the execution status of this line is deduced):  memberToDisconnectOnClose); | - | 
| 461 | receiverToDisconnectOnClose = 0; never executed (the execution status of this line is deduced):  receiverToDisconnectOnClose = 0; | - | 
| 462 | } | 0 | 
| 463 | signalToDisconnectOnClose.clear(); executed (the execution status of this line is deduced):  signalToDisconnectOnClose.clear(); | - | 
| 464 | memberToDisconnectOnClose.clear(); executed (the execution status of this line is deduced):  memberToDisconnectOnClose.clear(); | - | 
| 465 | } executed:  }Execution Count:32 | 32 | 
| 466 | } | - | 
| 467 |  | - | 
| 468 | /*! | - | 
| 469 | \class QMessageBox | - | 
| 470 |  | - | 
| 471 | \brief The QMessageBox class provides a modal dialog for informing | - | 
| 472 | the user or for asking the user a question and receiving an answer. | - | 
| 473 |  | - | 
| 474 | \ingroup standard-dialogs | - | 
| 475 | \inmodule QtWidgets | - | 
| 476 |  | - | 
| 477 | A message box displays a primary \l{QMessageBox::text}{text} to | - | 
| 478 | alert the user to a situation, an \l{QMessageBox::informativeText} | - | 
| 479 | {informative text} to further explain the alert or to ask the user | - | 
| 480 | a question, and an optional \l{QMessageBox::detailedText} | - | 
| 481 | {detailed text} to provide even more data if the user requests | - | 
| 482 | it. A message box can also display an \l{QMessageBox::icon} {icon} | - | 
| 483 | and \l{QMessageBox::standardButtons} {standard buttons} for | - | 
| 484 | accepting a user response. | - | 
| 485 |  | - | 
| 486 | Two APIs for using QMessageBox are provided, the property-based | - | 
| 487 | API, and the static functions. Calling one of the static functions | - | 
| 488 | is the simpler approach, but it is less flexible than using the | - | 
| 489 | property-based API, and the result is less informative. Using the | - | 
| 490 | property-based API is recommended. | - | 
| 491 |  | - | 
| 492 | \section1 The Property-based API | - | 
| 493 |  | - | 
| 494 | To use the property-based API, construct an instance of | - | 
| 495 | QMessageBox, set the desired properties, and call exec() to show | - | 
| 496 | the message. The simplest configuration is to set only the | - | 
| 497 | \l{QMessageBox::text} {message text} property. | - | 
| 498 |  | - | 
| 499 | \snippet code/src_gui_dialogs_qmessagebox.cpp 5 | - | 
| 500 |  | - | 
| 501 | The user must click the \uicontrol{OK} button to dismiss the message | - | 
| 502 | box. The rest of the GUI is blocked until the message box is | - | 
| 503 | dismissed. | - | 
| 504 |  | - | 
| 505 | \image msgbox1.png | - | 
| 506 |  | - | 
| 507 | A better approach than just alerting the user to an event is to | - | 
| 508 | also ask the user what to do about it. Store the question in the | - | 
| 509 | \l{QMessageBox::informativeText} {informative text} property, and | - | 
| 510 | set the \l{QMessageBox::standardButtons} {standard buttons} | - | 
| 511 | property to the set of buttons you want as the set of user | - | 
| 512 | responses. The buttons are specified by combining values from | - | 
| 513 | StandardButtons using the bitwise OR operator. The display order | - | 
| 514 | for the buttons is platform-dependent. For example, on Windows, | - | 
| 515 | \uicontrol{Save} is displayed to the left of \uicontrol{Cancel}, whereas on | - | 
| 516 | Mac OS, the order is reversed. | - | 
| 517 |  | - | 
| 518 | Mark one of your standard buttons to be your | - | 
| 519 | \l{QMessageBox::defaultButton()} {default button}. | - | 
| 520 |  | - | 
| 521 | \snippet code/src_gui_dialogs_qmessagebox.cpp 6 | - | 
| 522 |  | - | 
| 523 | This is the approach recommended in the | - | 
| 524 | \l{http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID} | - | 
| 525 | {Mac OS X Guidelines}. Similar guidelines apply for the other | - | 
| 526 | platforms, but note the different ways the | - | 
| 527 | \l{QMessageBox::informativeText} {informative text} is handled for | - | 
| 528 | different platforms. | - | 
| 529 |  | - | 
| 530 | \image msgbox2.png | - | 
| 531 |  | - | 
| 532 | The exec() slot returns the StandardButtons value of the button | - | 
| 533 | that was clicked. | - | 
| 534 |  | - | 
| 535 | \snippet code/src_gui_dialogs_qmessagebox.cpp 7 | - | 
| 536 |  | - | 
| 537 | To give the user more information to help him answer the question, | - | 
| 538 | set the \l{QMessageBox::detailedText} {detailed text} property. If | - | 
| 539 | the \l{QMessageBox::detailedText} {detailed text} property is set, | - | 
| 540 | the \uicontrol{Show Details...} button will be shown. | - | 
| 541 |  | - | 
| 542 | \image msgbox3.png | - | 
| 543 |  | - | 
| 544 | Clicking the \uicontrol{Show Details...} button displays the detailed text. | - | 
| 545 |  | - | 
| 546 | \image msgbox4.png | - | 
| 547 |  | - | 
| 548 | \section2 Rich Text and the Text Format Property | - | 
| 549 |  | - | 
| 550 | The \l{QMessageBox::detailedText} {detailed text} property is | - | 
| 551 | always interpreted as plain text. The \l{QMessageBox::text} {main | - | 
| 552 | text} and \l{QMessageBox::informativeText} {informative text} | - | 
| 553 | properties can be either plain text or rich text. These strings | - | 
| 554 | are interpreted according to the setting of the | - | 
| 555 | \l{QMessageBox::textFormat} {text format} property. The default | - | 
| 556 | setting is \l{Qt::AutoText} {auto-text}. | - | 
| 557 |  | - | 
| 558 | Note that for some plain text strings containing XML | - | 
| 559 | meta-characters, the auto-text \l{Qt::mightBeRichText()} {rich | - | 
| 560 | text detection test} may fail causing your plain text string to be | - | 
| 561 | interpreted incorrectly as rich text. In these rare cases, use | - | 
| 562 | Qt::convertFromPlainText() to convert your plain text string to a | - | 
| 563 | visually equivalent rich text string, or set the | - | 
| 564 | \l{QMessageBox::textFormat} {text format} property explicitly with | - | 
| 565 | setTextFormat(). | - | 
| 566 |  | - | 
| 567 | \section2 Severity Levels and the Icon and Pixmap Properties | - | 
| 568 |  | - | 
| 569 | QMessageBox supports four predefined message severity levels, or message | - | 
| 570 | types, which really only differ in the predefined icon they each show. | - | 
| 571 | Specify one of the four predefined message types by setting the | - | 
| 572 | \l{QMessageBox::icon}{icon} property to one of the | - | 
| 573 | \l{QMessageBox::Icon}{predefined icons}. The following rules are | - | 
| 574 | guidelines: | - | 
| 575 |  | - | 
| 576 | \table | - | 
| 577 | \row | - | 
| 578 | \li \image qmessagebox-quest.png | - | 
| 579 | \li \l Question | - | 
| 580 | \li For asking a question during normal operations. | - | 
| 581 | \row | - | 
| 582 | \li \image qmessagebox-info.png | - | 
| 583 | \li \l Information | - | 
| 584 | \li For reporting information about normal operations. | - | 
| 585 | \row | - | 
| 586 | \li \image qmessagebox-warn.png | - | 
| 587 | \li \l Warning | - | 
| 588 | \li For reporting non-critical errors. | - | 
| 589 | \row | - | 
| 590 | \li \image qmessagebox-crit.png | - | 
| 591 | \li \l Critical | - | 
| 592 | \li For reporting critical errors. | - | 
| 593 | \endtable | - | 
| 594 |  | - | 
| 595 | \l{QMessageBox::Icon}{Predefined icons} are not defined by QMessageBox, but | - | 
| 596 | provided by the style. The default value is \l{QMessageBox::NoIcon} | - | 
| 597 | {No Icon}. The message boxes are otherwise the same for all cases. When | - | 
| 598 | using a standard icon, use the one recommended in the table, or use the | - | 
| 599 | one recommended by the style guidelines for your platform. If none of the | - | 
| 600 | standard icons is right for your message box, you can use a custom icon by | - | 
| 601 | setting the \l{QMessageBox::iconPixmap}{icon pixmap} property instead of | - | 
| 602 | setting the \l{QMessageBox::icon}{icon} property. | - | 
| 603 |  | - | 
| 604 | In summary, to set an icon, use \e{either} setIcon() for one of the | - | 
| 605 | standard icons, \e{or} setIconPixmap() for a custom icon. | - | 
| 606 |  | - | 
| 607 | \section1 The Static Functions API | - | 
| 608 |  | - | 
| 609 | Building message boxes with the static functions API, although | - | 
| 610 | convenient, is less flexible than using the property-based API, | - | 
| 611 | because the static function signatures lack parameters for setting | - | 
| 612 | the \l{QMessageBox::informativeText} {informative text} and | - | 
| 613 | \l{QMessageBox::detailedText} {detailed text} properties. One | - | 
| 614 | work-around for this has been to use the \c{title} parameter as | - | 
| 615 | the message box main text and the \c{text} parameter as the | - | 
| 616 | message box informative text. Because this has the obvious | - | 
| 617 | drawback of making a less readable message box, platform | - | 
| 618 | guidelines do not recommend it. The \e{Microsoft Windows User | - | 
| 619 | Interface Guidelines} recommend using the | - | 
| 620 | \l{QCoreApplication::applicationName} {application name} as the | - | 
| 621 | \l{QMessageBox::setWindowTitle()} {window's title}, which means | - | 
| 622 | that if you have an informative text in addition to your main | - | 
| 623 | text, you must concatenate it to the \c{text} parameter. | - | 
| 624 |  | - | 
| 625 | Note that the static function signatures have changed with respect | - | 
| 626 | to their button parameters, which are now used to set the | - | 
| 627 | \l{QMessageBox::standardButtons} {standard buttons} and the | - | 
| 628 | \l{QMessageBox::defaultButton()} {default button}. | - | 
| 629 |  | - | 
| 630 | Static functions are available for creating information(), | - | 
| 631 | question(), warning(), and critical() message boxes. | - | 
| 632 |  | - | 
| 633 | \snippet code/src_gui_dialogs_qmessagebox.cpp 0 | - | 
| 634 |  | - | 
| 635 | The \l{dialogs/standarddialogs}{Standard Dialogs} example shows | - | 
| 636 | how to use QMessageBox and the other built-in Qt dialogs. | - | 
| 637 |  | - | 
| 638 | \section1 Advanced Usage | - | 
| 639 |  | - | 
| 640 | If the \l{QMessageBox::StandardButtons} {standard buttons} are not | - | 
| 641 | flexible enough for your message box, you can use the addButton() | - | 
| 642 | overload that takes a text and a ButtonRoleto to add custom | - | 
| 643 | buttons. The ButtonRole is used by QMessageBox to determine the | - | 
| 644 | ordering of the buttons on screen (which varies according to the | - | 
| 645 | platform). You can test the value of clickedButton() after calling | - | 
| 646 | exec(). For example, | - | 
| 647 |  | - | 
| 648 | \snippet code/src_gui_dialogs_qmessagebox.cpp 2 | - | 
| 649 |  | - | 
| 650 | \section1 Default and Escape Keys | - | 
| 651 |  | - | 
| 652 | The default button (i.e., the button activated when \uicontrol Enter is | - | 
| 653 | pressed) can be specified using setDefaultButton(). If a default | - | 
| 654 | button is not specified, QMessageBox tries to find one based on | - | 
| 655 | the \l{ButtonRole} {button roles} of the buttons used in the | - | 
| 656 | message box. | - | 
| 657 |  | - | 
| 658 | The escape button (the button activated when \uicontrol Esc is pressed) | - | 
| 659 | can be specified using setEscapeButton().  If an escape button is | - | 
| 660 | not specified, QMessageBox tries to find one using these rules: | - | 
| 661 |  | - | 
| 662 | \list 1 | - | 
| 663 |  | - | 
| 664 | \li If there is only one button, it is the button activated when | - | 
| 665 | \uicontrol Esc is pressed. | - | 
| 666 |  | - | 
| 667 | \li If there is a \l Cancel button, it is the button activated when | - | 
| 668 | \uicontrol Esc is pressed. | - | 
| 669 |  | - | 
| 670 | \li If there is exactly one button having either | - | 
| 671 | \l{QMessageBox::RejectRole} {the Reject role} or the | - | 
| 672 | \l{QMessageBox::NoRole} {the No role}, it is the button | - | 
| 673 | activated when \uicontrol Esc is pressed. | - | 
| 674 |  | - | 
| 675 | \endlist | - | 
| 676 |  | - | 
| 677 | When an escape button can't be determined using these rules, | - | 
| 678 | pressing \uicontrol Esc has no effect. | - | 
| 679 |  | - | 
| 680 | \sa QDialogButtonBox, {fowler}{GUI Design Handbook: Message Box}, {Standard Dialogs Example}, {Application Example} | - | 
| 681 | */ | - | 
| 682 |  | - | 
| 683 | /*! | - | 
| 684 | \enum QMessageBox::StandardButton | - | 
| 685 | \since 4.2 | - | 
| 686 |  | - | 
| 687 | These enums describe flags for standard buttons. Each button has a | - | 
| 688 | defined \l ButtonRole. | - | 
| 689 |  | - | 
| 690 | \value Ok An "OK" button defined with the \l AcceptRole. | - | 
| 691 | \value Open An "Open" button defined with the \l AcceptRole. | - | 
| 692 | \value Save A "Save" button defined with the \l AcceptRole. | - | 
| 693 | \value Cancel A "Cancel" button defined with the \l RejectRole. | - | 
| 694 | \value Close A "Close" button defined with the \l RejectRole. | - | 
| 695 | \value Discard A "Discard" or "Don't Save" button, depending on the platform, | - | 
| 696 | defined with the \l DestructiveRole. | - | 
| 697 | \value Apply An "Apply" button defined with the \l ApplyRole. | - | 
| 698 | \value Reset A "Reset" button defined with the \l ResetRole. | - | 
| 699 | \value RestoreDefaults A "Restore Defaults" button defined with the \l ResetRole. | - | 
| 700 | \value Help A "Help" button defined with the \l HelpRole. | - | 
| 701 | \value SaveAll A "Save All" button defined with the \l AcceptRole. | - | 
| 702 | \value Yes A "Yes" button defined with the \l YesRole. | - | 
| 703 | \value YesToAll A "Yes to All" button defined with the \l YesRole. | - | 
| 704 | \value No A "No" button defined with the \l NoRole. | - | 
| 705 | \value NoToAll A "No to All" button defined with the \l NoRole. | - | 
| 706 | \value Abort An "Abort" button defined with the \l RejectRole. | - | 
| 707 | \value Retry A "Retry" button defined with the \l AcceptRole. | - | 
| 708 | \value Ignore An "Ignore" button defined with the \l AcceptRole. | - | 
| 709 |  | - | 
| 710 | \value NoButton An invalid button. | - | 
| 711 |  | - | 
| 712 | \omitvalue FirstButton | - | 
| 713 | \omitvalue LastButton | - | 
| 714 |  | - | 
| 715 | The following values are obsolete: | - | 
| 716 |  | - | 
| 717 | \value YesAll Use YesToAll instead. | - | 
| 718 | \value NoAll Use NoToAll instead. | - | 
| 719 | \value Default Use the \c defaultButton argument of | - | 
| 720 | information(), warning(), etc. instead, or call | - | 
| 721 | setDefaultButton(). | - | 
| 722 | \value Escape Call setEscapeButton() instead. | - | 
| 723 | \value FlagMask | - | 
| 724 | \value ButtonMask | - | 
| 725 |  | - | 
| 726 | \sa ButtonRole, standardButtons | - | 
| 727 | */ | - | 
| 728 |  | - | 
| 729 | /*! | - | 
| 730 | \fn void QMessageBox::buttonClicked(QAbstractButton *button) | - | 
| 731 |  | - | 
| 732 | This signal is emitted whenever a button is clicked inside the QMessageBox. | - | 
| 733 | The button that was clicked in returned in \a button. | - | 
| 734 | */ | - | 
| 735 |  | - | 
| 736 | /*! | - | 
| 737 | Constructs a message box with no text and no buttons. \a parent is | - | 
| 738 | passed to the QDialog constructor. | - | 
| 739 |  | - | 
| 740 | On Mac OS X, if you want your message box to appear | - | 
| 741 | as a Qt::Sheet of its \a parent, set the message box's | - | 
| 742 | \l{setWindowModality()} {window modality} to Qt::WindowModal or use open(). | - | 
| 743 | Otherwise, the message box will be a standard dialog. | - | 
| 744 |  | - | 
| 745 | */ | - | 
| 746 | QMessageBox::QMessageBox(QWidget *parent) | - | 
| 747 | : QDialog(*new QMessageBoxPrivate, parent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) | - | 
| 748 | { | - | 
| 749 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 750 | d->init(); executed (the execution status of this line is deduced):  d->init(); | - | 
| 751 | } executed:  }Execution Count:13 | 13 | 
| 752 |  | - | 
| 753 | /*! | - | 
| 754 | Constructs a message box with the given \a icon, \a title, \a | - | 
| 755 | text, and standard \a buttons. Standard or custom buttons can be | - | 
| 756 | added at any time using addButton(). The \a parent and \a f | - | 
| 757 | arguments are passed to the QDialog constructor. | - | 
| 758 |  | - | 
| 759 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 760 | dialog box. | - | 
| 761 |  | - | 
| 762 | On Mac OS X, if \a parent is not 0 and you want your message box | - | 
| 763 | to appear as a Qt::Sheet of that parent, set the message box's | - | 
| 764 | \l{setWindowModality()} {window modality} to Qt::WindowModal | - | 
| 765 | (default). Otherwise, the message box will be a standard dialog. | - | 
| 766 |  | - | 
| 767 | \sa setWindowTitle(), setText(), setIcon(), setStandardButtons() | - | 
| 768 | */ | - | 
| 769 | QMessageBox::QMessageBox(Icon icon, const QString &title, const QString &text, | - | 
| 770 | StandardButtons buttons, QWidget *parent, | - | 
| 771 | Qt::WindowFlags f) | - | 
| 772 | : QDialog(*new QMessageBoxPrivate, parent, f | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) | - | 
| 773 | { | - | 
| 774 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 775 | d->init(title, text); executed (the execution status of this line is deduced):  d->init(title, text); | - | 
| 776 | setIcon(icon); executed (the execution status of this line is deduced):  setIcon(icon); | - | 
| 777 | if (buttons != NoButton) evaluated:  buttons != NoButton| yes Evaluation Count:1 | yes Evaluation Count:25 | 
 | 1-25 | 
| 778 | setStandardButtons(buttons); executed:  setStandardButtons(buttons);Execution Count:1 | 1 | 
| 779 | } executed:  }Execution Count:26 | 26 | 
| 780 |  | - | 
| 781 | /*! | - | 
| 782 | Destroys the message box. | - | 
| 783 | */ | - | 
| 784 | QMessageBox::~QMessageBox() | - | 
| 785 | { | - | 
| 786 | } | - | 
| 787 |  | - | 
| 788 | /*! | - | 
| 789 | \since 4.2 | - | 
| 790 |  | - | 
| 791 | Adds the given \a button to the message box with the specified \a | - | 
| 792 | role. | - | 
| 793 |  | - | 
| 794 | \sa removeButton(), button(), setStandardButtons() | - | 
| 795 | */ | - | 
| 796 | void QMessageBox::addButton(QAbstractButton *button, ButtonRole role) | - | 
| 797 | { | - | 
| 798 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 799 | if (!button) evaluated:  !button| yes Evaluation Count:1 | yes Evaluation Count:12 | 
 | 1-12 | 
| 800 | return; executed:  return;Execution Count:1 | 1 | 
| 801 | removeButton(button); executed (the execution status of this line is deduced):  removeButton(button); | - | 
| 802 | d->buttonBox->addButton(button, (QDialogButtonBox::ButtonRole)role); executed (the execution status of this line is deduced):  d->buttonBox->addButton(button, (QDialogButtonBox::ButtonRole)role); | - | 
| 803 | d->customButtonList.append(button); executed (the execution status of this line is deduced):  d->customButtonList.append(button); | - | 
| 804 | d->autoAddOkButton = false; executed (the execution status of this line is deduced):  d->autoAddOkButton = false; | - | 
| 805 | } executed:  }Execution Count:12 | 12 | 
| 806 |  | - | 
| 807 | /*! | - | 
| 808 | \since 4.2 | - | 
| 809 | \overload | - | 
| 810 |  | - | 
| 811 | Creates a button with the given \a text, adds it to the message box for the | - | 
| 812 | specified \a role, and returns it. | - | 
| 813 | */ | - | 
| 814 | QPushButton *QMessageBox::addButton(const QString& text, ButtonRole role) | - | 
| 815 | { | - | 
| 816 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 817 | QPushButton *pushButton = new QPushButton(text); executed (the execution status of this line is deduced):  QPushButton *pushButton = new QPushButton(text); | - | 
| 818 | addButton(pushButton, role); executed (the execution status of this line is deduced):  addButton(pushButton, role); | - | 
| 819 | d->updateSize(); executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 820 | return pushButton; executed:  return pushButton;Execution Count:8 | 8 | 
| 821 | } | - | 
| 822 |  | - | 
| 823 | /*! | - | 
| 824 | \since 4.2 | - | 
| 825 | \overload | - | 
| 826 |  | - | 
| 827 | Adds a standard \a button to the message box if it is valid to do so, and | - | 
| 828 | returns the push button. | - | 
| 829 |  | - | 
| 830 | \sa setStandardButtons() | - | 
| 831 | */ | - | 
| 832 | QPushButton *QMessageBox::addButton(StandardButton button) | - | 
| 833 | { | - | 
| 834 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 835 | QPushButton *pushButton = d->buttonBox->addButton((QDialogButtonBox::StandardButton)button); executed (the execution status of this line is deduced):  QPushButton *pushButton = d->buttonBox->addButton((QDialogButtonBox::StandardButton)button); | - | 
| 836 | if (pushButton) evaluated:  pushButton| yes Evaluation Count:92 | yes Evaluation Count:10 | 
 | 10-92 | 
| 837 | d->autoAddOkButton = false; executed:  d->autoAddOkButton = false;Execution Count:92 | 92 | 
| 838 | return pushButton; executed:  return pushButton;Execution Count:102 | 102 | 
| 839 | } | - | 
| 840 |  | - | 
| 841 | /*! | - | 
| 842 | \since 4.2 | - | 
| 843 |  | - | 
| 844 | Removes \a button from the button box without deleting it. | - | 
| 845 |  | - | 
| 846 | \sa addButton(), setStandardButtons() | - | 
| 847 | */ | - | 
| 848 | void QMessageBox::removeButton(QAbstractButton *button) | - | 
| 849 | { | - | 
| 850 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 851 | d->customButtonList.removeAll(button); executed (the execution status of this line is deduced):  d->customButtonList.removeAll(button); | - | 
| 852 | if (d->escapeButton == button) evaluated:  d->escapeButton == button| yes Evaluation Count:1 | yes Evaluation Count:13 | 
 | 1-13 | 
| 853 | d->escapeButton = 0; executed:  d->escapeButton = 0;Execution Count:1 | 1 | 
| 854 | if (d->defaultButton == button) evaluated:  d->defaultButton == button| yes Evaluation Count:1 | yes Evaluation Count:13 | 
 | 1-13 | 
| 855 | d->defaultButton = 0; executed:  d->defaultButton = 0;Execution Count:1 | 1 | 
| 856 | d->buttonBox->removeButton(button); executed (the execution status of this line is deduced):  d->buttonBox->removeButton(button); | - | 
| 857 | d->updateSize(); executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 858 | } executed:  }Execution Count:14 | 14 | 
| 859 |  | - | 
| 860 | /*! | - | 
| 861 | \property QMessageBox::standardButtons | - | 
| 862 | \brief collection of standard buttons in the message box | - | 
| 863 | \since 4.2 | - | 
| 864 |  | - | 
| 865 | This property controls which standard buttons are used by the message box. | - | 
| 866 |  | - | 
| 867 | By default, this property contains no standard buttons. | - | 
| 868 |  | - | 
| 869 | \sa addButton() | - | 
| 870 | */ | - | 
| 871 | void QMessageBox::setStandardButtons(StandardButtons buttons) | - | 
| 872 | { | - | 
| 873 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 874 | d->buttonBox->setStandardButtons(QDialogButtonBox::StandardButtons(int(buttons))); executed (the execution status of this line is deduced):  d->buttonBox->setStandardButtons(QDialogButtonBox::StandardButtons(int(buttons))); | - | 
| 875 |  | - | 
| 876 | QList<QAbstractButton *> buttonList = d->buttonBox->buttons(); executed (the execution status of this line is deduced):  QList<QAbstractButton *> buttonList = d->buttonBox->buttons(); | - | 
| 877 | if (!buttonList.contains(d->escapeButton)) partially evaluated:  !buttonList.contains(d->escapeButton)| yes Evaluation Count:4 | no Evaluation Count:0 | 
 | 0-4 | 
| 878 | d->escapeButton = 0; executed:  d->escapeButton = 0;Execution Count:4 | 4 | 
| 879 | if (!buttonList.contains(d->defaultButton)) partially evaluated:  !buttonList.contains(d->defaultButton)| yes Evaluation Count:4 | no Evaluation Count:0 | 
 | 0-4 | 
| 880 | d->defaultButton = 0; executed:  d->defaultButton = 0;Execution Count:4 | 4 | 
| 881 | d->autoAddOkButton = false; executed (the execution status of this line is deduced):  d->autoAddOkButton = false; | - | 
| 882 | d->updateSize(); executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 883 | } executed:  }Execution Count:4 | 4 | 
| 884 |  | - | 
| 885 | QMessageBox::StandardButtons QMessageBox::standardButtons() const | - | 
| 886 | { | - | 
| 887 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 888 | return QMessageBox::StandardButtons(int(d->buttonBox->standardButtons())); executed:  return QMessageBox::StandardButtons(int(d->buttonBox->standardButtons()));Execution Count:1 | 1 | 
| 889 | } | - | 
| 890 |  | - | 
| 891 | /*! | - | 
| 892 | \since 4.2 | - | 
| 893 |  | - | 
| 894 | Returns the standard button enum value corresponding to the given \a button, | - | 
| 895 | or NoButton if the given \a button isn't a standard button. | - | 
| 896 |  | - | 
| 897 | \sa button(), standardButtons() | - | 
| 898 | */ | - | 
| 899 | QMessageBox::StandardButton QMessageBox::standardButton(QAbstractButton *button) const | - | 
| 900 | { | - | 
| 901 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 902 | return (QMessageBox::StandardButton)d->buttonBox->standardButton(button); executed:  return (QMessageBox::StandardButton)d->buttonBox->standardButton(button);Execution Count:18 | 18 | 
| 903 | } | - | 
| 904 |  | - | 
| 905 | /*! | - | 
| 906 | \since 4.2 | - | 
| 907 |  | - | 
| 908 | Returns a pointer corresponding to the standard button \a which, | - | 
| 909 | or 0 if the standard button doesn't exist in this message box. | - | 
| 910 |  | - | 
| 911 | \sa standardButtons, standardButton() | - | 
| 912 | */ | - | 
| 913 | QAbstractButton *QMessageBox::button(StandardButton which) const | - | 
| 914 | { | - | 
| 915 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 916 | return d->buttonBox->button(QDialogButtonBox::StandardButton(which)); executed:  return d->buttonBox->button(QDialogButtonBox::StandardButton(which));Execution Count:33 | 33 | 
| 917 | } | - | 
| 918 |  | - | 
| 919 | /*! | - | 
| 920 | \since 4.2 | - | 
| 921 |  | - | 
| 922 | Returns the button that is activated when escape is pressed. | - | 
| 923 |  | - | 
| 924 | By default, QMessageBox attempts to automatically detect an | - | 
| 925 | escape button as follows: | - | 
| 926 |  | - | 
| 927 | \list 1 | - | 
| 928 | \li If there is only one button, it is made the escape button. | - | 
| 929 | \li If there is a \l Cancel button, it is made the escape button. | - | 
| 930 | \li On Mac OS X only, if there is exactly one button with the role | - | 
| 931 | QMessageBox::RejectRole, it is made the escape button. | - | 
| 932 | \endlist | - | 
| 933 |  | - | 
| 934 | When an escape button could not be automatically detected, pressing | - | 
| 935 | \uicontrol Esc has no effect. | - | 
| 936 |  | - | 
| 937 | \sa addButton() | - | 
| 938 | */ | - | 
| 939 | QAbstractButton *QMessageBox::escapeButton() const | - | 
| 940 | { | - | 
| 941 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 942 | return d->escapeButton; executed:  return d->escapeButton;Execution Count:8 | 8 | 
| 943 | } | - | 
| 944 |  | - | 
| 945 | /*! | - | 
| 946 | \since 4.2 | - | 
| 947 |  | - | 
| 948 | Sets the button that gets activated when the \uicontrol Escape key is | - | 
| 949 | pressed to \a button. | - | 
| 950 |  | - | 
| 951 | \sa addButton(), clickedButton() | - | 
| 952 | */ | - | 
| 953 | void QMessageBox::setEscapeButton(QAbstractButton *button) | - | 
| 954 | { | - | 
| 955 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 956 | if (d->buttonBox->buttons().contains(button)) evaluated:  d->buttonBox->buttons().contains(button)| yes Evaluation Count:5 | yes Evaluation Count:11 | 
 | 5-11 | 
| 957 | d->escapeButton = button; executed:  d->escapeButton = button;Execution Count:5 | 5 | 
| 958 | } executed:  }Execution Count:16 | 16 | 
| 959 |  | - | 
| 960 | /*! | - | 
| 961 | \since 4.3 | - | 
| 962 |  | - | 
| 963 | Sets the buttons that gets activated when the \uicontrol Escape key is | - | 
| 964 | pressed to \a button. | - | 
| 965 |  | - | 
| 966 | \sa addButton(), clickedButton() | - | 
| 967 | */ | - | 
| 968 | void QMessageBox::setEscapeButton(QMessageBox::StandardButton button) | - | 
| 969 | { | - | 
| 970 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 971 | setEscapeButton(d->buttonBox->button(QDialogButtonBox::StandardButton(button))); executed (the execution status of this line is deduced):  setEscapeButton(d->buttonBox->button(QDialogButtonBox::StandardButton(button))); | - | 
| 972 | } executed:  }Execution Count:3 | 3 | 
| 973 |  | - | 
| 974 | void QMessageBoxPrivate::detectEscapeButton() | - | 
| 975 | { | - | 
| 976 | if (escapeButton) { // escape button explicitly set evaluated:  escapeButton| yes Evaluation Count:9 | yes Evaluation Count:40 | 
 | 9-40 | 
| 977 | detectedEscapeButton = escapeButton; executed (the execution status of this line is deduced):  detectedEscapeButton = escapeButton; | - | 
| 978 | return; executed:  return;Execution Count:9 | 9 | 
| 979 | } | - | 
| 980 |  | - | 
| 981 | // Cancel button automatically becomes escape button | - | 
| 982 | detectedEscapeButton = buttonBox->button(QDialogButtonBox::Cancel); executed (the execution status of this line is deduced):  detectedEscapeButton = buttonBox->button(QDialogButtonBox::Cancel); | - | 
| 983 | if (detectedEscapeButton) evaluated:  detectedEscapeButton| yes Evaluation Count:13 | yes Evaluation Count:27 | 
 | 13-27 | 
| 984 | return; executed:  return;Execution Count:13 | 13 | 
| 985 |  | - | 
| 986 | // If there is only one button, make it the escape button | - | 
| 987 | const QList<QAbstractButton *> buttons = buttonBox->buttons(); executed (the execution status of this line is deduced):  const QList<QAbstractButton *> buttons = buttonBox->buttons(); | - | 
| 988 | if (buttons.count() == 1) { evaluated:  buttons.count() == 1| yes Evaluation Count:10 | yes Evaluation Count:17 | 
 | 10-17 | 
| 989 | detectedEscapeButton = buttons.first(); executed (the execution status of this line is deduced):  detectedEscapeButton = buttons.first(); | - | 
| 990 | return; executed:  return;Execution Count:10 | 10 | 
| 991 | } | - | 
| 992 |  | - | 
| 993 | // if the message box has one RejectRole button, make it the escape button | - | 
| 994 | for (int i = 0; i < buttons.count(); i++) { evaluated:  i < buttons.count()| yes Evaluation Count:44 | yes Evaluation Count:16 | 
 | 16-44 | 
| 995 | if (buttonBox->buttonRole(buttons.at(i)) == QDialogButtonBox::RejectRole) { evaluated:  buttonBox->buttonRole(buttons.at(i)) == QDialogButtonBox::RejectRole| yes Evaluation Count:3 | yes Evaluation Count:41 | 
 | 3-41 | 
| 996 | if (detectedEscapeButton) { // already detected! evaluated:  detectedEscapeButton| yes Evaluation Count:1 | yes Evaluation Count:2 | 
 | 1-2 | 
| 997 | detectedEscapeButton = 0; executed (the execution status of this line is deduced):  detectedEscapeButton = 0; | - | 
| 998 | break; executed:  break;Execution Count:1 | 1 | 
| 999 | } | - | 
| 1000 | detectedEscapeButton = buttons.at(i); executed (the execution status of this line is deduced):  detectedEscapeButton = buttons.at(i); | - | 
| 1001 | } executed:  }Execution Count:2 | 2 | 
| 1002 | } executed:  }Execution Count:43 | 43 | 
| 1003 | if (detectedEscapeButton) evaluated:  detectedEscapeButton| yes Evaluation Count:1 | yes Evaluation Count:16 | 
 | 1-16 | 
| 1004 | return; executed:  return;Execution Count:1 | 1 | 
| 1005 |  | - | 
| 1006 | // if the message box has one NoRole button, make it the escape button | - | 
| 1007 | for (int i = 0; i < buttons.count(); i++) { evaluated:  i < buttons.count()| yes Evaluation Count:43 | yes Evaluation Count:16 | 
 | 16-43 | 
| 1008 | if (buttonBox->buttonRole(buttons.at(i)) == QDialogButtonBox::NoRole) { evaluated:  buttonBox->buttonRole(buttons.at(i)) == QDialogButtonBox::NoRole| yes Evaluation Count:13 | yes Evaluation Count:30 | 
 | 13-30 | 
| 1009 | if (detectedEscapeButton) { // already detected! partially evaluated:  detectedEscapeButton| no Evaluation Count:0 | yes Evaluation Count:13 | 
 | 0-13 | 
| 1010 | detectedEscapeButton = 0; never executed (the execution status of this line is deduced):  detectedEscapeButton = 0; | - | 
| 1011 | break; | 0 | 
| 1012 | } | - | 
| 1013 | detectedEscapeButton = buttons.at(i); executed (the execution status of this line is deduced):  detectedEscapeButton = buttons.at(i); | - | 
| 1014 | } executed:  }Execution Count:13 | 13 | 
| 1015 | } executed:  }Execution Count:43 | 43 | 
| 1016 | } executed:  }Execution Count:16 | 16 | 
| 1017 |  | - | 
| 1018 | /*! | - | 
| 1019 | \since 4.2 | - | 
| 1020 |  | - | 
| 1021 | Returns the button that was clicked by the user, | - | 
| 1022 | or 0 if the user hit the \uicontrol Esc key and | - | 
| 1023 | no \l{setEscapeButton()}{escape button} was set. | - | 
| 1024 |  | - | 
| 1025 | If exec() hasn't been called yet, returns 0. | - | 
| 1026 |  | - | 
| 1027 | Example: | - | 
| 1028 |  | - | 
| 1029 | \snippet code/src_gui_dialogs_qmessagebox.cpp 3 | - | 
| 1030 |  | - | 
| 1031 | \sa standardButton(), button() | - | 
| 1032 | */ | - | 
| 1033 | QAbstractButton *QMessageBox::clickedButton() const | - | 
| 1034 | { | - | 
| 1035 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 1036 | return d->clickedButton; executed:  return d->clickedButton;Execution Count:28 | 28 | 
| 1037 | } | - | 
| 1038 |  | - | 
| 1039 | /*! | - | 
| 1040 | \since 4.2 | - | 
| 1041 |  | - | 
| 1042 | Returns the button that should be the message box's | - | 
| 1043 | \l{QPushButton::setDefault()}{default button}. Returns 0 | - | 
| 1044 | if no default button was set. | - | 
| 1045 |  | - | 
| 1046 | \sa addButton(), QPushButton::setDefault() | - | 
| 1047 | */ | - | 
| 1048 | QPushButton *QMessageBox::defaultButton() const | - | 
| 1049 | { | - | 
| 1050 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 1051 | return d->defaultButton; executed:  return d->defaultButton;Execution Count:64 | 64 | 
| 1052 | } | - | 
| 1053 |  | - | 
| 1054 | /*! | - | 
| 1055 | \since 4.2 | - | 
| 1056 |  | - | 
| 1057 | Sets the message box's \l{QPushButton::setDefault()}{default button} | - | 
| 1058 | to \a button. | - | 
| 1059 |  | - | 
| 1060 | \sa addButton(), QPushButton::setDefault() | - | 
| 1061 | */ | - | 
| 1062 | void QMessageBox::setDefaultButton(QPushButton *button) | - | 
| 1063 | { | - | 
| 1064 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1065 | if (!d->buttonBox->buttons().contains(button)) evaluated:  !d->buttonBox->buttons().contains(button)| yes Evaluation Count:8 | yes Evaluation Count:17 | 
 | 8-17 | 
| 1066 | return; executed:  return;Execution Count:8 | 8 | 
| 1067 | d->defaultButton = button; executed (the execution status of this line is deduced):  d->defaultButton = button; | - | 
| 1068 | button->setDefault(true); executed (the execution status of this line is deduced):  button->setDefault(true); | - | 
| 1069 | button->setFocus(); executed (the execution status of this line is deduced):  button->setFocus(); | - | 
| 1070 | } executed:  }Execution Count:17 | 17 | 
| 1071 |  | - | 
| 1072 | /*! | - | 
| 1073 | \since 4.3 | - | 
| 1074 |  | - | 
| 1075 | Sets the message box's \l{QPushButton::setDefault()}{default button} | - | 
| 1076 | to \a button. | - | 
| 1077 |  | - | 
| 1078 | \sa addButton(), QPushButton::setDefault() | - | 
| 1079 | */ | - | 
| 1080 | void QMessageBox::setDefaultButton(QMessageBox::StandardButton button) | - | 
| 1081 | { | - | 
| 1082 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1083 | setDefaultButton(d->buttonBox->button(QDialogButtonBox::StandardButton(button))); executed (the execution status of this line is deduced):  setDefaultButton(d->buttonBox->button(QDialogButtonBox::StandardButton(button))); | - | 
| 1084 | } executed:  }Execution Count:4 | 4 | 
| 1085 |  | - | 
| 1086 | /*! | - | 
| 1087 | \property QMessageBox::text | - | 
| 1088 | \brief the message box text to be displayed. | - | 
| 1089 |  | - | 
| 1090 | The text will be interpreted either as a plain text or as rich text, | - | 
| 1091 | depending on the text format setting (\l QMessageBox::textFormat). | - | 
| 1092 | The default setting is Qt::AutoText, i.e., the message box will try | - | 
| 1093 | to auto-detect the format of the text. | - | 
| 1094 |  | - | 
| 1095 | The default value of this property is an empty string. | - | 
| 1096 |  | - | 
| 1097 | \sa textFormat, QMessageBox::informativeText, QMessageBox::detailedText | - | 
| 1098 | */ | - | 
| 1099 | QString QMessageBox::text() const | - | 
| 1100 | { | - | 
| 1101 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 1102 | return d->label->text(); executed:  return d->label->text();Execution Count:20 | 20 | 
| 1103 | } | - | 
| 1104 |  | - | 
| 1105 | void QMessageBox::setText(const QString &text) | - | 
| 1106 | { | - | 
| 1107 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1108 | d->label->setText(text); executed (the execution status of this line is deduced):  d->label->setText(text); | - | 
| 1109 | d->label->setWordWrap(d->label->textFormat() == Qt::RichText executed (the execution status of this line is deduced):  d->label->setWordWrap(d->label->textFormat() == Qt::RichText | - | 
| 1110 | || (d->label->textFormat() == Qt::AutoText && Qt::mightBeRichText(text))); executed (the execution status of this line is deduced):  || (d->label->textFormat() == Qt::AutoText && Qt::mightBeRichText(text))); | - | 
| 1111 | d->updateSize(); executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 1112 | } executed:  }Execution Count:32 | 32 | 
| 1113 |  | - | 
| 1114 | /*! | - | 
| 1115 | \enum QMessageBox::Icon | - | 
| 1116 |  | - | 
| 1117 | This enum has the following values: | - | 
| 1118 |  | - | 
| 1119 | \value NoIcon the message box does not have any icon. | - | 
| 1120 |  | - | 
| 1121 | \value Question an icon indicating that | - | 
| 1122 | the message is asking a question. | - | 
| 1123 |  | - | 
| 1124 | \value Information an icon indicating that | - | 
| 1125 | the message is nothing out of the ordinary. | - | 
| 1126 |  | - | 
| 1127 | \value Warning an icon indicating that the | - | 
| 1128 | message is a warning, but can be dealt with. | - | 
| 1129 |  | - | 
| 1130 | \value Critical an icon indicating that | - | 
| 1131 | the message represents a critical problem. | - | 
| 1132 |  | - | 
| 1133 | */ | - | 
| 1134 |  | - | 
| 1135 | /*! | - | 
| 1136 | \property QMessageBox::icon | - | 
| 1137 | \brief the message box's icon | - | 
| 1138 |  | - | 
| 1139 | The icon of the message box can be specified with one of the | - | 
| 1140 | values: | - | 
| 1141 |  | - | 
| 1142 | \list | - | 
| 1143 | \li QMessageBox::NoIcon | - | 
| 1144 | \li QMessageBox::Question | - | 
| 1145 | \li QMessageBox::Information | - | 
| 1146 | \li QMessageBox::Warning | - | 
| 1147 | \li QMessageBox::Critical | - | 
| 1148 | \endlist | - | 
| 1149 |  | - | 
| 1150 | The default is QMessageBox::NoIcon. | - | 
| 1151 |  | - | 
| 1152 | The pixmap used to display the actual icon depends on the current | - | 
| 1153 | \l{QWidget::style()} {GUI style}. You can also set a custom pixmap | - | 
| 1154 | for the icon by setting the \l{QMessageBox::iconPixmap} {icon | - | 
| 1155 | pixmap} property. | - | 
| 1156 |  | - | 
| 1157 | \sa iconPixmap | - | 
| 1158 | */ | - | 
| 1159 | QMessageBox::Icon QMessageBox::icon() const | - | 
| 1160 | { | - | 
| 1161 | Q_D(const QMessageBox); never executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 1162 | return d->icon; never executed: return d->icon; | 0 | 
| 1163 | } | - | 
| 1164 |  | - | 
| 1165 | void QMessageBox::setIcon(Icon icon) | - | 
| 1166 | { | - | 
| 1167 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1168 | setIconPixmap(QMessageBoxPrivate::standardIcon((QMessageBox::Icon)icon, executed (the execution status of this line is deduced):  setIconPixmap(QMessageBoxPrivate::standardIcon((QMessageBox::Icon)icon, | - | 
| 1169 | this)); executed (the execution status of this line is deduced):  this)); | - | 
| 1170 | d->icon = icon; executed (the execution status of this line is deduced):  d->icon = icon; | - | 
| 1171 | } executed:  }Execution Count:38 | 38 | 
| 1172 |  | - | 
| 1173 | /*! | - | 
| 1174 | \property QMessageBox::iconPixmap | - | 
| 1175 | \brief the current icon | - | 
| 1176 |  | - | 
| 1177 | The icon currently used by the message box. Note that it's often | - | 
| 1178 | hard to draw one pixmap that looks appropriate in all GUI styles; | - | 
| 1179 | you may want to supply a different pixmap for each platform. | - | 
| 1180 |  | - | 
| 1181 | By default, this property is undefined. | - | 
| 1182 |  | - | 
| 1183 | \sa icon | - | 
| 1184 | */ | - | 
| 1185 | QPixmap QMessageBox::iconPixmap() const | - | 
| 1186 | { | - | 
| 1187 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 1188 | if (d->iconLabel && d->iconLabel->pixmap()) partially evaluated:  d->iconLabel| yes Evaluation Count:1 | no Evaluation Count:0 | 
 partially evaluated:  d->iconLabel->pixmap()| no Evaluation Count:0 | yes Evaluation Count:1 | 
 | 0-1 | 
| 1189 | return *d->iconLabel->pixmap(); never executed: return *d->iconLabel->pixmap(); | 0 | 
| 1190 | return QPixmap(); executed:  return QPixmap();Execution Count:1 | 1 | 
| 1191 | } | - | 
| 1192 |  | - | 
| 1193 | void QMessageBox::setIconPixmap(const QPixmap &pixmap) | - | 
| 1194 | { | - | 
| 1195 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1196 | d->iconLabel->setPixmap(pixmap); executed (the execution status of this line is deduced):  d->iconLabel->setPixmap(pixmap); | - | 
| 1197 | d->updateSize(); executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 1198 | d->icon = NoIcon; executed (the execution status of this line is deduced):  d->icon = NoIcon; | - | 
| 1199 | } executed:  }Execution Count:42 | 42 | 
| 1200 |  | - | 
| 1201 | /*! | - | 
| 1202 | \property QMessageBox::textFormat | - | 
| 1203 | \brief the format of the text displayed by the message box | - | 
| 1204 |  | - | 
| 1205 | The current text format used by the message box. See the \l | - | 
| 1206 | Qt::TextFormat enum for an explanation of the possible options. | - | 
| 1207 |  | - | 
| 1208 | The default format is Qt::AutoText. | - | 
| 1209 |  | - | 
| 1210 | \sa setText() | - | 
| 1211 | */ | - | 
| 1212 | Qt::TextFormat QMessageBox::textFormat() const | - | 
| 1213 | { | - | 
| 1214 | Q_D(const QMessageBox); never executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 1215 | return d->label->textFormat(); never executed: return d->label->textFormat(); | 0 | 
| 1216 | } | - | 
| 1217 |  | - | 
| 1218 | void QMessageBox::setTextFormat(Qt::TextFormat format) | - | 
| 1219 | { | - | 
| 1220 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1221 | d->label->setTextFormat(format); executed (the execution status of this line is deduced):  d->label->setTextFormat(format); | - | 
| 1222 | d->label->setWordWrap(format == Qt::RichText executed (the execution status of this line is deduced):  d->label->setWordWrap(format == Qt::RichText | - | 
| 1223 | || (format == Qt::AutoText && Qt::mightBeRichText(d->label->text()))); executed (the execution status of this line is deduced):  || (format == Qt::AutoText && Qt::mightBeRichText(d->label->text()))); | - | 
| 1224 | d->updateSize(); executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 1225 | } executed:  }Execution Count:2 | 2 | 
| 1226 |  | - | 
| 1227 | /*! | - | 
| 1228 | \reimp | - | 
| 1229 | */ | - | 
| 1230 | bool QMessageBox::event(QEvent *e) | - | 
| 1231 | { | - | 
| 1232 | bool result =QDialog::event(e); executed (the execution status of this line is deduced):  bool result =QDialog::event(e); | - | 
| 1233 | switch (e->type()) { | - | 
| 1234 | case QEvent::LayoutRequest: | - | 
| 1235 | d_func()->updateSize(); executed (the execution status of this line is deduced):  d_func()->updateSize(); | - | 
| 1236 | break; executed:  break;Execution Count:39 | 39 | 
| 1237 | case QEvent::LanguageChange: | - | 
| 1238 | d_func()->retranslateStrings(); executed (the execution status of this line is deduced):  d_func()->retranslateStrings(); | - | 
| 1239 | break; executed:  break;Execution Count:1 | 1 | 
| 1240 | #ifdef Q_OS_WINCE | - | 
| 1241 | case QEvent::OkRequest: | - | 
| 1242 | case QEvent::HelpRequest: { | - | 
| 1243 | QString bName = | - | 
| 1244 | (e->type() == QEvent::OkRequest) | - | 
| 1245 | ? QApplication::translate("QMessageBox", "OK") | - | 
| 1246 | : QApplication::translate("QMessageBox", "Help"); | - | 
| 1247 | QList<QPushButton*> list = findChildren<QPushButton*>(); | - | 
| 1248 | for (int i=0; i<list.size(); ++i) { | - | 
| 1249 | QPushButton *pb = list.at(i); | - | 
| 1250 | if (pb->text() == bName) { | - | 
| 1251 | if (pb->isEnabled()) | - | 
| 1252 | pb->click(); | - | 
| 1253 | return pb->isEnabled(); | - | 
| 1254 | } | - | 
| 1255 | } | - | 
| 1256 | } | - | 
| 1257 | #endif | - | 
| 1258 | default: | - | 
| 1259 | break; executed:  break;Execution Count:1521 | 1521 | 
| 1260 | } | - | 
| 1261 | return result; executed:  return result;Execution Count:1561 | 1561 | 
| 1262 | } | - | 
| 1263 |  | - | 
| 1264 | /*! | - | 
| 1265 | \reimp | - | 
| 1266 | */ | - | 
| 1267 | void QMessageBox::resizeEvent(QResizeEvent *event) | - | 
| 1268 | { | - | 
| 1269 | QDialog::resizeEvent(event); executed (the execution status of this line is deduced):  QDialog::resizeEvent(event); | - | 
| 1270 | } executed:  }Execution Count:89 | 89 | 
| 1271 |  | - | 
| 1272 | /*! | - | 
| 1273 | \reimp | - | 
| 1274 | */ | - | 
| 1275 | void QMessageBox::closeEvent(QCloseEvent *e) | - | 
| 1276 | { | - | 
| 1277 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1278 | if (!d->detectedEscapeButton) { partially evaluated:  !d->detectedEscapeButton| no Evaluation Count:0 | yes Evaluation Count:13 | 
 | 0-13 | 
| 1279 | e->ignore(); never executed (the execution status of this line is deduced):  e->ignore(); | - | 
| 1280 | return; | 0 | 
| 1281 | } | - | 
| 1282 | QDialog::closeEvent(e); executed (the execution status of this line is deduced):  QDialog::closeEvent(e); | - | 
| 1283 | d->clickedButton = d->detectedEscapeButton; executed (the execution status of this line is deduced):  d->clickedButton = d->detectedEscapeButton; | - | 
| 1284 | setResult(d->execReturnCode(d->detectedEscapeButton)); executed (the execution status of this line is deduced):  setResult(d->execReturnCode(d->detectedEscapeButton)); | - | 
| 1285 | } executed:  }Execution Count:13 | 13 | 
| 1286 |  | - | 
| 1287 | /*! | - | 
| 1288 | \reimp | - | 
| 1289 | */ | - | 
| 1290 | void QMessageBox::changeEvent(QEvent *ev) | - | 
| 1291 | { | - | 
| 1292 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1293 | switch (ev->type()) { | - | 
| 1294 | case QEvent::StyleChange: | - | 
| 1295 | { | - | 
| 1296 | if (d->icon != NoIcon) never evaluated: d->icon != NoIcon | 0 | 
| 1297 | setIcon(d->icon); never executed: setIcon(d->icon); | 0 | 
| 1298 | Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this)); never executed (the execution status of this line is deduced):  Qt::TextInteractionFlags flags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this)); | - | 
| 1299 | d->label->setTextInteractionFlags(flags); never executed (the execution status of this line is deduced):  d->label->setTextInteractionFlags(flags); | - | 
| 1300 | d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this)); never executed (the execution status of this line is deduced):  d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this)); | - | 
| 1301 | if (d->informativeLabel) never evaluated: d->informativeLabel | 0 | 
| 1302 | d->informativeLabel->setTextInteractionFlags(flags); never executed: d->informativeLabel->setTextInteractionFlags(flags); | 0 | 
| 1303 | // intentional fall through | - | 
| 1304 | } | - | 
| 1305 | case QEvent::FontChange: | - | 
| 1306 | case QEvent::ApplicationFontChange: | - | 
| 1307 | #ifdef Q_OS_MAC | - | 
| 1308 | { | - | 
| 1309 | QFont f = font(); | - | 
| 1310 | f.setBold(true); | - | 
| 1311 | d->label->setFont(f); | - | 
| 1312 | } | - | 
| 1313 | #endif | - | 
| 1314 | default: | - | 
| 1315 | break; executed:  break;Execution Count:121 | 121 | 
| 1316 | } | - | 
| 1317 | QDialog::changeEvent(ev); executed (the execution status of this line is deduced):  QDialog::changeEvent(ev); | - | 
| 1318 | } executed:  }Execution Count:121 | 121 | 
| 1319 |  | - | 
| 1320 | /*! | - | 
| 1321 | \reimp | - | 
| 1322 | */ | - | 
| 1323 | void QMessageBox::keyPressEvent(QKeyEvent *e) | - | 
| 1324 | { | - | 
| 1325 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1326 | if (e->key() == Qt::Key_Escape evaluated:  e->key() == Qt::Key_Escape| yes Evaluation Count:11 | yes Evaluation Count:19 | 
 | 11-19 | 
| 1327 | #ifdef Q_OS_MAC | - | 
| 1328 | || (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period) | - | 
| 1329 | #endif | - | 
| 1330 | ) { | - | 
| 1331 | if (d->detectedEscapeButton) { partially evaluated:  d->detectedEscapeButton| yes Evaluation Count:11 | no Evaluation Count:0 | 
 | 0-11 | 
| 1332 | #ifdef Q_OS_MAC | - | 
| 1333 | d->detectedEscapeButton->animateClick(); | - | 
| 1334 | #else | - | 
| 1335 | d->detectedEscapeButton->click(); executed (the execution status of this line is deduced):  d->detectedEscapeButton->click(); | - | 
| 1336 | #endif | - | 
| 1337 | } executed:  }Execution Count:11 | 11 | 
| 1338 | return; executed:  return;Execution Count:11 | 11 | 
| 1339 | } | - | 
| 1340 |  | - | 
| 1341 | #if defined (Q_OS_WIN) && !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) | - | 
| 1342 | if (e == QKeySequence::Copy) { | - | 
| 1343 | QString separator = QString::fromLatin1("---------------------------\n"); | - | 
| 1344 | QString textToCopy = separator; | - | 
| 1345 | separator.prepend(QLatin1Char('\n')); | - | 
| 1346 | textToCopy += windowTitle() + separator; // title | - | 
| 1347 | textToCopy += d->label->text() + separator; // text | - | 
| 1348 |  | - | 
| 1349 | if (d->informativeLabel) | - | 
| 1350 | textToCopy += d->informativeLabel->text() + separator; | - | 
| 1351 |  | - | 
| 1352 | QString buttonTexts; | - | 
| 1353 | QList<QAbstractButton *> buttons = d->buttonBox->buttons(); | - | 
| 1354 | for (int i = 0; i < buttons.count(); i++) { | - | 
| 1355 | buttonTexts += buttons[i]->text() + QLatin1String("   "); | - | 
| 1356 | } | - | 
| 1357 | textToCopy += buttonTexts + separator; | - | 
| 1358 |  | - | 
| 1359 | QApplication::clipboard()->setText(textToCopy); | - | 
| 1360 | return; | - | 
| 1361 | } | - | 
| 1362 | #endif //QT_NO_SHORTCUT QT_NO_CLIPBOARD Q_OS_WIN | - | 
| 1363 |  | - | 
| 1364 | #ifndef QT_NO_SHORTCUT | - | 
| 1365 | if (!(e->modifiers() & Qt::AltModifier)) { partially evaluated:  !(e->modifiers() & Qt::AltModifier)| yes Evaluation Count:19 | no Evaluation Count:0 | 
 | 0-19 | 
| 1366 | int key = e->key() & ~Qt::MODIFIER_MASK; executed (the execution status of this line is deduced):  int key = e->key() & ~Qt::MODIFIER_MASK; | - | 
| 1367 | if (key) { partially evaluated:  key| yes Evaluation Count:19 | no Evaluation Count:0 | 
 | 0-19 | 
| 1368 | const QList<QAbstractButton *> buttons = d->buttonBox->buttons(); executed (the execution status of this line is deduced):  const QList<QAbstractButton *> buttons = d->buttonBox->buttons(); | - | 
| 1369 | for (int i = 0; i < buttons.count(); ++i) { evaluated:  i < buttons.count()| yes Evaluation Count:51 | yes Evaluation Count:18 | 
 | 18-51 | 
| 1370 | QAbstractButton *pb = buttons.at(i); executed (the execution status of this line is deduced):  QAbstractButton *pb = buttons.at(i); | - | 
| 1371 | QKeySequence shortcut = pb->shortcut(); executed (the execution status of this line is deduced):  QKeySequence shortcut = pb->shortcut(); | - | 
| 1372 | if (!shortcut.isEmpty() && key == int(shortcut[0] & ~Qt::MODIFIER_MASK)) { evaluated:  !shortcut.isEmpty()| yes Evaluation Count:37 | yes Evaluation Count:14 | 
 evaluated:  key == int(shortcut[0] & ~Qt::MODIFIER_MASK)| yes Evaluation Count:1 | yes Evaluation Count:36 | 
 | 1-37 | 
| 1373 | pb->animateClick(); executed (the execution status of this line is deduced):  pb->animateClick(); | - | 
| 1374 | return; executed:  return;Execution Count:1 | 1 | 
| 1375 | } | - | 
| 1376 | } executed:  }Execution Count:50 | 50 | 
| 1377 | } executed:  }Execution Count:18 | 18 | 
| 1378 | } executed:  }Execution Count:18 | 18 | 
| 1379 | #endif | - | 
| 1380 | QDialog::keyPressEvent(e); executed (the execution status of this line is deduced):  QDialog::keyPressEvent(e); | - | 
| 1381 | } executed:  }Execution Count:18 | 18 | 
| 1382 |  | - | 
| 1383 | #ifdef Q_OS_WINCE | - | 
| 1384 | /*! | - | 
| 1385 | \reimp | - | 
| 1386 | */ | - | 
| 1387 | void QMessageBox::setVisible(bool visible) | - | 
| 1388 | { | - | 
| 1389 | Q_D(QMessageBox); | - | 
| 1390 | if (visible) | - | 
| 1391 | d->hideSpecial(); | - | 
| 1392 | QDialog::setVisible(visible); | - | 
| 1393 | } | - | 
| 1394 | #endif | - | 
| 1395 |  | - | 
| 1396 |  | - | 
| 1397 | /*! | - | 
| 1398 | \overload | - | 
| 1399 |  | - | 
| 1400 | Opens the dialog and connects its finished() or buttonClicked() signal to | - | 
| 1401 | the slot specified by \a receiver and \a member. If the slot in \a member | - | 
| 1402 | has a pointer for its first parameter the connection is to buttonClicked(), | - | 
| 1403 | otherwise the connection is to finished(). | - | 
| 1404 |  | - | 
| 1405 | The signal will be disconnected from the slot when the dialog is closed. | - | 
| 1406 | */ | - | 
| 1407 | void QMessageBox::open(QObject *receiver, const char *member) | - | 
| 1408 | { | - | 
| 1409 | Q_D(QMessageBox); never executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1410 | const char *signal = member && strchr(member, '*') ? SIGNAL(buttonClicked(QAbstractButton*)) never evaluated: member never evaluated: strchr(member, '*') | 0 | 
| 1411 | : SIGNAL(finished(int)); never executed (the execution status of this line is deduced):  : "2""finished(int)"; | - | 
| 1412 | connect(this, signal, receiver, member); never executed (the execution status of this line is deduced):  connect(this, signal, receiver, member); | - | 
| 1413 | d->signalToDisconnectOnClose = signal; never executed (the execution status of this line is deduced):  d->signalToDisconnectOnClose = signal; | - | 
| 1414 | d->receiverToDisconnectOnClose = receiver; never executed (the execution status of this line is deduced):  d->receiverToDisconnectOnClose = receiver; | - | 
| 1415 | d->memberToDisconnectOnClose = member; never executed (the execution status of this line is deduced):  d->memberToDisconnectOnClose = member; | - | 
| 1416 | QDialog::open(); never executed (the execution status of this line is deduced):  QDialog::open(); | - | 
| 1417 | } | 0 | 
| 1418 |  | - | 
| 1419 | /*! | - | 
| 1420 | \since 4.5 | - | 
| 1421 |  | - | 
| 1422 | Returns a list of all the buttons that have been added to the message box. | - | 
| 1423 |  | - | 
| 1424 | \sa buttonRole(), addButton(), removeButton() | - | 
| 1425 | */ | - | 
| 1426 | QList<QAbstractButton *> QMessageBox::buttons() const | - | 
| 1427 | { | - | 
| 1428 | Q_D(const QMessageBox); never executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 1429 | return d->buttonBox->buttons(); never executed: return d->buttonBox->buttons(); | 0 | 
| 1430 | } | - | 
| 1431 |  | - | 
| 1432 | /*! | - | 
| 1433 | \since 4.5 | - | 
| 1434 |  | - | 
| 1435 | Returns the button role for the specified \a button. This function returns | - | 
| 1436 | \l InvalidRole if \a button is 0 or has not been added to the message box. | - | 
| 1437 |  | - | 
| 1438 | \sa buttons(), addButton() | - | 
| 1439 | */ | - | 
| 1440 | QMessageBox::ButtonRole QMessageBox::buttonRole(QAbstractButton *button) const | - | 
| 1441 | { | - | 
| 1442 | Q_D(const QMessageBox); never executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 1443 | return QMessageBox::ButtonRole(d->buttonBox->buttonRole(button)); never executed: return QMessageBox::ButtonRole(d->buttonBox->buttonRole(button)); | 0 | 
| 1444 | } | - | 
| 1445 |  | - | 
| 1446 | /*! | - | 
| 1447 | \reimp | - | 
| 1448 | */ | - | 
| 1449 | void QMessageBox::showEvent(QShowEvent *e) | - | 
| 1450 | { | - | 
| 1451 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1452 | if (d->autoAddOkButton) { evaluated:  d->autoAddOkButton| yes Evaluation Count:6 | yes Evaluation Count:43 | 
 | 6-43 | 
| 1453 | addButton(Ok); executed (the execution status of this line is deduced):  addButton(Ok); | - | 
| 1454 | #if defined(Q_OS_WINCE) | - | 
| 1455 | d->hideSpecial(); | - | 
| 1456 | #endif | - | 
| 1457 | } executed:  }Execution Count:6 | 6 | 
| 1458 | if (d->detailsButton) evaluated:  d->detailsButton| yes Evaluation Count:1 | yes Evaluation Count:48 | 
 | 1-48 | 
| 1459 | addButton(d->detailsButton, QMessageBox::ActionRole); executed:  addButton(d->detailsButton, QMessageBox::ActionRole);Execution Count:1 | 1 | 
| 1460 | d->detectEscapeButton(); executed (the execution status of this line is deduced):  d->detectEscapeButton(); | - | 
| 1461 | d->updateSize(); executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 1462 |  | - | 
| 1463 | #ifndef QT_NO_ACCESSIBILITY | - | 
| 1464 | QAccessibleEvent event(this, QAccessible::Alert); executed (the execution status of this line is deduced):  QAccessibleEvent event(this, QAccessible::Alert); | - | 
| 1465 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced):  QAccessible::updateAccessibility(&event); | - | 
| 1466 | #endif | - | 
| 1467 | #ifdef Q_OS_WIN | - | 
| 1468 | if (const HMENU systemMenu = qt_getWindowsSystemMenu(this)) { | - | 
| 1469 | EnableMenuItem(systemMenu, SC_CLOSE, d->detectedEscapeButton ? | - | 
| 1470 | MF_BYCOMMAND|MF_ENABLED : MF_BYCOMMAND|MF_GRAYED); | - | 
| 1471 | } | - | 
| 1472 | #endif | - | 
| 1473 | QDialog::showEvent(e); executed (the execution status of this line is deduced):  QDialog::showEvent(e); | - | 
| 1474 | } executed:  }Execution Count:49 | 49 | 
| 1475 |  | - | 
| 1476 |  | - | 
| 1477 | static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, | - | 
| 1478 | QMessageBox::Icon icon, | - | 
| 1479 | const QString& title, const QString& text, | - | 
| 1480 | QMessageBox::StandardButtons buttons, | - | 
| 1481 | QMessageBox::StandardButton defaultButton) | - | 
| 1482 | { | - | 
| 1483 | // necessary for source compatibility with Qt 4.0 and 4.1 | - | 
| 1484 | // handles (Yes, No) and (Yes|Default, No) | - | 
| 1485 | if (defaultButton && !(buttons & defaultButton)) evaluated:  defaultButton| yes Evaluation Count:12 | yes Evaluation Count:8 | 
 evaluated:  !(buttons & defaultButton)| yes Evaluation Count:4 | yes Evaluation Count:8 | 
 | 4-12 | 
| 1486 | return (QMessageBox::StandardButton) executed:  return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);Execution Count:4 | 4 | 
| 1487 | QMessageBoxPrivate::showOldMessageBox(parent, icon, title, executed:  return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);Execution Count:4 | 4 | 
| 1488 | text, int(buttons), executed:  return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);Execution Count:4 | 4 | 
| 1489 | int(defaultButton), 0); executed:  return (QMessageBox::StandardButton) QMessageBoxPrivate::showOldMessageBox(parent, icon, title, text, int(buttons), int(defaultButton), 0);Execution Count:4 | 4 | 
| 1490 |  | - | 
| 1491 | QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent); executed (the execution status of this line is deduced):  QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent); | - | 
| 1492 | QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox*>(); executed (the execution status of this line is deduced):  QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox*>(); | - | 
| 1493 | Q_ASSERT(buttonBox != 0); executed (the execution status of this line is deduced):  qt_noop(); | - | 
| 1494 |  | - | 
| 1495 | uint mask = QMessageBox::FirstButton; executed (the execution status of this line is deduced):  uint mask = QMessageBox::FirstButton; | - | 
| 1496 | while (mask <= QMessageBox::LastButton) { evaluated:  mask <= QMessageBox::LastButton| yes Evaluation Count:288 | yes Evaluation Count:16 | 
 | 16-288 | 
| 1497 | uint sb = buttons & mask; executed (the execution status of this line is deduced):  uint sb = buttons & mask; | - | 
| 1498 | mask <<= 1; executed (the execution status of this line is deduced):  mask <<= 1; | - | 
| 1499 | if (!sb) evaluated:  !sb| yes Evaluation Count:232 | yes Evaluation Count:56 | 
 | 56-232 | 
| 1500 | continue; executed:  continue;Execution Count:232 | 232 | 
| 1501 | QPushButton *button = msgBox.addButton((QMessageBox::StandardButton)sb); executed (the execution status of this line is deduced):  QPushButton *button = msgBox.addButton((QMessageBox::StandardButton)sb); | - | 
| 1502 | // Choose the first accept role as the default | - | 
| 1503 | if (msgBox.defaultButton()) evaluated:  msgBox.defaultButton()| yes Evaluation Count:12 | yes Evaluation Count:44 | 
 | 12-44 | 
| 1504 | continue; executed:  continue;Execution Count:12 | 12 | 
| 1505 | if ((defaultButton == QMessageBox::NoButton && buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) evaluated:  defaultButton == QMessageBox::NoButton| yes Evaluation Count:32 | yes Evaluation Count:12 | 
 partially evaluated:  buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole| no Evaluation Count:0 | yes Evaluation Count:32 | 
 | 0-32 | 
| 1506 | || (defaultButton != QMessageBox::NoButton && sb == uint(defaultButton))) evaluated:  defaultButton != QMessageBox::NoButton| yes Evaluation Count:12 | yes Evaluation Count:32 | 
 evaluated:  sb == uint(defaultButton)| yes Evaluation Count:8 | yes Evaluation Count:4 | 
 | 4-32 | 
| 1507 | msgBox.setDefaultButton(button); executed:  msgBox.setDefaultButton(button);Execution Count:8 | 8 | 
| 1508 | } executed:  }Execution Count:44 | 44 | 
| 1509 | if (msgBox.exec() == -1) partially evaluated:  msgBox.exec() == -1| no Evaluation Count:0 | yes Evaluation Count:16 | 
 | 0-16 | 
| 1510 | return QMessageBox::Cancel; never executed: return QMessageBox::Cancel; | 0 | 
| 1511 | return msgBox.standardButton(msgBox.clickedButton()); executed:  return msgBox.standardButton(msgBox.clickedButton());Execution Count:16 | 16 | 
| 1512 | } | - | 
| 1513 |  | - | 
| 1514 | /*! | - | 
| 1515 | \since 4.2 | - | 
| 1516 |  | - | 
| 1517 | Opens an information message box with the given \a title and | - | 
| 1518 | \a text in front of the specified \a parent widget. | - | 
| 1519 |  | - | 
| 1520 | The standard \a buttons are added to the message box. | - | 
| 1521 | \a defaultButton specifies the button used when \uicontrol Enter is pressed. | - | 
| 1522 | \a defaultButton must refer to a button that was given in \a buttons. | - | 
| 1523 | If \a defaultButton is QMessageBox::NoButton, QMessageBox | - | 
| 1524 | chooses a suitable default automatically. | - | 
| 1525 |  | - | 
| 1526 | Returns the identity of the standard button that was clicked. If | - | 
| 1527 | \uicontrol Esc was pressed instead, the \l{Default and Escape Keys} | - | 
| 1528 | {escape button} is returned. | - | 
| 1529 |  | - | 
| 1530 | The message box is an \l{Qt::ApplicationModal}{application modal} | - | 
| 1531 | dialog box. | - | 
| 1532 |  | - | 
| 1533 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 1534 | If you want to do this, you should create the dialog | - | 
| 1535 | yourself using one of the QMessageBox constructors. | - | 
| 1536 |  | - | 
| 1537 | \sa question(), warning(), critical() | - | 
| 1538 | */ | - | 
| 1539 | QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QString &title, | - | 
| 1540 | const QString& text, StandardButtons buttons, | - | 
| 1541 | StandardButton defaultButton) | - | 
| 1542 | { | - | 
| 1543 | return showNewMessageBox(parent, Information, title, text, buttons, executed:  return showNewMessageBox(parent, Information, title, text, buttons, defaultButton);Execution Count:6 | 6 | 
| 1544 | defaultButton); executed:  return showNewMessageBox(parent, Information, title, text, buttons, defaultButton);Execution Count:6 | 6 | 
| 1545 | } | - | 
| 1546 |  | - | 
| 1547 |  | - | 
| 1548 | /*! | - | 
| 1549 | \since 4.2 | - | 
| 1550 |  | - | 
| 1551 | Opens a question message box with the given \a title and \a | - | 
| 1552 | text in front of the specified \a parent widget. | - | 
| 1553 |  | - | 
| 1554 | The standard \a buttons are added to the message box. \a | - | 
| 1555 | defaultButton specifies the button used when \uicontrol Enter is | - | 
| 1556 | pressed. \a defaultButton must refer to a button that was given in \a buttons. | - | 
| 1557 | If \a defaultButton is QMessageBox::NoButton, QMessageBox | - | 
| 1558 | chooses a suitable default automatically. | - | 
| 1559 |  | - | 
| 1560 | Returns the identity of the standard button that was clicked. If | - | 
| 1561 | \uicontrol Esc was pressed instead, the \l{Default and Escape Keys} | - | 
| 1562 | {escape button} is returned. | - | 
| 1563 |  | - | 
| 1564 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 1565 | dialog box. | - | 
| 1566 |  | - | 
| 1567 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 1568 | If you want to do this, you should create the dialog | - | 
| 1569 | yourself using one of the QMessageBox constructors. | - | 
| 1570 |  | - | 
| 1571 | \sa information(), warning(), critical() | - | 
| 1572 | */ | - | 
| 1573 | QMessageBox::StandardButton QMessageBox::question(QWidget *parent, const QString &title, | - | 
| 1574 | const QString& text, StandardButtons buttons, | - | 
| 1575 | StandardButton defaultButton) | - | 
| 1576 | { | - | 
| 1577 | return showNewMessageBox(parent, Question, title, text, buttons, defaultButton); executed:  return showNewMessageBox(parent, Question, title, text, buttons, defaultButton);Execution Count:6 | 6 | 
| 1578 | } | - | 
| 1579 |  | - | 
| 1580 | /*! | - | 
| 1581 | \since 4.2 | - | 
| 1582 |  | - | 
| 1583 | Opens a warning message box with the given \a title and \a | - | 
| 1584 | text in front of the specified \a parent widget. | - | 
| 1585 |  | - | 
| 1586 | The standard \a buttons are added to the message box. \a | - | 
| 1587 | defaultButton specifies the button used when \uicontrol Enter is | - | 
| 1588 | pressed. \a defaultButton must refer to a button that was given in \a buttons. | - | 
| 1589 | If \a defaultButton is QMessageBox::NoButton, QMessageBox | - | 
| 1590 | chooses a suitable default automatically. | - | 
| 1591 |  | - | 
| 1592 | Returns the identity of the standard button that was clicked. If | - | 
| 1593 | \uicontrol Esc was pressed instead, the \l{Default and Escape Keys} | - | 
| 1594 | {escape button} is returned. | - | 
| 1595 |  | - | 
| 1596 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 1597 | dialog box. | - | 
| 1598 |  | - | 
| 1599 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 1600 | If you want to do this, you should create the dialog | - | 
| 1601 | yourself using one of the QMessageBox constructors. | - | 
| 1602 |  | - | 
| 1603 | \sa question(), information(), critical() | - | 
| 1604 | */ | - | 
| 1605 | QMessageBox::StandardButton QMessageBox::warning(QWidget *parent, const QString &title, | - | 
| 1606 | const QString& text, StandardButtons buttons, | - | 
| 1607 | StandardButton defaultButton) | - | 
| 1608 | { | - | 
| 1609 | return showNewMessageBox(parent, Warning, title, text, buttons, defaultButton); executed:  return showNewMessageBox(parent, Warning, title, text, buttons, defaultButton);Execution Count:4 | 4 | 
| 1610 | } | - | 
| 1611 |  | - | 
| 1612 | /*! | - | 
| 1613 | \since 4.2 | - | 
| 1614 |  | - | 
| 1615 | Opens a critical message box with the given \a title and \a | - | 
| 1616 | text in front of the specified \a parent widget. | - | 
| 1617 |  | - | 
| 1618 | The standard \a buttons are added to the message box. \a | - | 
| 1619 | defaultButton specifies the button used when \uicontrol Enter is | - | 
| 1620 | pressed. \a defaultButton must refer to a button that was given in \a buttons. | - | 
| 1621 | If \a defaultButton is QMessageBox::NoButton, QMessageBox | - | 
| 1622 | chooses a suitable default automatically. | - | 
| 1623 |  | - | 
| 1624 | Returns the identity of the standard button that was clicked. If | - | 
| 1625 | \uicontrol Esc was pressed instead, the \l{Default and Escape Keys} | - | 
| 1626 | {escape button} is returned. | - | 
| 1627 |  | - | 
| 1628 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 1629 | dialog box. | - | 
| 1630 |  | - | 
| 1631 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 1632 | If you want to do this, you should create the dialog | - | 
| 1633 | yourself using one of the QMessageBox constructors. | - | 
| 1634 |  | - | 
| 1635 | \sa question(), warning(), information() | - | 
| 1636 | */ | - | 
| 1637 | QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString &title, | - | 
| 1638 | const QString& text, StandardButtons buttons, | - | 
| 1639 | StandardButton defaultButton) | - | 
| 1640 | { | - | 
| 1641 | return showNewMessageBox(parent, Critical, title, text, buttons, defaultButton); executed:  return showNewMessageBox(parent, Critical, title, text, buttons, defaultButton);Execution Count:4 | 4 | 
| 1642 | } | - | 
| 1643 |  | - | 
| 1644 | /*! | - | 
| 1645 | Displays a simple about box with title \a title and text \a | - | 
| 1646 | text. The about box's parent is \a parent. | - | 
| 1647 |  | - | 
| 1648 | about() looks for a suitable icon in four locations: | - | 
| 1649 |  | - | 
| 1650 | \list 1 | - | 
| 1651 | \li It prefers \l{QWidget::windowIcon()}{parent->icon()} | - | 
| 1652 | if that exists. | - | 
| 1653 | \li If not, it tries the top-level widget containing \a parent. | - | 
| 1654 | \li If that fails, it tries the \l{QApplication::activeWindow()}{active window.} | - | 
| 1655 | \li As a last resort it uses the Information icon. | - | 
| 1656 | \endlist | - | 
| 1657 |  | - | 
| 1658 | The about box has a single button labelled "OK". On Mac OS X, the | - | 
| 1659 | about box is popped up as a modeless window; on other platforms, | - | 
| 1660 | it is currently application modal. | - | 
| 1661 |  | - | 
| 1662 | \sa QWidget::windowIcon(), QApplication::activeWindow() | - | 
| 1663 | */ | - | 
| 1664 | void QMessageBox::about(QWidget *parent, const QString &title, const QString &text) | - | 
| 1665 | { | - | 
| 1666 | #ifdef Q_OS_MAC | - | 
| 1667 | static QPointer<QMessageBox> oldMsgBox; | - | 
| 1668 |  | - | 
| 1669 | if (oldMsgBox && oldMsgBox->text() == text) { | - | 
| 1670 | oldMsgBox->show(); | - | 
| 1671 | oldMsgBox->raise(); | - | 
| 1672 | oldMsgBox->activateWindow(); | - | 
| 1673 | return; | - | 
| 1674 | } | - | 
| 1675 | #endif | - | 
| 1676 |  | - | 
| 1677 | QMessageBox *msgBox = new QMessageBox(title, text, Information, 0, 0, 0, parent executed (the execution status of this line is deduced):  QMessageBox *msgBox = new QMessageBox(title, text, Information, 0, 0, 0, parent | - | 
| 1678 | #ifdef Q_OS_MAC executed (the execution status of this line is deduced):  | - | 
| 1679 | , Qt::WindowTitleHint | Qt::WindowSystemMenuHint executed (the execution status of this line is deduced):  | - | 
| 1680 | #endif executed (the execution status of this line is deduced):  | - | 
| 1681 | ); executed (the execution status of this line is deduced):  ); | - | 
| 1682 | msgBox->setAttribute(Qt::WA_DeleteOnClose); executed (the execution status of this line is deduced):  msgBox->setAttribute(Qt::WA_DeleteOnClose); | - | 
| 1683 | QIcon icon = msgBox->windowIcon(); executed (the execution status of this line is deduced):  QIcon icon = msgBox->windowIcon(); | - | 
| 1684 | QSize size = icon.actualSize(QSize(64, 64)); executed (the execution status of this line is deduced):  QSize size = icon.actualSize(QSize(64, 64)); | - | 
| 1685 | msgBox->setIconPixmap(icon.pixmap(size)); executed (the execution status of this line is deduced):  msgBox->setIconPixmap(icon.pixmap(size)); | - | 
| 1686 |  | - | 
| 1687 | // should perhaps be a style hint | - | 
| 1688 | #ifdef Q_OS_MAC | - | 
| 1689 | oldMsgBox = msgBox; | - | 
| 1690 | #if 0 | - | 
| 1691 | // ### doesn't work until close button is enabled in title bar | - | 
| 1692 | msgBox->d_func()->autoAddOkButton = false; | - | 
| 1693 | #else | - | 
| 1694 | msgBox->d_func()->buttonBox->setCenterButtons(true); | - | 
| 1695 | #endif | - | 
| 1696 | msgBox->show(); | - | 
| 1697 | #else | - | 
| 1698 | msgBox->exec(); executed (the execution status of this line is deduced):  msgBox->exec(); | - | 
| 1699 | #endif | - | 
| 1700 | } executed:  }Execution Count:1 | 1 | 
| 1701 |  | - | 
| 1702 | /*! | - | 
| 1703 | Displays a simple message box about Qt, with the given \a title | - | 
| 1704 | and centered over \a parent (if \a parent is not 0). The message | - | 
| 1705 | includes the version number of Qt being used by the application. | - | 
| 1706 |  | - | 
| 1707 | This is useful for inclusion in the \uicontrol Help menu of an application, | - | 
| 1708 | as shown in the \l{mainwindows/menus}{Menus} example. | - | 
| 1709 |  | - | 
| 1710 | QApplication provides this functionality as a slot. | - | 
| 1711 |  | - | 
| 1712 | On Mac OS X, the about box is popped up as a modeless window; on | - | 
| 1713 | other platforms, it is currently application modal. | - | 
| 1714 |  | - | 
| 1715 | \sa QApplication::aboutQt() | - | 
| 1716 | */ | - | 
| 1717 | void QMessageBox::aboutQt(QWidget *parent, const QString &title) | - | 
| 1718 | { | - | 
| 1719 | #ifdef Q_OS_MAC | - | 
| 1720 | static QPointer<QMessageBox> oldMsgBox; | - | 
| 1721 |  | - | 
| 1722 | if (oldMsgBox) { | - | 
| 1723 | oldMsgBox->show(); | - | 
| 1724 | oldMsgBox->raise(); | - | 
| 1725 | oldMsgBox->activateWindow(); | - | 
| 1726 | return; | - | 
| 1727 | } | - | 
| 1728 | #endif | - | 
| 1729 |  | - | 
| 1730 | QString translatedTextAboutQtCaption; executed (the execution status of this line is deduced):  QString translatedTextAboutQtCaption; | - | 
| 1731 | translatedTextAboutQtCaption = QMessageBox::tr( executed (the execution status of this line is deduced):  translatedTextAboutQtCaption = QMessageBox::tr( | - | 
| 1732 | "<h3>About Qt</h3>" executed (the execution status of this line is deduced):  "<h3>About Qt</h3>" | - | 
| 1733 | "<p>This program uses Qt version %1.</p>" executed (the execution status of this line is deduced):  "<p>This program uses Qt version %1.</p>" | - | 
| 1734 | ).arg(QLatin1String(QT_VERSION_STR)); executed (the execution status of this line is deduced):  ).arg(QLatin1String("5.0.2")); | - | 
| 1735 | QString translatedTextAboutQtText; executed (the execution status of this line is deduced):  QString translatedTextAboutQtText; | - | 
| 1736 | translatedTextAboutQtText = QMessageBox::tr( executed (the execution status of this line is deduced):  translatedTextAboutQtText = QMessageBox::tr( | - | 
| 1737 | "<p>Qt is a C++ toolkit for cross-platform application " executed (the execution status of this line is deduced):  "<p>Qt is a C++ toolkit for cross-platform application " | - | 
| 1738 | "development.</p>" executed (the execution status of this line is deduced):  "development.</p>" | - | 
| 1739 | "<p>Qt provides single-source portability across all major desktop " executed (the execution status of this line is deduced):  "<p>Qt provides single-source portability across all major desktop " | - | 
| 1740 | "operating systems. It is also available for embedded Linux and other " executed (the execution status of this line is deduced):  "operating systems. It is also available for embedded Linux and other " | - | 
| 1741 | "embedded and mobile operating systems.</p>" executed (the execution status of this line is deduced):  "embedded and mobile operating systems.</p>" | - | 
| 1742 | "<p>Qt is available under three different licensing options designed " executed (the execution status of this line is deduced):  "<p>Qt is available under three different licensing options designed " | - | 
| 1743 | "to accommodate the needs of our various users.</p>" executed (the execution status of this line is deduced):  "to accommodate the needs of our various users.</p>" | - | 
| 1744 | "<p>Qt licensed under our commercial license agreement is appropriate " executed (the execution status of this line is deduced):  "<p>Qt licensed under our commercial license agreement is appropriate " | - | 
| 1745 | "for development of proprietary/commercial software where you do not " executed (the execution status of this line is deduced):  "for development of proprietary/commercial software where you do not " | - | 
| 1746 | "want to share any source code with third parties or otherwise cannot " executed (the execution status of this line is deduced):  "want to share any source code with third parties or otherwise cannot " | - | 
| 1747 | "comply with the terms of the GNU LGPL version 2.1 or GNU GPL version " executed (the execution status of this line is deduced):  "comply with the terms of the GNU LGPL version 2.1 or GNU GPL version " | - | 
| 1748 | "3.0.</p>" executed (the execution status of this line is deduced):  "3.0.</p>" | - | 
| 1749 | "<p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the " executed (the execution status of this line is deduced):  "<p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the " | - | 
| 1750 | "development of Qt applications provided you can comply with the terms " executed (the execution status of this line is deduced):  "development of Qt applications provided you can comply with the terms " | - | 
| 1751 | "and conditions of the GNU LGPL version 2.1.</p>" executed (the execution status of this line is deduced):  "and conditions of the GNU LGPL version 2.1.</p>" | - | 
| 1752 | "<p>Qt licensed under the GNU General Public License version 3.0 is " executed (the execution status of this line is deduced):  "<p>Qt licensed under the GNU General Public License version 3.0 is " | - | 
| 1753 | "appropriate for the development of Qt applications where you wish to " executed (the execution status of this line is deduced):  "appropriate for the development of Qt applications where you wish to " | - | 
| 1754 | "use such applications in combination with software subject to the " executed (the execution status of this line is deduced):  "use such applications in combination with software subject to the " | - | 
| 1755 | "terms of the GNU GPL version 3.0 or where you are otherwise willing " executed (the execution status of this line is deduced):  "terms of the GNU GPL version 3.0 or where you are otherwise willing " | - | 
| 1756 | "to comply with the terms of the GNU GPL version 3.0.</p>" executed (the execution status of this line is deduced):  "to comply with the terms of the GNU GPL version 3.0.</p>" | - | 
| 1757 | "<p>Please see <a href=\"http://qt.digia.com/Product/Licensing/\">qt.digia.com/Product/Licensing</a> " executed (the execution status of this line is deduced):  "<p>Please see <a href=\"http://qt.digia.com/Product/Licensing/\">qt.digia.com/Product/Licensing</a> " | - | 
| 1758 | "for an overview of Qt licensing.</p>" executed (the execution status of this line is deduced):  "for an overview of Qt licensing.</p>" | - | 
| 1759 | "<p>Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) and other " executed (the execution status of this line is deduced):  "<p>Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies) and other " | - | 
| 1760 | "contributors.</p>" executed (the execution status of this line is deduced):  "contributors.</p>" | - | 
| 1761 | "<p>Qt and the Qt logo are trademarks of Digia Plc and/or its subsidiary(-ies).</p>" executed (the execution status of this line is deduced):  "<p>Qt and the Qt logo are trademarks of Digia Plc and/or its subsidiary(-ies).</p>" | - | 
| 1762 | "<p>Qt is developed as an open source project on " executed (the execution status of this line is deduced):  "<p>Qt is developed as an open source project on " | - | 
| 1763 | "<a href=\"http://qt-project.org/\">qt-project.org</a>.</p>" executed (the execution status of this line is deduced):  "<a href=\"http://qt-project.org/\">qt-project.org</a>.</p>" | - | 
| 1764 | "<p>Qt is a Digia product. See <a href=\"http://qt.digia.com/\">qt.digia.com</a> " executed (the execution status of this line is deduced):  "<p>Qt is a Digia product. See <a href=\"http://qt.digia.com/\">qt.digia.com</a> " | - | 
| 1765 | "for more information.</p>" executed (the execution status of this line is deduced):  "for more information.</p>" | - | 
| 1766 | ); executed (the execution status of this line is deduced):  ); | - | 
| 1767 | QMessageBox *msgBox = new QMessageBox(parent); executed (the execution status of this line is deduced):  QMessageBox *msgBox = new QMessageBox(parent); | - | 
| 1768 | msgBox->setAttribute(Qt::WA_DeleteOnClose); executed (the execution status of this line is deduced):  msgBox->setAttribute(Qt::WA_DeleteOnClose); | - | 
| 1769 | msgBox->setWindowTitle(title.isEmpty() ? tr("About Qt") : title); executed (the execution status of this line is deduced):  msgBox->setWindowTitle(title.isEmpty() ? tr("About Qt") : title); | - | 
| 1770 | msgBox->setText(translatedTextAboutQtCaption); executed (the execution status of this line is deduced):  msgBox->setText(translatedTextAboutQtCaption); | - | 
| 1771 | msgBox->setInformativeText(translatedTextAboutQtText); executed (the execution status of this line is deduced):  msgBox->setInformativeText(translatedTextAboutQtText); | - | 
| 1772 |  | - | 
| 1773 | QPixmap pm(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); executed (the execution status of this line is deduced):  QPixmap pm(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); | - | 
| 1774 | if (!pm.isNull()) partially evaluated:  !pm.isNull()| yes Evaluation Count:1 | no Evaluation Count:0 | 
 | 0-1 | 
| 1775 | msgBox->setIconPixmap(pm); executed:  msgBox->setIconPixmap(pm);Execution Count:1 | 1 | 
| 1776 | #if defined(Q_OS_WINCE) | - | 
| 1777 | msgBox->setDefaultButton(msgBox->addButton(QMessageBox::Ok)); | - | 
| 1778 | #endif | - | 
| 1779 |  | - | 
| 1780 | // should perhaps be a style hint | - | 
| 1781 | #ifdef Q_OS_MAC | - | 
| 1782 | oldMsgBox = msgBox; | - | 
| 1783 | #if 0 | - | 
| 1784 | // ### doesn't work until close button is enabled in title bar | - | 
| 1785 | msgBox->d_func()->autoAddOkButton = false; | - | 
| 1786 | #else | - | 
| 1787 | msgBox->d_func()->buttonBox->setCenterButtons(true); | - | 
| 1788 | #endif | - | 
| 1789 | msgBox->show(); | - | 
| 1790 | #else | - | 
| 1791 | msgBox->exec(); executed (the execution status of this line is deduced):  msgBox->exec(); | - | 
| 1792 | #endif | - | 
| 1793 | } executed:  }Execution Count:1 | 1 | 
| 1794 |  | - | 
| 1795 | ///////////////////////////////////////////////////////////////////////////////////////// | - | 
| 1796 | // Source and binary compatibility routines for 4.0 and 4.1 | - | 
| 1797 |  | - | 
| 1798 | static QMessageBox::StandardButton newButton(int button) | - | 
| 1799 | { | - | 
| 1800 | // this is needed for source compatibility with Qt 4.0 and 4.1 | - | 
| 1801 | if (button == QMessageBox::NoButton || (button & NewButtonMask)) evaluated:  button == QMessageBox::NoButton| yes Evaluation Count:22 | yes Evaluation Count:30 | 
 partially evaluated:  (button & NewButtonMask)| yes Evaluation Count:30 | no Evaluation Count:0 | 
 | 0-30 | 
| 1802 | return QMessageBox::StandardButton(button & QMessageBox::ButtonMask); executed:  return QMessageBox::StandardButton(button & QMessageBox::ButtonMask);Execution Count:52 | 52 | 
| 1803 |  | - | 
| 1804 | #if QT_VERSION < 0x050000 | - | 
| 1805 | // this is needed for binary compatibility with Qt 4.0 and 4.1 | - | 
| 1806 | switch (button & Old_ButtonMask) { | - | 
| 1807 | case Old_Ok: | - | 
| 1808 | return QMessageBox::Ok; | - | 
| 1809 | case Old_Cancel: | - | 
| 1810 | return QMessageBox::Cancel; | - | 
| 1811 | case Old_Yes: | - | 
| 1812 | return QMessageBox::Yes; | - | 
| 1813 | case Old_No: | - | 
| 1814 | return QMessageBox::No; | - | 
| 1815 | case Old_Abort: | - | 
| 1816 | return QMessageBox::Abort; | - | 
| 1817 | case Old_Retry: | - | 
| 1818 | return QMessageBox::Retry; | - | 
| 1819 | case Old_Ignore: | - | 
| 1820 | return QMessageBox::Ignore; | - | 
| 1821 | case Old_YesAll: | - | 
| 1822 | return QMessageBox::YesToAll; | - | 
| 1823 | case Old_NoAll: | - | 
| 1824 | return QMessageBox::NoToAll; | - | 
| 1825 | default: | - | 
| 1826 | return QMessageBox::NoButton; | - | 
| 1827 | } | - | 
| 1828 | #else | - | 
| 1829 | return QMessageBox::NoButton; never executed: return QMessageBox::NoButton; | 0 | 
| 1830 | #endif | - | 
| 1831 | } | - | 
| 1832 |  | - | 
| 1833 | static bool detectedCompat(int button0, int button1, int button2) | - | 
| 1834 | { | - | 
| 1835 | if (button0 != 0 && !(button0 & NewButtonMask)) evaluated:  button0 != 0| yes Evaluation Count:9 | yes Evaluation Count:1 | 
 partially evaluated:  !(button0 & NewButtonMask)| no Evaluation Count:0 | yes Evaluation Count:9 | 
 | 0-9 | 
| 1836 | return true; never executed: return true; | 0 | 
| 1837 | if (button1 != 0 && !(button1 & NewButtonMask)) evaluated:  button1 != 0| yes Evaluation Count:9 | yes Evaluation Count:1 | 
 partially evaluated:  !(button1 & NewButtonMask)| no Evaluation Count:0 | yes Evaluation Count:9 | 
 | 0-9 | 
| 1838 | return true; never executed: return true; | 0 | 
| 1839 | if (button2 != 0 && !(button2 & NewButtonMask)) evaluated:  button2 != 0| yes Evaluation Count:2 | yes Evaluation Count:8 | 
 partially evaluated:  !(button2 & NewButtonMask)| no Evaluation Count:0 | yes Evaluation Count:2 | 
 | 0-8 | 
| 1840 | return true; never executed: return true; | 0 | 
| 1841 | return false; executed:  return false;Execution Count:10 | 10 | 
| 1842 | } | - | 
| 1843 |  | - | 
| 1844 | QAbstractButton *QMessageBoxPrivate::findButton(int button0, int button1, int button2, int flags) | - | 
| 1845 | { | - | 
| 1846 | Q_Q(QMessageBox); executed (the execution status of this line is deduced):  QMessageBox * const q = q_func(); | - | 
| 1847 | int button = 0; executed (the execution status of this line is deduced):  int button = 0; | - | 
| 1848 |  | - | 
| 1849 | if (button0 & flags) { evaluated:  button0 & flags| yes Evaluation Count:4 | yes Evaluation Count:16 | 
 | 4-16 | 
| 1850 | button = button0; executed (the execution status of this line is deduced):  button = button0; | - | 
| 1851 | } else if (button1 & flags) { executed:  }Execution Count:4 evaluated:  button1 & flags| yes Evaluation Count:3 | yes Evaluation Count:13 | 
 | 3-13 | 
| 1852 | button = button1; executed (the execution status of this line is deduced):  button = button1; | - | 
| 1853 | } else if (button2 & flags) { executed:  }Execution Count:3 evaluated:  button2 & flags| yes Evaluation Count:1 | yes Evaluation Count:12 | 
 | 1-12 | 
| 1854 | button = button2; executed (the execution status of this line is deduced):  button = button2; | - | 
| 1855 | } executed:  }Execution Count:1 | 1 | 
| 1856 | return q->button(newButton(button)); executed:  return q->button(newButton(button));Execution Count:20 | 20 | 
| 1857 | } | - | 
| 1858 |  | - | 
| 1859 | void QMessageBoxPrivate::addOldButtons(int button0, int button1, int button2) | - | 
| 1860 | { | - | 
| 1861 | Q_Q(QMessageBox); executed (the execution status of this line is deduced):  QMessageBox * const q = q_func(); | - | 
| 1862 | q->addButton(newButton(button0)); executed (the execution status of this line is deduced):  q->addButton(newButton(button0)); | - | 
| 1863 | q->addButton(newButton(button1)); executed (the execution status of this line is deduced):  q->addButton(newButton(button1)); | - | 
| 1864 | q->addButton(newButton(button2)); executed (the execution status of this line is deduced):  q->addButton(newButton(button2)); | - | 
| 1865 | q->setDefaultButton( executed (the execution status of this line is deduced):  q->setDefaultButton( | - | 
| 1866 | static_cast<QPushButton *>(findButton(button0, button1, button2, QMessageBox::Default))); executed (the execution status of this line is deduced):  static_cast<QPushButton *>(findButton(button0, button1, button2, QMessageBox::Default))); | - | 
| 1867 | q->setEscapeButton(findButton(button0, button1, button2, QMessageBox::Escape)); executed (the execution status of this line is deduced):  q->setEscapeButton(findButton(button0, button1, button2, QMessageBox::Escape)); | - | 
| 1868 | compatMode = detectedCompat(button0, button1, button2); executed (the execution status of this line is deduced):  compatMode = detectedCompat(button0, button1, button2); | - | 
| 1869 | } executed:  }Execution Count:10 | 10 | 
| 1870 |  | - | 
| 1871 | QAbstractButton *QMessageBoxPrivate::abstractButtonForId(int id) const | - | 
| 1872 | { | - | 
| 1873 | Q_Q(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBox * const q = q_func(); | - | 
| 1874 | QAbstractButton *result = customButtonList.value(id); executed (the execution status of this line is deduced):  QAbstractButton *result = customButtonList.value(id); | - | 
| 1875 | if (result) partially evaluated:  result| no Evaluation Count:0 | yes Evaluation Count:2 | 
 | 0-2 | 
| 1876 | return result; never executed: return result; | 0 | 
| 1877 | if (id & QMessageBox::FlagMask)    // for compatibility with Qt 4.0/4.1 (even if it is silly) partially evaluated:  id & QMessageBox::FlagMask| no Evaluation Count:0 | yes Evaluation Count:2 | 
 | 0-2 | 
| 1878 | return 0; never executed: return 0; | 0 | 
| 1879 | return q->button(newButton(id)); executed:  return q->button(newButton(id));Execution Count:2 | 2 | 
| 1880 | } | - | 
| 1881 |  | - | 
| 1882 | int QMessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, | - | 
| 1883 | const QString &title, const QString &text, | - | 
| 1884 | int button0, int button1, int button2) | - | 
| 1885 | { | - | 
| 1886 | QMessageBox messageBox(icon, title, text, QMessageBox::NoButton, parent); executed (the execution status of this line is deduced):  QMessageBox messageBox(icon, title, text, QMessageBox::NoButton, parent); | - | 
| 1887 | messageBox.d_func()->addOldButtons(button0, button1, button2); executed (the execution status of this line is deduced):  messageBox.d_func()->addOldButtons(button0, button1, button2); | - | 
| 1888 | return messageBox.exec(); executed:  return messageBox.exec();Execution Count:8 | 8 | 
| 1889 | } | - | 
| 1890 |  | - | 
| 1891 | int QMessageBoxPrivate::showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, | - | 
| 1892 | const QString &title, const QString &text, | - | 
| 1893 | const QString &button0Text, | - | 
| 1894 | const QString &button1Text, | - | 
| 1895 | const QString &button2Text, | - | 
| 1896 | int defaultButtonNumber, | - | 
| 1897 | int escapeButtonNumber) | - | 
| 1898 | { | - | 
| 1899 | QMessageBox messageBox(icon, title, text, QMessageBox::NoButton, parent); executed (the execution status of this line is deduced):  QMessageBox messageBox(icon, title, text, QMessageBox::NoButton, parent); | - | 
| 1900 | QString myButton0Text = button0Text; executed (the execution status of this line is deduced):  QString myButton0Text = button0Text; | - | 
| 1901 | if (myButton0Text.isEmpty()) partially evaluated:  myButton0Text.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:1 | 
 | 0-1 | 
| 1902 | myButton0Text = QDialogButtonBox::tr("OK"); never executed: myButton0Text = QDialogButtonBox::tr("OK"); | 0 | 
| 1903 | messageBox.addButton(myButton0Text, QMessageBox::ActionRole); executed (the execution status of this line is deduced):  messageBox.addButton(myButton0Text, QMessageBox::ActionRole); | - | 
| 1904 | if (!button1Text.isEmpty()) partially evaluated:  !button1Text.isEmpty()| yes Evaluation Count:1 | no Evaluation Count:0 | 
 | 0-1 | 
| 1905 | messageBox.addButton(button1Text, QMessageBox::ActionRole); executed:  messageBox.addButton(button1Text, QMessageBox::ActionRole);Execution Count:1 | 1 | 
| 1906 | if (!button2Text.isEmpty()) partially evaluated:  !button2Text.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:1 | 
 | 0-1 | 
| 1907 | messageBox.addButton(button2Text, QMessageBox::ActionRole); never executed: messageBox.addButton(button2Text, QMessageBox::ActionRole); | 0 | 
| 1908 |  | - | 
| 1909 | const QList<QAbstractButton *> &buttonList = messageBox.d_func()->customButtonList; executed (the execution status of this line is deduced):  const QList<QAbstractButton *> &buttonList = messageBox.d_func()->customButtonList; | - | 
| 1910 | messageBox.setDefaultButton(static_cast<QPushButton *>(buttonList.value(defaultButtonNumber))); executed (the execution status of this line is deduced):  messageBox.setDefaultButton(static_cast<QPushButton *>(buttonList.value(defaultButtonNumber))); | - | 
| 1911 | messageBox.setEscapeButton(buttonList.value(escapeButtonNumber)); executed (the execution status of this line is deduced):  messageBox.setEscapeButton(buttonList.value(escapeButtonNumber)); | - | 
| 1912 |  | - | 
| 1913 | return messageBox.exec(); executed:  return messageBox.exec();Execution Count:1 | 1 | 
| 1914 | } | - | 
| 1915 |  | - | 
| 1916 | void QMessageBoxPrivate::retranslateStrings() | - | 
| 1917 | { | - | 
| 1918 | #ifndef QT_NO_TEXTEDIT | - | 
| 1919 | if (detailsButton) evaluated:  detailsButton| yes Evaluation Count:1 | yes Evaluation Count:41 | 
 | 1-41 | 
| 1920 | detailsButton->setLabel(detailsText->isHidden() ? ShowLabel : HideLabel); executed:  detailsButton->setLabel(detailsText->isHidden() ? ShowLabel : HideLabel);Execution Count:1 | 1 | 
| 1921 | #endif | - | 
| 1922 | } executed:  }Execution Count:42 | 42 | 
| 1923 |  | - | 
| 1924 | /*! | - | 
| 1925 | \obsolete | - | 
| 1926 |  | - | 
| 1927 | Constructs a message box with a \a title, a \a text, an \a icon, | - | 
| 1928 | and up to three buttons. | - | 
| 1929 |  | - | 
| 1930 | The \a icon must be one of the following: | - | 
| 1931 | \list | - | 
| 1932 | \li QMessageBox::NoIcon | - | 
| 1933 | \li QMessageBox::Question | - | 
| 1934 | \li QMessageBox::Information | - | 
| 1935 | \li QMessageBox::Warning | - | 
| 1936 | \li QMessageBox::Critical | - | 
| 1937 | \endlist | - | 
| 1938 |  | - | 
| 1939 | Each button, \a button0, \a button1 and \a button2, can have one | - | 
| 1940 | of the following values: | - | 
| 1941 | \list | - | 
| 1942 | \li QMessageBox::NoButton | - | 
| 1943 | \li QMessageBox::Ok | - | 
| 1944 | \li QMessageBox::Cancel | - | 
| 1945 | \li QMessageBox::Yes | - | 
| 1946 | \li QMessageBox::No | - | 
| 1947 | \li QMessageBox::Abort | - | 
| 1948 | \li QMessageBox::Retry | - | 
| 1949 | \li QMessageBox::Ignore | - | 
| 1950 | \li QMessageBox::YesAll | - | 
| 1951 | \li QMessageBox::NoAll | - | 
| 1952 | \endlist | - | 
| 1953 |  | - | 
| 1954 | Use QMessageBox::NoButton for the later parameters to have fewer | - | 
| 1955 | than three buttons in your message box. If you don't specify any | - | 
| 1956 | buttons at all, QMessageBox will provide an Ok button. | - | 
| 1957 |  | - | 
| 1958 | One of the buttons can be OR-ed with the QMessageBox::Default | - | 
| 1959 | flag to make it the default button (clicked when Enter is | - | 
| 1960 | pressed). | - | 
| 1961 |  | - | 
| 1962 | One of the buttons can be OR-ed with the QMessageBox::Escape flag | - | 
| 1963 | to make it the cancel or close button (clicked when \uicontrol Esc is | - | 
| 1964 | pressed). | - | 
| 1965 |  | - | 
| 1966 | \snippet dialogs/dialogs.cpp 2 | - | 
| 1967 |  | - | 
| 1968 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 1969 | dialog box. | - | 
| 1970 |  | - | 
| 1971 | The \a parent and \a f arguments are passed to | - | 
| 1972 | the QDialog constructor. | - | 
| 1973 |  | - | 
| 1974 | \sa setWindowTitle(), setText(), setIcon() | - | 
| 1975 | */ | - | 
| 1976 | QMessageBox::QMessageBox(const QString &title, const QString &text, Icon icon, | - | 
| 1977 | int button0, int button1, int button2, QWidget *parent, | - | 
| 1978 | Qt::WindowFlags f) | - | 
| 1979 | : QDialog(*new QMessageBoxPrivate, parent, | - | 
| 1980 | f /*| Qt::MSWindowsFixedSizeDialogHint #### */| Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) | - | 
| 1981 | { | - | 
| 1982 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 1983 | d->init(title, text); executed (the execution status of this line is deduced):  d->init(title, text); | - | 
| 1984 | setIcon(icon); executed (the execution status of this line is deduced):  setIcon(icon); | - | 
| 1985 | d->addOldButtons(button0, button1, button2); executed (the execution status of this line is deduced):  d->addOldButtons(button0, button1, button2); | - | 
| 1986 | } executed:  }Execution Count:2 | 2 | 
| 1987 |  | - | 
| 1988 | /*! | - | 
| 1989 | \obsolete | - | 
| 1990 |  | - | 
| 1991 | Opens an information message box with the given \a title and the | - | 
| 1992 | \a text. The dialog may have up to three buttons. Each of the | - | 
| 1993 | buttons, \a button0, \a button1 and \a button2 may be set to one | - | 
| 1994 | of the following values: | - | 
| 1995 |  | - | 
| 1996 | \list | - | 
| 1997 | \li QMessageBox::NoButton | - | 
| 1998 | \li QMessageBox::Ok | - | 
| 1999 | \li QMessageBox::Cancel | - | 
| 2000 | \li QMessageBox::Yes | - | 
| 2001 | \li QMessageBox::No | - | 
| 2002 | \li QMessageBox::Abort | - | 
| 2003 | \li QMessageBox::Retry | - | 
| 2004 | \li QMessageBox::Ignore | - | 
| 2005 | \li QMessageBox::YesAll | - | 
| 2006 | \li QMessageBox::NoAll | - | 
| 2007 | \endlist | - | 
| 2008 |  | - | 
| 2009 | If you don't want all three buttons, set the last button, or last | - | 
| 2010 | two buttons to QMessageBox::NoButton. | - | 
| 2011 |  | - | 
| 2012 | One button can be OR-ed with QMessageBox::Default, and one | - | 
| 2013 | button can be OR-ed with QMessageBox::Escape. | - | 
| 2014 |  | - | 
| 2015 | Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) | - | 
| 2016 | of the button that was clicked. | - | 
| 2017 |  | - | 
| 2018 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 2019 | dialog box. | - | 
| 2020 |  | - | 
| 2021 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 2022 | If you want to do this, you should create the dialog | - | 
| 2023 | yourself using one of the QMessageBox constructors. | - | 
| 2024 |  | - | 
| 2025 | \sa question(), warning(), critical() | - | 
| 2026 | */ | - | 
| 2027 | int QMessageBox::information(QWidget *parent, const QString &title, const QString& text, | - | 
| 2028 | int button0, int button1, int button2) | - | 
| 2029 | { | - | 
| 2030 | return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, executed:  return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0, button1, button2);Execution Count:3 | 3 | 
| 2031 | button0, button1, button2); executed:  return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0, button1, button2);Execution Count:3 | 3 | 
| 2032 | } | - | 
| 2033 |  | - | 
| 2034 | /*! | - | 
| 2035 | \obsolete | - | 
| 2036 | \overload | - | 
| 2037 |  | - | 
| 2038 | Displays an information message box with the given \a title and | - | 
| 2039 | \a text, as well as one, two or three buttons. Returns the index | - | 
| 2040 | of the button that was clicked (0, 1 or 2). | - | 
| 2041 |  | - | 
| 2042 | \a button0Text is the text of the first button, and is optional. | - | 
| 2043 | If \a button0Text is not supplied, "OK" (translated) will be | - | 
| 2044 | used. \a button1Text is the text of the second button, and is | - | 
| 2045 | optional. \a button2Text is the text of the third button, and is | - | 
| 2046 | optional. \a defaultButtonNumber (0, 1 or 2) is the index of the | - | 
| 2047 | default button; pressing Return or Enter is the same as clicking | - | 
| 2048 | the default button. It defaults to 0 (the first button). \a | - | 
| 2049 | escapeButtonNumber is the index of the escape button; pressing | - | 
| 2050 | \uicontrol Esc is the same as clicking this button. It defaults to -1; | - | 
| 2051 | supply 0, 1 or 2 to make pressing \uicontrol Esc equivalent to clicking | - | 
| 2052 | the relevant button. | - | 
| 2053 |  | - | 
| 2054 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 2055 | dialog box. | - | 
| 2056 |  | - | 
| 2057 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 2058 | If you want to do this, you should create the dialog | - | 
| 2059 | yourself using one of the QMessageBox constructors. | - | 
| 2060 |  | - | 
| 2061 | \sa question(), warning(), critical() | - | 
| 2062 | */ | - | 
| 2063 |  | - | 
| 2064 | int QMessageBox::information(QWidget *parent, const QString &title, const QString& text, | - | 
| 2065 | const QString& button0Text, const QString& button1Text, | - | 
| 2066 | const QString& button2Text, int defaultButtonNumber, | - | 
| 2067 | int escapeButtonNumber) | - | 
| 2068 | { | - | 
| 2069 | return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, executed:  return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);Execution Count:1 | 1 | 
| 2070 | button0Text, button1Text, button2Text, executed:  return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);Execution Count:1 | 1 | 
| 2071 | defaultButtonNumber, escapeButtonNumber); executed:  return QMessageBoxPrivate::showOldMessageBox(parent, Information, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber);Execution Count:1 | 1 | 
| 2072 | } | - | 
| 2073 |  | - | 
| 2074 | /*! | - | 
| 2075 | \obsolete | - | 
| 2076 |  | - | 
| 2077 | Opens a question message box with the given \a title and \a text. | - | 
| 2078 | The dialog may have up to three buttons. Each of the buttons, \a | - | 
| 2079 | button0, \a button1 and \a button2 may be set to one of the | - | 
| 2080 | following values: | - | 
| 2081 |  | - | 
| 2082 | \list | - | 
| 2083 | \li QMessageBox::NoButton | - | 
| 2084 | \li QMessageBox::Ok | - | 
| 2085 | \li QMessageBox::Cancel | - | 
| 2086 | \li QMessageBox::Yes | - | 
| 2087 | \li QMessageBox::No | - | 
| 2088 | \li QMessageBox::Abort | - | 
| 2089 | \li QMessageBox::Retry | - | 
| 2090 | \li QMessageBox::Ignore | - | 
| 2091 | \li QMessageBox::YesAll | - | 
| 2092 | \li QMessageBox::NoAll | - | 
| 2093 | \endlist | - | 
| 2094 |  | - | 
| 2095 | If you don't want all three buttons, set the last button, or last | - | 
| 2096 | two buttons to QMessageBox::NoButton. | - | 
| 2097 |  | - | 
| 2098 | One button can be OR-ed with QMessageBox::Default, and one | - | 
| 2099 | button can be OR-ed with QMessageBox::Escape. | - | 
| 2100 |  | - | 
| 2101 | Returns the identity (QMessageBox::Yes, or QMessageBox::No, etc.) | - | 
| 2102 | of the button that was clicked. | - | 
| 2103 |  | - | 
| 2104 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 2105 | dialog box. | - | 
| 2106 |  | - | 
| 2107 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 2108 | If you want to do this, you should create the dialog | - | 
| 2109 | yourself using one of the QMessageBox constructors. | - | 
| 2110 |  | - | 
| 2111 | \sa information(), warning(), critical() | - | 
| 2112 | */ | - | 
| 2113 | int QMessageBox::question(QWidget *parent, const QString &title, const QString& text, | - | 
| 2114 | int button0, int button1, int button2) | - | 
| 2115 | { | - | 
| 2116 | return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, executed:  return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0, button1, button2);Execution Count:1 | 1 | 
| 2117 | button0, button1, button2); executed:  return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0, button1, button2);Execution Count:1 | 1 | 
| 2118 | } | - | 
| 2119 |  | - | 
| 2120 | /*! | - | 
| 2121 | \obsolete | - | 
| 2122 | \overload | - | 
| 2123 |  | - | 
| 2124 | Displays a question message box with the given \a title and \a | - | 
| 2125 | text, as well as one, two or three buttons. Returns the index of | - | 
| 2126 | the button that was clicked (0, 1 or 2). | - | 
| 2127 |  | - | 
| 2128 | \a button0Text is the text of the first button, and is optional. | - | 
| 2129 | If \a button0Text is not supplied, "OK" (translated) will be used. | - | 
| 2130 | \a button1Text is the text of the second button, and is optional. | - | 
| 2131 | \a button2Text is the text of the third button, and is optional. | - | 
| 2132 | \a defaultButtonNumber (0, 1 or 2) is the index of the default | - | 
| 2133 | button; pressing Return or Enter is the same as clicking the | - | 
| 2134 | default button. It defaults to 0 (the first button). \a | - | 
| 2135 | escapeButtonNumber is the index of the Escape button; pressing | - | 
| 2136 | Escape is the same as clicking this button. It defaults to -1; | - | 
| 2137 | supply 0, 1 or 2 to make pressing Escape equivalent to clicking | - | 
| 2138 | the relevant button. | - | 
| 2139 |  | - | 
| 2140 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 2141 | dialog box. | - | 
| 2142 |  | - | 
| 2143 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 2144 | If you want to do this, you should create the dialog | - | 
| 2145 | yourself using one of the QMessageBox constructors. | - | 
| 2146 |  | - | 
| 2147 | \sa information(), warning(), critical() | - | 
| 2148 | */ | - | 
| 2149 | int QMessageBox::question(QWidget *parent, const QString &title, const QString& text, | - | 
| 2150 | const QString& button0Text, const QString& button1Text, | - | 
| 2151 | const QString& button2Text, int defaultButtonNumber, | - | 
| 2152 | int escapeButtonNumber) | - | 
| 2153 | { | - | 
| 2154 | return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2155 | button0Text, button1Text, button2Text, never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2156 | defaultButtonNumber, escapeButtonNumber); never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Question, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2157 | } | - | 
| 2158 |  | - | 
| 2159 |  | - | 
| 2160 | /*! | - | 
| 2161 | \obsolete | - | 
| 2162 |  | - | 
| 2163 | Opens a warning message box with the given \a title and \a text. | - | 
| 2164 | The dialog may have up to three buttons. Each of the button | - | 
| 2165 | parameters, \a button0, \a button1 and \a button2 may be set to | - | 
| 2166 | one of the following values: | - | 
| 2167 |  | - | 
| 2168 | \list | - | 
| 2169 | \li QMessageBox::NoButton | - | 
| 2170 | \li QMessageBox::Ok | - | 
| 2171 | \li QMessageBox::Cancel | - | 
| 2172 | \li QMessageBox::Yes | - | 
| 2173 | \li QMessageBox::No | - | 
| 2174 | \li QMessageBox::Abort | - | 
| 2175 | \li QMessageBox::Retry | - | 
| 2176 | \li QMessageBox::Ignore | - | 
| 2177 | \li QMessageBox::YesAll | - | 
| 2178 | \li QMessageBox::NoAll | - | 
| 2179 | \endlist | - | 
| 2180 |  | - | 
| 2181 | If you don't want all three buttons, set the last button, or last | - | 
| 2182 | two buttons to QMessageBox::NoButton. | - | 
| 2183 |  | - | 
| 2184 | One button can be OR-ed with QMessageBox::Default, and one | - | 
| 2185 | button can be OR-ed with QMessageBox::Escape. | - | 
| 2186 |  | - | 
| 2187 | Returns the identity (QMessageBox::Ok or QMessageBox::No or ...) | - | 
| 2188 | of the button that was clicked. | - | 
| 2189 |  | - | 
| 2190 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 2191 | dialog box. | - | 
| 2192 |  | - | 
| 2193 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 2194 | If you want to do this, you should create the dialog | - | 
| 2195 | yourself using one of the QMessageBox constructors. | - | 
| 2196 |  | - | 
| 2197 | \sa information(), question(), critical() | - | 
| 2198 | */ | - | 
| 2199 | int QMessageBox::warning(QWidget *parent, const QString &title, const QString& text, | - | 
| 2200 | int button0, int button1, int button2) | - | 
| 2201 | { | - | 
| 2202 | return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0, button1, button2); | 0 | 
| 2203 | button0, button1, button2); never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0, button1, button2); | 0 | 
| 2204 | } | - | 
| 2205 |  | - | 
| 2206 | /*! | - | 
| 2207 | \obsolete | - | 
| 2208 | \overload | - | 
| 2209 |  | - | 
| 2210 | Displays a warning message box with the given \a title and \a | - | 
| 2211 | text, as well as one, two, or three buttons. Returns the number | - | 
| 2212 | of the button that was clicked (0, 1, or 2). | - | 
| 2213 |  | - | 
| 2214 | \a button0Text is the text of the first button, and is optional. | - | 
| 2215 | If \a button0Text is not supplied, "OK" (translated) will be used. | - | 
| 2216 | \a button1Text is the text of the second button, and is optional, | - | 
| 2217 | and \a button2Text is the text of the third button, and is | - | 
| 2218 | optional. \a defaultButtonNumber (0, 1 or 2) is the index of the | - | 
| 2219 | default button; pressing Return or Enter is the same as clicking | - | 
| 2220 | the default button. It defaults to 0 (the first button). \a | - | 
| 2221 | escapeButtonNumber is the index of the Escape button; pressing | - | 
| 2222 | Escape is the same as clicking this button. It defaults to -1; | - | 
| 2223 | supply 0, 1, or 2 to make pressing Escape equivalent to clicking | - | 
| 2224 | the relevant button. | - | 
| 2225 |  | - | 
| 2226 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 2227 | dialog box. | - | 
| 2228 |  | - | 
| 2229 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 2230 | If you want to do this, you should create the dialog | - | 
| 2231 | yourself using one of the QMessageBox constructors. | - | 
| 2232 |  | - | 
| 2233 | \sa information(), question(), critical() | - | 
| 2234 | */ | - | 
| 2235 | int QMessageBox::warning(QWidget *parent, const QString &title, const QString& text, | - | 
| 2236 | const QString& button0Text, const QString& button1Text, | - | 
| 2237 | const QString& button2Text, int defaultButtonNumber, | - | 
| 2238 | int escapeButtonNumber) | - | 
| 2239 | { | - | 
| 2240 | return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2241 | button0Text, button1Text, button2Text, never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2242 | defaultButtonNumber, escapeButtonNumber); never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Warning, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2243 | } | - | 
| 2244 |  | - | 
| 2245 | /*! | - | 
| 2246 | \obsolete | - | 
| 2247 |  | - | 
| 2248 | Opens a critical message box with the given \a title and \a text. | - | 
| 2249 | The dialog may have up to three buttons. Each of the button | - | 
| 2250 | parameters, \a button0, \a button1 and \a button2 may be set to | - | 
| 2251 | one of the following values: | - | 
| 2252 |  | - | 
| 2253 | \list | - | 
| 2254 | \li QMessageBox::NoButton | - | 
| 2255 | \li QMessageBox::Ok | - | 
| 2256 | \li QMessageBox::Cancel | - | 
| 2257 | \li QMessageBox::Yes | - | 
| 2258 | \li QMessageBox::No | - | 
| 2259 | \li QMessageBox::Abort | - | 
| 2260 | \li QMessageBox::Retry | - | 
| 2261 | \li QMessageBox::Ignore | - | 
| 2262 | \li QMessageBox::YesAll | - | 
| 2263 | \li QMessageBox::NoAll | - | 
| 2264 | \endlist | - | 
| 2265 |  | - | 
| 2266 | If you don't want all three buttons, set the last button, or last | - | 
| 2267 | two buttons to QMessageBox::NoButton. | - | 
| 2268 |  | - | 
| 2269 | One button can be OR-ed with QMessageBox::Default, and one | - | 
| 2270 | button can be OR-ed with QMessageBox::Escape. | - | 
| 2271 |  | - | 
| 2272 | Returns the identity (QMessageBox::Ok, or QMessageBox::No, etc.) | - | 
| 2273 | of the button that was clicked. | - | 
| 2274 |  | - | 
| 2275 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 2276 | dialog box. | - | 
| 2277 |  | - | 
| 2278 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 2279 | If you want to do this, you should create the dialog | - | 
| 2280 | yourself using one of the QMessageBox constructors. | - | 
| 2281 |  | - | 
| 2282 | \sa information(), question(), warning() | - | 
| 2283 | */ | - | 
| 2284 |  | - | 
| 2285 | int QMessageBox::critical(QWidget *parent, const QString &title, const QString& text, | - | 
| 2286 | int button0, int button1, int button2) | - | 
| 2287 | { | - | 
| 2288 | return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0, button1, button2); | 0 | 
| 2289 | button0, button1, button2); never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0, button1, button2); | 0 | 
| 2290 | } | - | 
| 2291 |  | - | 
| 2292 | /*! | - | 
| 2293 | \obsolete | - | 
| 2294 | \overload | - | 
| 2295 |  | - | 
| 2296 | Displays a critical error message box with the given \a title and | - | 
| 2297 | \a text, as well as one, two, or three buttons. Returns the | - | 
| 2298 | number of the button that was clicked (0, 1 or 2). | - | 
| 2299 |  | - | 
| 2300 | \a button0Text is the text of the first button, and is optional. | - | 
| 2301 | If \a button0Text is not supplied, "OK" (translated) will be used. | - | 
| 2302 | \a button1Text is the text of the second button, and is optional, | - | 
| 2303 | and \a button2Text is the text of the third button, and is | - | 
| 2304 | optional. \a defaultButtonNumber (0, 1 or 2) is the index of the | - | 
| 2305 | default button; pressing Return or Enter is the same as clicking | - | 
| 2306 | the default button. It defaults to 0 (the first button). \a | - | 
| 2307 | escapeButtonNumber is the index of the Escape button; pressing | - | 
| 2308 | Escape is the same as clicking this button. It defaults to -1; | - | 
| 2309 | supply 0, 1, or 2 to make pressing Escape equivalent to clicking | - | 
| 2310 | the relevant button. | - | 
| 2311 |  | - | 
| 2312 | The message box is an \l{Qt::ApplicationModal} {application modal} | - | 
| 2313 | dialog box. | - | 
| 2314 |  | - | 
| 2315 | \warning Do not delete \a parent during the execution of the dialog. | - | 
| 2316 | If you want to do this, you should create the dialog | - | 
| 2317 | yourself using one of the QMessageBox constructors. | - | 
| 2318 |  | - | 
| 2319 | \sa information(), question(), warning() | - | 
| 2320 | */ | - | 
| 2321 | int QMessageBox::critical(QWidget *parent, const QString &title, const QString& text, | - | 
| 2322 | const QString& button0Text, const QString& button1Text, | - | 
| 2323 | const QString& button2Text, int defaultButtonNumber, | - | 
| 2324 | int escapeButtonNumber) | - | 
| 2325 | { | - | 
| 2326 | return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2327 | button0Text, button1Text, button2Text, never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2328 | defaultButtonNumber, escapeButtonNumber); never executed: return QMessageBoxPrivate::showOldMessageBox(parent, Critical, title, text, button0Text, button1Text, button2Text, defaultButtonNumber, escapeButtonNumber); | 0 | 
| 2329 | } | - | 
| 2330 |  | - | 
| 2331 |  | - | 
| 2332 | /*! | - | 
| 2333 | \obsolete | - | 
| 2334 |  | - | 
| 2335 | Returns the text of the message box button \a button, or | - | 
| 2336 | an empty string if the message box does not contain the button. | - | 
| 2337 |  | - | 
| 2338 | Use button() and QPushButton::text() instead. | - | 
| 2339 | */ | - | 
| 2340 | QString QMessageBox::buttonText(int button) const | - | 
| 2341 | { | - | 
| 2342 | Q_D(const QMessageBox); never executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 2343 |  | - | 
| 2344 | if (QAbstractButton *abstractButton = d->abstractButtonForId(button)) { never evaluated: QAbstractButton *abstractButton = d->abstractButtonForId(button) | 0 | 
| 2345 | return abstractButton->text(); never executed: return abstractButton->text(); | 0 | 
| 2346 | } else if (d->buttonBox->buttons().isEmpty() && (button == Ok || button == Old_Ok)) { never evaluated: d->buttonBox->buttons().isEmpty() never evaluated: button == Ok never evaluated: button == Old_Ok | 0 | 
| 2347 | // for compatibility with Qt 4.0/4.1 | - | 
| 2348 | return QDialogButtonBox::tr("OK"); never executed: return QDialogButtonBox::tr("OK"); | 0 | 
| 2349 | } | - | 
| 2350 | return QString(); never executed: return QString(); | 0 | 
| 2351 | } | - | 
| 2352 |  | - | 
| 2353 | /*! | - | 
| 2354 | \obsolete | - | 
| 2355 |  | - | 
| 2356 | Sets the text of the message box button \a button to \a text. | - | 
| 2357 | Setting the text of a button that is not in the message box is | - | 
| 2358 | silently ignored. | - | 
| 2359 |  | - | 
| 2360 | Use addButton() instead. | - | 
| 2361 | */ | - | 
| 2362 | void QMessageBox::setButtonText(int button, const QString &text) | - | 
| 2363 | { | - | 
| 2364 | Q_D(QMessageBox); never executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 2365 | if (QAbstractButton *abstractButton = d->abstractButtonForId(button)) { partially evaluated:  QAbstractButton *abstractButton = d->abstractButtonForId(button)| yes Evaluation Count:2 | no Evaluation Count:0 | 
 | 0-2 | 
| 2366 | abstractButton->setText(text); executed (the execution status of this line is deduced):  abstractButton->setText(text); | - | 
| 2367 | } else if (d->buttonBox->buttons().isEmpty() && (button == Ok || button == Old_Ok)) { executed:  }Execution Count:2 never evaluated: d->buttonBox->buttons().isEmpty() never evaluated: button == Ok never evaluated: button == Old_Ok | 0-2 | 
| 2368 | // for compatibility with Qt 4.0/4.1 | - | 
| 2369 | addButton(QMessageBox::Ok)->setText(text); never executed (the execution status of this line is deduced):  addButton(QMessageBox::Ok)->setText(text); | - | 
| 2370 | } | 0 | 
| 2371 | } | - | 
| 2372 |  | - | 
| 2373 | #ifndef QT_NO_TEXTEDIT | - | 
| 2374 | /*! | - | 
| 2375 | \property QMessageBox::detailedText | - | 
| 2376 | \brief the text to be displayed in the details area. | - | 
| 2377 | \since 4.2 | - | 
| 2378 |  | - | 
| 2379 | The text will be interpreted as a plain text. | - | 
| 2380 |  | - | 
| 2381 | By default, this property contains an empty string. | - | 
| 2382 |  | - | 
| 2383 | \sa QMessageBox::text, QMessageBox::informativeText | - | 
| 2384 | */ | - | 
| 2385 | QString QMessageBox::detailedText() const | - | 
| 2386 | { | - | 
| 2387 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 2388 | return d->detailsText ? d->detailsText->text() : QString(); executed:  return d->detailsText ? d->detailsText->text() : QString();Execution Count:1 | 1 | 
| 2389 | } | - | 
| 2390 |  | - | 
| 2391 | void QMessageBox::setDetailedText(const QString &text) | - | 
| 2392 | { | - | 
| 2393 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 2394 | if (text.isEmpty()) { partially evaluated:  text.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:2 | 
 | 0-2 | 
| 2395 | delete d->detailsText; never executed (the execution status of this line is deduced):  delete d->detailsText; | - | 
| 2396 | d->detailsText = 0; never executed (the execution status of this line is deduced):  d->detailsText = 0; | - | 
| 2397 | removeButton(d->detailsButton); never executed (the execution status of this line is deduced):  removeButton(d->detailsButton); | - | 
| 2398 | delete d->detailsButton; never executed (the execution status of this line is deduced):  delete d->detailsButton; | - | 
| 2399 | d->detailsButton = 0; never executed (the execution status of this line is deduced):  d->detailsButton = 0; | - | 
| 2400 | return; | 0 | 
| 2401 | } | - | 
| 2402 |  | - | 
| 2403 | if (!d->detailsText) { partially evaluated:  !d->detailsText| yes Evaluation Count:2 | no Evaluation Count:0 | 
 | 0-2 | 
| 2404 | d->detailsText = new QMessageBoxDetailsText(this); executed (the execution status of this line is deduced):  d->detailsText = new QMessageBoxDetailsText(this); | - | 
| 2405 | QGridLayout* grid = qobject_cast<QGridLayout*>(layout()); executed (the execution status of this line is deduced):  QGridLayout* grid = qobject_cast<QGridLayout*>(layout()); | - | 
| 2406 | if (grid) partially evaluated:  grid| yes Evaluation Count:2 | no Evaluation Count:0 | 
 | 0-2 | 
| 2407 | grid->addWidget(d->detailsText, grid->rowCount(), 0, 1, grid->columnCount()); executed:  grid->addWidget(d->detailsText, grid->rowCount(), 0, 1, grid->columnCount());Execution Count:2 | 2 | 
| 2408 | d->detailsText->hide(); executed (the execution status of this line is deduced):  d->detailsText->hide(); | - | 
| 2409 | } executed:  }Execution Count:2 | 2 | 
| 2410 | if (!d->detailsButton) partially evaluated:  !d->detailsButton| yes Evaluation Count:2 | no Evaluation Count:0 | 
 | 0-2 | 
| 2411 | d->detailsButton = new DetailButton(this); executed:  d->detailsButton = new DetailButton(this);Execution Count:2 | 2 | 
| 2412 | d->detailsText->setText(text); executed (the execution status of this line is deduced):  d->detailsText->setText(text); | - | 
| 2413 | } executed:  }Execution Count:2 | 2 | 
| 2414 | #endif // QT_NO_TEXTEDIT | - | 
| 2415 |  | - | 
| 2416 | /*! | - | 
| 2417 | \property QMessageBox::informativeText | - | 
| 2418 |  | - | 
| 2419 | \brief the informative text that provides a fuller description for | - | 
| 2420 | the message | - | 
| 2421 |  | - | 
| 2422 | \since 4.2 | - | 
| 2423 |  | - | 
| 2424 | Infromative text can be used to expand upon the text() to give more | - | 
| 2425 | information to the user. On the Mac, this text appears in small | - | 
| 2426 | system font below the text().  On other platforms, it is simply | - | 
| 2427 | appended to the existing text. | - | 
| 2428 |  | - | 
| 2429 | By default, this property contains an empty string. | - | 
| 2430 |  | - | 
| 2431 | \sa QMessageBox::text, QMessageBox::detailedText | - | 
| 2432 | */ | - | 
| 2433 | QString QMessageBox::informativeText() const | - | 
| 2434 | { | - | 
| 2435 | Q_D(const QMessageBox); executed (the execution status of this line is deduced):  const QMessageBoxPrivate * const d = d_func(); | - | 
| 2436 | return d->informativeLabel ? d->informativeLabel->text() : QString(); executed:  return d->informativeLabel ? d->informativeLabel->text() : QString();Execution Count:1 | 1 | 
| 2437 | } | - | 
| 2438 |  | - | 
| 2439 | void QMessageBox::setInformativeText(const QString &text) | - | 
| 2440 | { | - | 
| 2441 | Q_D(QMessageBox); executed (the execution status of this line is deduced):  QMessageBoxPrivate * const d = d_func(); | - | 
| 2442 | if (text.isEmpty()) { partially evaluated:  text.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:2 | 
 | 0-2 | 
| 2443 | layout()->removeWidget(d->informativeLabel); never executed (the execution status of this line is deduced):  layout()->removeWidget(d->informativeLabel); | - | 
| 2444 | delete d->informativeLabel; never executed (the execution status of this line is deduced):  delete d->informativeLabel; | - | 
| 2445 | d->informativeLabel = 0; never executed (the execution status of this line is deduced):  d->informativeLabel = 0; | - | 
| 2446 | #ifndef Q_OS_MAC | - | 
| 2447 | d->label->setContentsMargins(2, 0, 0, 0); never executed (the execution status of this line is deduced):  d->label->setContentsMargins(2, 0, 0, 0); | - | 
| 2448 | #endif | - | 
| 2449 | d->updateSize(); never executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 2450 | return; | 0 | 
| 2451 | } | - | 
| 2452 |  | - | 
| 2453 | if (!d->informativeLabel) { partially evaluated:  !d->informativeLabel| yes Evaluation Count:2 | no Evaluation Count:0 | 
 | 0-2 | 
| 2454 | QLabel *label = new QLabel; executed (the execution status of this line is deduced):  QLabel *label = new QLabel; | - | 
| 2455 | label->setObjectName(QLatin1String("qt_msgbox_informativelabel")); executed (the execution status of this line is deduced):  label->setObjectName(QLatin1String("qt_msgbox_informativelabel")); | - | 
| 2456 | label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this))); executed (the execution status of this line is deduced):  label->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this))); | - | 
| 2457 | label->setAlignment(Qt::AlignTop | Qt::AlignLeft); executed (the execution status of this line is deduced):  label->setAlignment(Qt::AlignTop | Qt::AlignLeft); | - | 
| 2458 | label->setOpenExternalLinks(true); executed (the execution status of this line is deduced):  label->setOpenExternalLinks(true); | - | 
| 2459 | label->setWordWrap(true); executed (the execution status of this line is deduced):  label->setWordWrap(true); | - | 
| 2460 | #ifndef Q_OS_MAC | - | 
| 2461 | d->label->setContentsMargins(2, 0, 0, 0); executed (the execution status of this line is deduced):  d->label->setContentsMargins(2, 0, 0, 0); | - | 
| 2462 | label->setContentsMargins(2, 0, 0, 6); executed (the execution status of this line is deduced):  label->setContentsMargins(2, 0, 0, 6); | - | 
| 2463 | label->setIndent(9); executed (the execution status of this line is deduced):  label->setIndent(9); | - | 
| 2464 | #else | - | 
| 2465 | label->setContentsMargins(16, 0, 0, 0); | - | 
| 2466 | // apply a smaller font the information label on the mac | - | 
| 2467 | label->setFont(qt_app_fonts_hash()->value("QTipLabel")); | - | 
| 2468 | #endif | - | 
| 2469 | label->setWordWrap(true); executed (the execution status of this line is deduced):  label->setWordWrap(true); | - | 
| 2470 | QGridLayout *grid = static_cast<QGridLayout *>(layout()); executed (the execution status of this line is deduced):  QGridLayout *grid = static_cast<QGridLayout *>(layout()); | - | 
| 2471 | grid->addWidget(label, 1, 1, 1, 1); executed (the execution status of this line is deduced):  grid->addWidget(label, 1, 1, 1, 1); | - | 
| 2472 | d->informativeLabel = label; executed (the execution status of this line is deduced):  d->informativeLabel = label; | - | 
| 2473 | } executed:  }Execution Count:2 | 2 | 
| 2474 | d->informativeLabel->setText(text); executed (the execution status of this line is deduced):  d->informativeLabel->setText(text); | - | 
| 2475 | d->updateSize(); executed (the execution status of this line is deduced):  d->updateSize(); | - | 
| 2476 | } executed:  }Execution Count:2 | 2 | 
| 2477 |  | - | 
| 2478 | /*! | - | 
| 2479 | \since 4.2 | - | 
| 2480 |  | - | 
| 2481 | This function shadows QWidget::setWindowTitle(). | - | 
| 2482 |  | - | 
| 2483 | Sets the title of the message box to \a title. On Mac OS X, | - | 
| 2484 | the window title is ignored (as required by the Mac OS X | - | 
| 2485 | Guidelines). | - | 
| 2486 | */ | - | 
| 2487 | void QMessageBox::setWindowTitle(const QString &title) | - | 
| 2488 | { | - | 
| 2489 | // Message boxes on the mac do not have a title | - | 
| 2490 | #ifndef Q_OS_MAC | - | 
| 2491 | QDialog::setWindowTitle(title); executed (the execution status of this line is deduced):  QDialog::setWindowTitle(title); | - | 
| 2492 | #else | - | 
| 2493 | Q_UNUSED(title); | - | 
| 2494 | #endif | - | 
| 2495 | } executed:  }Execution Count:29 | 29 | 
| 2496 |  | - | 
| 2497 |  | - | 
| 2498 | /*! | - | 
| 2499 | \since 4.2 | - | 
| 2500 |  | - | 
| 2501 | This function shadows QWidget::setWindowModality(). | - | 
| 2502 |  | - | 
| 2503 | Sets the modality of the message box to \a windowModality. | - | 
| 2504 |  | - | 
| 2505 | On Mac OS X, if the modality is set to Qt::WindowModal and the message box | - | 
| 2506 | has a parent, then the message box will be a Qt::Sheet, otherwise the | - | 
| 2507 | message box will be a standard dialog. | - | 
| 2508 | */ | - | 
| 2509 | void QMessageBox::setWindowModality(Qt::WindowModality windowModality) | - | 
| 2510 | { | - | 
| 2511 | QDialog::setWindowModality(windowModality); never executed (the execution status of this line is deduced):  QDialog::setWindowModality(windowModality); | - | 
| 2512 |  | - | 
| 2513 | if (parentWidget() && windowModality == Qt::WindowModal) never evaluated: parentWidget() never evaluated: windowModality == Qt::WindowModal | 0 | 
| 2514 | setParent(parentWidget(), Qt::Sheet); never executed: setParent(parentWidget(), Qt::Sheet); | 0 | 
| 2515 | else | - | 
| 2516 | setParent(parentWidget(), Qt::Dialog); never executed: setParent(parentWidget(), Qt::Dialog); | 0 | 
| 2517 | setDefaultButton(d_func()->defaultButton); never executed (the execution status of this line is deduced):  setDefaultButton(d_func()->defaultButton); | - | 
| 2518 | } | 0 | 
| 2519 |  | - | 
| 2520 |  | - | 
| 2521 | QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb) | - | 
| 2522 | { | - | 
| 2523 | QStyle *style = mb ? mb->style() : QApplication::style(); evaluated:  mb| yes Evaluation Count:38 | yes Evaluation Count:2 | 
 | 2-38 | 
| 2524 | int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, mb); executed (the execution status of this line is deduced):  int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, mb); | - | 
| 2525 | QIcon tmpIcon; executed (the execution status of this line is deduced):  QIcon tmpIcon; | - | 
| 2526 | switch (icon) { | - | 
| 2527 | case QMessageBox::Information: | - | 
| 2528 | tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, mb); executed (the execution status of this line is deduced):  tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, mb); | - | 
| 2529 | break; executed:  break;Execution Count:15 | 15 | 
| 2530 | case QMessageBox::Warning: | - | 
| 2531 | tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, mb); executed (the execution status of this line is deduced):  tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, mb); | - | 
| 2532 | break; executed:  break;Execution Count:6 | 6 | 
| 2533 | case QMessageBox::Critical: | - | 
| 2534 | tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, mb); executed (the execution status of this line is deduced):  tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, mb); | - | 
| 2535 | break; executed:  break;Execution Count:5 | 5 | 
| 2536 | case QMessageBox::Question: | - | 
| 2537 | tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mb); executed (the execution status of this line is deduced):  tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mb); | - | 
| 2538 | default: | - | 
| 2539 | break; executed:  break;Execution Count:14 | 14 | 
| 2540 | } | - | 
| 2541 | if (!tmpIcon.isNull()) evaluated:  !tmpIcon.isNull()| yes Evaluation Count:34 | yes Evaluation Count:6 | 
 | 6-34 | 
| 2542 | return tmpIcon.pixmap(iconSize, iconSize); executed:  return tmpIcon.pixmap(iconSize, iconSize);Execution Count:34 | 34 | 
| 2543 | return QPixmap(); executed:  return QPixmap();Execution Count:6 | 6 | 
| 2544 | } | - | 
| 2545 |  | - | 
| 2546 | /*! | - | 
| 2547 | \obsolete | - | 
| 2548 |  | - | 
| 2549 | Returns the pixmap used for a standard icon. This allows the | - | 
| 2550 | pixmaps to be used in more complex message boxes. \a icon | - | 
| 2551 | specifies the required icon, e.g. QMessageBox::Question, | - | 
| 2552 | QMessageBox::Information, QMessageBox::Warning or | - | 
| 2553 | QMessageBox::Critical. | - | 
| 2554 |  | - | 
| 2555 | Call QStyle::standardIcon() with QStyle::SP_MessageBoxInformation etc. | - | 
| 2556 | instead. | - | 
| 2557 | */ | - | 
| 2558 |  | - | 
| 2559 | QPixmap QMessageBox::standardIcon(Icon icon) | - | 
| 2560 | { | - | 
| 2561 | return QMessageBoxPrivate::standardIcon(icon, 0); executed:  return QMessageBoxPrivate::standardIcon(icon, 0);Execution Count:2 | 2 | 
| 2562 | } | - | 
| 2563 |  | - | 
| 2564 | /*! | - | 
| 2565 | \typedef QMessageBox::Button | - | 
| 2566 | \obsolete | - | 
| 2567 |  | - | 
| 2568 | Use QMessageBox::StandardButton instead. | - | 
| 2569 | */ | - | 
| 2570 |  | - | 
| 2571 | /*! | - | 
| 2572 | \fn int QMessageBox::information(QWidget *parent, const QString &title, | - | 
| 2573 | const QString& text, StandardButton button0, | - | 
| 2574 | StandardButton button1) | - | 
| 2575 | \fn int QMessageBox::warning(QWidget *parent, const QString &title, | - | 
| 2576 | const QString& text, StandardButton button0, | - | 
| 2577 | StandardButton button1) | - | 
| 2578 | \fn int QMessageBox::critical(QWidget *parent, const QString &title, | - | 
| 2579 | const QString& text, StandardButton button0, | - | 
| 2580 | StandardButton button1) | - | 
| 2581 | \fn int QMessageBox::question(QWidget *parent, const QString &title, | - | 
| 2582 | const QString& text, StandardButton button0, | - | 
| 2583 | StandardButton button1) | - | 
| 2584 | \internal | - | 
| 2585 |  | - | 
| 2586 | ### Needed for Qt 4 source compatibility | - | 
| 2587 | */ | - | 
| 2588 |  | - | 
| 2589 | /*! | - | 
| 2590 | \fn int QMessageBox::exec() | - | 
| 2591 |  | - | 
| 2592 | Shows the message box as a \l{QDialog#Modal Dialogs}{modal dialog}, | - | 
| 2593 | blocking until the user closes it. | - | 
| 2594 |  | - | 
| 2595 | When using a QMessageBox with standard buttons, this functions returns a | - | 
| 2596 | \l StandardButton value indicating the standard button that was clicked. | - | 
| 2597 | When using QMessageBox with custom buttons, this function returns an | - | 
| 2598 | opaque value; use clickedButton() to determine which button was clicked. | - | 
| 2599 |  | - | 
| 2600 | \note The result() function returns also \l StandardButton value instead | - | 
| 2601 | of \l QDialog::DialogCode. | - | 
| 2602 |  | - | 
| 2603 | Users cannot interact with any other window in the same | - | 
| 2604 | application until they close the dialog, either by clicking a | - | 
| 2605 | button or by using a mechanism provided by the window system. | - | 
| 2606 |  | - | 
| 2607 | \sa show(), result() | - | 
| 2608 | */ | - | 
| 2609 |  | - | 
| 2610 | QT_END_NAMESPACE | - | 
| 2611 |  | - | 
| 2612 | #include "moc_qmessagebox.cpp" | - | 
| 2613 |  | - | 
| 2614 | #endif // QT_NO_MESSAGEBOX | - | 
| 2615 |  | - | 
|  |  |  |