| 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 "qerrormessage.h" | - |
| 43 | | - |
| 44 | #ifndef QT_NO_ERRORMESSAGE | - |
| 45 | | - |
| 46 | #include "qapplication.h" | - |
| 47 | #include "qcheckbox.h" | - |
| 48 | #include "qlabel.h" | - |
| 49 | #include "qlayout.h" | - |
| 50 | #include "qmessagebox.h" | - |
| 51 | #include "qpushbutton.h" | - |
| 52 | #include "qstringlist.h" | - |
| 53 | #include "qtextedit.h" | - |
| 54 | #include "qdialog_p.h" | - |
| 55 | #include "qpixmap.h" | - |
| 56 | #include "qmetaobject.h" | - |
| 57 | #include "qthread.h" | - |
| 58 | #include "qqueue.h" | - |
| 59 | #include "qset.h" | - |
| 60 | | - |
| 61 | #include <stdio.h> | - |
| 62 | #include <stdlib.h> | - |
| 63 | | - |
| 64 | #ifdef Q_OS_WINCE | - |
| 65 | extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp | - |
| 66 | extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp | - |
| 67 | #endif | - |
| 68 | | - |
| 69 | QT_BEGIN_NAMESPACE | - |
| 70 | | - |
| 71 | class QErrorMessagePrivate : public QDialogPrivate | - |
| 72 | { | - |
| 73 | Q_DECLARE_PUBLIC(QErrorMessage) | - |
| 74 | public: | - |
| 75 | QPushButton * ok; | - |
| 76 | QCheckBox * again; | - |
| 77 | QTextEdit * errors; | - |
| 78 | QLabel * icon; | - |
| 79 | QQueue<QPair<QString, QString> > pending; | - |
| 80 | QSet<QString> doNotShow; | - |
| 81 | QSet<QString> doNotShowType; | - |
| 82 | QString currentMessage; | - |
| 83 | QString currentType; | - |
| 84 | | - |
| 85 | bool nextPending(); | - |
| 86 | void retranslateStrings(); | - |
| 87 | }; | - |
| 88 | | - |
| 89 | class QErrorMessageTextView : public QTextEdit | - |
| 90 | { | - |
| 91 | public: | - |
| 92 | QErrorMessageTextView(QWidget *parent) | - |
| 93 | : QTextEdit(parent) { setReadOnly(true); } executed: }Execution Count:2 | 2 |
| 94 | | - |
| 95 | virtual QSize minimumSizeHint() const; | - |
| 96 | virtual QSize sizeHint() const; | - |
| 97 | }; | - |
| 98 | | - |
| 99 | QSize QErrorMessageTextView::minimumSizeHint() const | - |
| 100 | { | - |
| 101 | #ifdef Q_OS_WINCE | - |
| 102 | if (qt_wince_is_mobile()) | - |
| 103 | if (qt_wince_is_high_dpi()) | - |
| 104 | return QSize(200, 200); | - |
| 105 | else | - |
| 106 | return QSize(100, 100); | - |
| 107 | else | - |
| 108 | return QSize(70, 70); | - |
| 109 | #else | - |
| 110 | return QSize(50, 50); executed: return QSize(50, 50);Execution Count:2 | 2 |
| 111 | #endif | - |
| 112 | } | - |
| 113 | | - |
| 114 | QSize QErrorMessageTextView::sizeHint() const | - |
| 115 | { | - |
| 116 | #ifdef Q_OS_WINCE | - |
| 117 | if (qt_wince_is_mobile()) | - |
| 118 | if (qt_wince_is_high_dpi()) | - |
| 119 | return QSize(400, 200); | - |
| 120 | else | - |
| 121 | return QSize(320, 120); | - |
| 122 | else | - |
| 123 | return QSize(300, 100); | - |
| 124 | #else | - |
| 125 | return QSize(250, 75); executed: return QSize(250, 75);Execution Count:2 | 2 |
| 126 | #endif //Q_OS_WINCE | - |
| 127 | } | - |
| 128 | | - |
| 129 | /*! | - |
| 130 | \class QErrorMessage | - |
| 131 | | - |
| 132 | \brief The QErrorMessage class provides an error message display dialog. | - |
| 133 | | - |
| 134 | \ingroup standard-dialog | - |
| 135 | \inmodule QtWidgets | - |
| 136 | | - |
| 137 | An error message widget consists of a text label and a checkbox. The | - |
| 138 | checkbox lets the user control whether the same error message will be | - |
| 139 | displayed again in the future, typically displaying the text, | - |
| 140 | "Show this message again" translated into the appropriate local | - |
| 141 | language. | - |
| 142 | | - |
| 143 | For production applications, the class can be used to display messages which | - |
| 144 | the user only needs to see once. To use QErrorMessage like this, you create | - |
| 145 | the dialog in the usual way, and show it by calling the showMessage() slot or | - |
| 146 | connecting signals to it. | - |
| 147 | | - |
| 148 | The static qtHandler() function installs a message handler | - |
| 149 | using qInstallMessageHandler() and creates a QErrorMessage that displays | - |
| 150 | qDebug(), qWarning() and qFatal() messages. This is most useful in | - |
| 151 | environments where no console is available to display warnings and | - |
| 152 | error messages. | - |
| 153 | | - |
| 154 | In both cases QErrorMessage will queue pending messages and display | - |
| 155 | them in order, with each new message being shown as soon as the user | - |
| 156 | has accepted the previous message. Once the user has specified that a | - |
| 157 | message is not to be shown again it is automatically skipped, and the | - |
| 158 | dialog will show the next appropriate message in the queue. | - |
| 159 | | - |
| 160 | The \l{dialogs/standarddialogs}{Standard Dialogs} example shows | - |
| 161 | how to use QErrorMessage as well as other built-in Qt dialogs. | - |
| 162 | | - |
| 163 | \image qerrormessage.png | - |
| 164 | | - |
| 165 | \sa QMessageBox, QStatusBar::showMessage(), {Standard Dialogs Example} | - |
| 166 | */ | - |
| 167 | | - |
| 168 | static QErrorMessage * qtMessageHandler = 0; | - |
| 169 | | - |
| 170 | static void deleteStaticcQErrorMessage() // post-routine | - |
| 171 | { | - |
| 172 | if (qtMessageHandler) { never evaluated: qtMessageHandler | 0 |
| 173 | delete qtMessageHandler; never executed (the execution status of this line is deduced): delete qtMessageHandler; | - |
| 174 | qtMessageHandler = 0; never executed (the execution status of this line is deduced): qtMessageHandler = 0; | - |
| 175 | } | 0 |
| 176 | } | 0 |
| 177 | | - |
| 178 | static bool metFatal = false; | - |
| 179 | | - |
| 180 | static void jump(QtMsgType t, const QMessageLogContext & /*context*/, const QString &m) | - |
| 181 | { | - |
| 182 | if (!qtMessageHandler) never evaluated: !qtMessageHandler | 0 |
| 183 | return; | 0 |
| 184 | | - |
| 185 | QString rich; never executed (the execution status of this line is deduced): QString rich; | - |
| 186 | | - |
| 187 | switch (t) { | - |
| 188 | case QtDebugMsg: | - |
| 189 | default: | - |
| 190 | rich = QErrorMessage::tr("Debug Message:"); never executed (the execution status of this line is deduced): rich = QErrorMessage::tr("Debug Message:"); | - |
| 191 | break; | 0 |
| 192 | case QtWarningMsg: | - |
| 193 | rich = QErrorMessage::tr("Warning:"); never executed (the execution status of this line is deduced): rich = QErrorMessage::tr("Warning:"); | - |
| 194 | break; | 0 |
| 195 | case QtFatalMsg: | - |
| 196 | rich = QErrorMessage::tr("Fatal Error:"); never executed (the execution status of this line is deduced): rich = QErrorMessage::tr("Fatal Error:"); | - |
| 197 | } | 0 |
| 198 | rich = QString::fromLatin1("<p><b>%1</b></p>").arg(rich); never executed (the execution status of this line is deduced): rich = QString::fromLatin1("<p><b>%1</b></p>").arg(rich); | - |
| 199 | rich += Qt::convertFromPlainText(m, Qt::WhiteSpaceNormal); never executed (the execution status of this line is deduced): rich += Qt::convertFromPlainText(m, Qt::WhiteSpaceNormal); | - |
| 200 | | - |
| 201 | // ### work around text engine quirk | - |
| 202 | if (rich.endsWith(QLatin1String("</p>"))) never evaluated: rich.endsWith(QLatin1String("</p>")) | 0 |
| 203 | rich.chop(4); never executed: rich.chop(4); | 0 |
| 204 | | - |
| 205 | if (!metFatal) { never evaluated: !metFatal | 0 |
| 206 | if (QThread::currentThread() == qApp->thread()) { never evaluated: QThread::currentThread() == (static_cast<QApplication *>(QCoreApplication::instance()))->thread() | 0 |
| 207 | qtMessageHandler->showMessage(rich); never executed (the execution status of this line is deduced): qtMessageHandler->showMessage(rich); | - |
| 208 | } else { | 0 |
| 209 | QMetaObject::invokeMethod(qtMessageHandler, never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(qtMessageHandler, | - |
| 210 | "showMessage", never executed (the execution status of this line is deduced): "showMessage", | - |
| 211 | Qt::QueuedConnection, never executed (the execution status of this line is deduced): Qt::QueuedConnection, | - |
| 212 | Q_ARG(QString, rich)); never executed (the execution status of this line is deduced): QArgument<QString >("QString", rich)); | - |
| 213 | } | 0 |
| 214 | metFatal = (t == QtFatalMsg); never executed (the execution status of this line is deduced): metFatal = (t == QtFatalMsg); | - |
| 215 | } | 0 |
| 216 | } | 0 |
| 217 | | - |
| 218 | | - |
| 219 | /*! | - |
| 220 | Constructs and installs an error handler window with the given \a | - |
| 221 | parent. | - |
| 222 | */ | - |
| 223 | | - |
| 224 | QErrorMessage::QErrorMessage(QWidget * parent) | - |
| 225 | : QDialog(*new QErrorMessagePrivate, parent) | - |
| 226 | { | - |
| 227 | Q_D(QErrorMessage); executed (the execution status of this line is deduced): QErrorMessagePrivate * const d = d_func(); | - |
| 228 | QGridLayout * grid = new QGridLayout(this); executed (the execution status of this line is deduced): QGridLayout * grid = new QGridLayout(this); | - |
| 229 | d->icon = new QLabel(this); executed (the execution status of this line is deduced): d->icon = new QLabel(this); | - |
| 230 | #ifndef QT_NO_MESSAGEBOX | - |
| 231 | d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information)); executed (the execution status of this line is deduced): d->icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information)); | - |
| 232 | d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); executed (the execution status of this line is deduced): d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); | - |
| 233 | #endif | - |
| 234 | grid->addWidget(d->icon, 0, 0, Qt::AlignTop); executed (the execution status of this line is deduced): grid->addWidget(d->icon, 0, 0, Qt::AlignTop); | - |
| 235 | d->errors = new QErrorMessageTextView(this); executed (the execution status of this line is deduced): d->errors = new QErrorMessageTextView(this); | - |
| 236 | grid->addWidget(d->errors, 0, 1); executed (the execution status of this line is deduced): grid->addWidget(d->errors, 0, 1); | - |
| 237 | d->again = new QCheckBox(this); executed (the execution status of this line is deduced): d->again = new QCheckBox(this); | - |
| 238 | d->again->setChecked(true); executed (the execution status of this line is deduced): d->again->setChecked(true); | - |
| 239 | grid->addWidget(d->again, 1, 1, Qt::AlignTop); executed (the execution status of this line is deduced): grid->addWidget(d->again, 1, 1, Qt::AlignTop); | - |
| 240 | d->ok = new QPushButton(this); executed (the execution status of this line is deduced): d->ok = new QPushButton(this); | - |
| 241 | | - |
| 242 | | - |
| 243 | #if defined(Q_OS_WINCE) | - |
| 244 | d->ok->setFixedSize(0,0); | - |
| 245 | #endif | - |
| 246 | connect(d->ok, SIGNAL(clicked()), this, SLOT(accept())); executed (the execution status of this line is deduced): connect(d->ok, "2""clicked()", this, "1""accept()"); | - |
| 247 | d->ok->setFocus(); executed (the execution status of this line is deduced): d->ok->setFocus(); | - |
| 248 | grid->addWidget(d->ok, 2, 0, 1, 2, Qt::AlignCenter); executed (the execution status of this line is deduced): grid->addWidget(d->ok, 2, 0, 1, 2, Qt::AlignCenter); | - |
| 249 | grid->setColumnStretch(1, 42); executed (the execution status of this line is deduced): grid->setColumnStretch(1, 42); | - |
| 250 | grid->setRowStretch(0, 42); executed (the execution status of this line is deduced): grid->setRowStretch(0, 42); | - |
| 251 | d->retranslateStrings(); executed (the execution status of this line is deduced): d->retranslateStrings(); | - |
| 252 | } executed: }Execution Count:2 | 2 |
| 253 | | - |
| 254 | | - |
| 255 | /*! | - |
| 256 | Destroys the error message dialog. | - |
| 257 | */ | - |
| 258 | | - |
| 259 | QErrorMessage::~QErrorMessage() | - |
| 260 | { | - |
| 261 | if (this == qtMessageHandler) { partially evaluated: this == qtMessageHandler| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 262 | qtMessageHandler = 0; never executed (the execution status of this line is deduced): qtMessageHandler = 0; | - |
| 263 | QtMessageHandler tmp = qInstallMessageHandler(0); never executed (the execution status of this line is deduced): QtMessageHandler tmp = qInstallMessageHandler(0); | - |
| 264 | // in case someone else has later stuck in another... | - |
| 265 | if (tmp != jump) never evaluated: tmp != jump | 0 |
| 266 | qInstallMessageHandler(tmp); never executed: qInstallMessageHandler(tmp); | 0 |
| 267 | } | 0 |
| 268 | } executed: }Execution Count:2 | 2 |
| 269 | | - |
| 270 | | - |
| 271 | /*! \reimp */ | - |
| 272 | | - |
| 273 | void QErrorMessage::done(int a) | - |
| 274 | { | - |
| 275 | Q_D(QErrorMessage); executed (the execution status of this line is deduced): QErrorMessagePrivate * const d = d_func(); | - |
| 276 | if (!d->again->isChecked() && !d->currentMessage.isEmpty() && d->currentType.isEmpty()) { evaluated: !d->again->isChecked()| yes Evaluation Count:3 | yes Evaluation Count:5 |
partially evaluated: !d->currentMessage.isEmpty()| yes Evaluation Count:3 | no Evaluation Count:0 |
evaluated: d->currentType.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 0-5 |
| 277 | d->doNotShow.insert(d->currentMessage); executed (the execution status of this line is deduced): d->doNotShow.insert(d->currentMessage); | - |
| 278 | } executed: }Execution Count:2 | 2 |
| 279 | if (!d->again->isChecked() && !d->currentType.isEmpty()) { evaluated: !d->again->isChecked()| yes Evaluation Count:3 | yes Evaluation Count:5 |
evaluated: !d->currentType.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-5 |
| 280 | d->doNotShowType.insert(d->currentType); executed (the execution status of this line is deduced): d->doNotShowType.insert(d->currentType); | - |
| 281 | } executed: }Execution Count:1 | 1 |
| 282 | d->currentMessage.clear(); executed (the execution status of this line is deduced): d->currentMessage.clear(); | - |
| 283 | d->currentType.clear(); executed (the execution status of this line is deduced): d->currentType.clear(); | - |
| 284 | if (!d->nextPending()) { partially evaluated: !d->nextPending()| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 285 | QDialog::done(a); executed (the execution status of this line is deduced): QDialog::done(a); | - |
| 286 | if (this == qtMessageHandler && metFatal) partially evaluated: this == qtMessageHandler| no Evaluation Count:0 | yes Evaluation Count:8 |
never evaluated: metFatal | 0-8 |
| 287 | exit(1); | 0 |
| 288 | } executed: }Execution Count:8 | 8 |
| 289 | } executed: }Execution Count:8 | 8 |
| 290 | | - |
| 291 | | - |
| 292 | /*! | - |
| 293 | Returns a pointer to a QErrorMessage object that outputs the | - |
| 294 | default Qt messages. This function creates such an object, if there | - |
| 295 | isn't one already. | - |
| 296 | */ | - |
| 297 | | - |
| 298 | QErrorMessage * QErrorMessage::qtHandler() | - |
| 299 | { | - |
| 300 | if (!qtMessageHandler) { never evaluated: !qtMessageHandler | 0 |
| 301 | qtMessageHandler = new QErrorMessage(0); never executed (the execution status of this line is deduced): qtMessageHandler = new QErrorMessage(0); | - |
| 302 | qAddPostRoutine(deleteStaticcQErrorMessage); // clean up never executed (the execution status of this line is deduced): qAddPostRoutine(deleteStaticcQErrorMessage); | - |
| 303 | qtMessageHandler->setWindowTitle(QApplication::applicationName()); never executed (the execution status of this line is deduced): qtMessageHandler->setWindowTitle(QApplication::applicationName()); | - |
| 304 | qInstallMessageHandler(jump); never executed (the execution status of this line is deduced): qInstallMessageHandler(jump); | - |
| 305 | } | 0 |
| 306 | return qtMessageHandler; never executed: return qtMessageHandler; | 0 |
| 307 | } | - |
| 308 | | - |
| 309 | | - |
| 310 | /*! \internal */ | - |
| 311 | | - |
| 312 | bool QErrorMessagePrivate::nextPending() | - |
| 313 | { | - |
| 314 | while (!pending.isEmpty()) { evaluated: !pending.isEmpty()| yes Evaluation Count:11 | yes Evaluation Count:10 |
| 10-11 |
| 315 | QPair<QString,QString> pendingMessage = pending.dequeue(); executed (the execution status of this line is deduced): QPair<QString,QString> pendingMessage = pending.dequeue(); | - |
| 316 | QString message = pendingMessage.first; executed (the execution status of this line is deduced): QString message = pendingMessage.first; | - |
| 317 | QString type = pendingMessage.second; executed (the execution status of this line is deduced): QString type = pendingMessage.second; | - |
| 318 | if (!message.isEmpty() && ((type.isEmpty() && !doNotShow.contains(message)) || (!type.isEmpty() && !doNotShowType.contains(type)))) { partially evaluated: !message.isEmpty()| yes Evaluation Count:11 | no Evaluation Count:0 |
evaluated: type.isEmpty()| yes Evaluation Count:5 | yes Evaluation Count:6 |
partially evaluated: !doNotShow.contains(message)| yes Evaluation Count:5 | no Evaluation Count:0 |
partially evaluated: !type.isEmpty()| yes Evaluation Count:6 | no Evaluation Count:0 |
evaluated: !doNotShowType.contains(type)| yes Evaluation Count:4 | yes Evaluation Count:2 |
| 0-11 |
| 319 | #ifndef QT_NO_TEXTHTMLPARSER | - |
| 320 | errors->setHtml(message); executed (the execution status of this line is deduced): errors->setHtml(message); | - |
| 321 | #else | - |
| 322 | errors->setPlainText(message); | - |
| 323 | #endif | - |
| 324 | currentMessage = message; executed (the execution status of this line is deduced): currentMessage = message; | - |
| 325 | currentType = type; executed (the execution status of this line is deduced): currentType = type; | - |
| 326 | return true; executed: return true;Execution Count:9 | 9 |
| 327 | } | - |
| 328 | } executed: }Execution Count:2 | 2 |
| 329 | return false; executed: return false;Execution Count:10 | 10 |
| 330 | } | - |
| 331 | | - |
| 332 | | - |
| 333 | /*! | - |
| 334 | Shows the given message, \a message, and returns immediately. If the user | - |
| 335 | has requested for the message not to be shown again, this function does | - |
| 336 | nothing. | - |
| 337 | | - |
| 338 | Normally, the message is displayed immediately. However, if there are | - |
| 339 | pending messages, it will be queued to be displayed later. | - |
| 340 | */ | - |
| 341 | | - |
| 342 | void QErrorMessage::showMessage(const QString &message) | - |
| 343 | { | - |
| 344 | Q_D(QErrorMessage); executed (the execution status of this line is deduced): QErrorMessagePrivate * const d = d_func(); | - |
| 345 | if (d->doNotShow.contains(message)) evaluated: d->doNotShow.contains(message)| yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
| 346 | return; executed: return;Execution Count:2 | 2 |
| 347 | d->pending.enqueue(qMakePair(message,QString())); executed (the execution status of this line is deduced): d->pending.enqueue(qMakePair(message,QString())); | - |
| 348 | if (!isVisible() && d->nextPending()) partially evaluated: !isVisible()| yes Evaluation Count:5 | no Evaluation Count:0 |
partially evaluated: d->nextPending()| yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
| 349 | show(); executed: show();Execution Count:5 | 5 |
| 350 | } executed: }Execution Count:5 | 5 |
| 351 | | - |
| 352 | /*! | - |
| 353 | \since 4.5 | - |
| 354 | \overload | - |
| 355 | | - |
| 356 | Shows the given message, \a message, and returns immediately. If the user | - |
| 357 | has requested for messages of type, \a type, not to be shown again, this | - |
| 358 | function does nothing. | - |
| 359 | | - |
| 360 | Normally, the message is displayed immediately. However, if there are | - |
| 361 | pending messages, it will be queued to be displayed later. | - |
| 362 | | - |
| 363 | \sa showMessage() | - |
| 364 | */ | - |
| 365 | | - |
| 366 | void QErrorMessage::showMessage(const QString &message, const QString &type) | - |
| 367 | { | - |
| 368 | Q_D(QErrorMessage); executed (the execution status of this line is deduced): QErrorMessagePrivate * const d = d_func(); | - |
| 369 | if (d->doNotShow.contains(message) && d->doNotShowType.contains(type)) partially evaluated: d->doNotShow.contains(message)| no Evaluation Count:0 | yes Evaluation Count:7 |
never evaluated: d->doNotShowType.contains(type) | 0-7 |
| 370 | return; | 0 |
| 371 | d->pending.push_back(qMakePair(message,type)); executed (the execution status of this line is deduced): d->pending.push_back(qMakePair(message,type)); | - |
| 372 | if (!isVisible() && d->nextPending()) evaluated: !isVisible()| yes Evaluation Count:6 | yes Evaluation Count:1 |
evaluated: d->nextPending()| yes Evaluation Count:4 | yes Evaluation Count:2 |
| 1-6 |
| 373 | show(); executed: show();Execution Count:4 | 4 |
| 374 | } executed: }Execution Count:7 | 7 |
| 375 | | - |
| 376 | /*! | - |
| 377 | \reimp | - |
| 378 | */ | - |
| 379 | void QErrorMessage::changeEvent(QEvent *e) | - |
| 380 | { | - |
| 381 | Q_D(QErrorMessage); never executed (the execution status of this line is deduced): QErrorMessagePrivate * const d = d_func(); | - |
| 382 | if (e->type() == QEvent::LanguageChange) { never evaluated: e->type() == QEvent::LanguageChange | 0 |
| 383 | d->retranslateStrings(); never executed (the execution status of this line is deduced): d->retranslateStrings(); | - |
| 384 | } | 0 |
| 385 | QDialog::changeEvent(e); never executed (the execution status of this line is deduced): QDialog::changeEvent(e); | - |
| 386 | } | 0 |
| 387 | | - |
| 388 | void QErrorMessagePrivate::retranslateStrings() | - |
| 389 | { | - |
| 390 | again->setText(QErrorMessage::tr("&Show this message again")); executed (the execution status of this line is deduced): again->setText(QErrorMessage::tr("&Show this message again")); | - |
| 391 | ok->setText(QErrorMessage::tr("&OK")); executed (the execution status of this line is deduced): ok->setText(QErrorMessage::tr("&OK")); | - |
| 392 | } executed: }Execution Count:2 | 2 |
| 393 | | - |
| 394 | QT_END_NAMESPACE | - |
| 395 | | - |
| 396 | #endif // QT_NO_ERRORMESSAGE | - |
| 397 | | - |
| | |