| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | static const int defaultShowTime = 4000; | - |
| 10 | | - |
| 11 | static const int minWaitTime = 50; | - |
| 12 | | - |
| 13 | class QProgressDialogPrivate : public QDialogPrivate | - |
| 14 | { | - |
| 15 | inline QProgressDialog* q_func() { return static_cast<QProgressDialog *>(q_ptr); } inline const QProgressDialog* q_func() const { return static_cast<const QProgressDialog *>(q_ptr); } friend class QProgressDialog; | - |
| 16 | | - |
| 17 | public: | - |
| 18 | QProgressDialogPrivate() : label(0), cancel(0), bar(0), | - |
| 19 | shown_once(false), | - |
| 20 | cancellation_flag(false), | - |
| 21 | showTime(defaultShowTime), | - |
| 22 | | - |
| 23 | escapeShortcut(0), | - |
| 24 | | - |
| 25 | useDefaultCancelText(false) | - |
| 26 | { | - |
| 27 | } executed: }Execution Count:4 | 4 |
| 28 | | - |
| 29 | void init(const QString &labelText, const QString &cancelText, int min, int max); | - |
| 30 | void layout(); | - |
| 31 | void retranslateStrings(); | - |
| 32 | void _q_disconnectOnClose(); | - |
| 33 | | - |
| 34 | QLabel *label; | - |
| 35 | QPushButton *cancel; | - |
| 36 | QProgressBar *bar; | - |
| 37 | QTimer *forceTimer; | - |
| 38 | bool shown_once; | - |
| 39 | bool cancellation_flag; | - |
| 40 | QElapsedTimer starttime; | - |
| 41 | | - |
| 42 | QCursor parentCursor; | - |
| 43 | | - |
| 44 | int showTime; | - |
| 45 | bool autoClose; | - |
| 46 | bool autoReset; | - |
| 47 | bool forceHide; | - |
| 48 | | - |
| 49 | QShortcut *escapeShortcut; | - |
| 50 | | - |
| 51 | bool useDefaultCancelText; | - |
| 52 | QPointer<QObject> receiverToDisconnectOnClose; | - |
| 53 | QByteArray memberToDisconnectOnClose; | - |
| 54 | }; | - |
| 55 | | - |
| 56 | void QProgressDialogPrivate::init(const QString &labelText, const QString &cancelText, | - |
| 57 | int min, int max) | - |
| 58 | { | - |
| 59 | QProgressDialog * const q = q_func(); | - |
| 60 | label = new QLabel(labelText, q); | - |
| 61 | int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q); | - |
| 62 | label->setAlignment(Qt::Alignment(align)); | - |
| 63 | bar = new QProgressBar(q); | - |
| 64 | bar->setRange(min, max); | - |
| 65 | autoClose = true; | - |
| 66 | autoReset = true; | - |
| 67 | forceHide = false; | - |
| 68 | QObject::connect(q, "2""canceled()", q, "1""cancel()"); | - |
| 69 | forceTimer = new QTimer(q); | - |
| 70 | QObject::connect(forceTimer, "2""timeout()", q, "1""forceShow()"); | - |
| 71 | if (useDefaultCancelText) { evaluated: useDefaultCancelText| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 72 | retranslateStrings(); | - |
| 73 | } else { executed: }Execution Count:3 | 3 |
| 74 | q->setCancelButtonText(cancelText); | - |
| 75 | } executed: }Execution Count:1 | 1 |
| 76 | } | - |
| 77 | | - |
| 78 | void QProgressDialogPrivate::layout() | - |
| 79 | { | - |
| 80 | QProgressDialog * const q = q_func(); | - |
| 81 | int sp = q->style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); | - |
| 82 | int mtb = q->style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin); | - |
| 83 | int mlr = qMin(q->width() / 10, mtb); | - |
| 84 | const bool centered = | - |
| 85 | bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q)); | - |
| 86 | | - |
| 87 | int additionalSpacing = 0; | - |
| 88 | QSize cs = cancel ? cancel->sizeHint() : QSize(0,0); partially evaluated: cancel| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 89 | QSize bh = bar->sizeHint(); | - |
| 90 | int cspc; | - |
| 91 | int lh = 0; | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | for (int attempt=5; attempt--;) { partially evaluated: attempt--| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 96 | cspc = cancel ? cs.height() + sp : 0; partially evaluated: cancel| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 97 | lh = qMax(0, q->height() - mtb - bh.height() - sp - cspc); | - |
| 98 | | - |
| 99 | if (lh < q->height()/4) { partially evaluated: lh < q->height()/4| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 100 | | - |
| 101 | sp /= 2; | - |
| 102 | mtb /= 2; | - |
| 103 | if (cancel) { | 0 |
| 104 | cs.setHeight(qMax(4,cs.height()-sp-2)); | - |
| 105 | } | 0 |
| 106 | bh.setHeight(qMax(4,bh.height()-sp-1)); | - |
| 107 | } else { | 0 |
| 108 | break; executed: break;Execution Count:6 | 6 |
| 109 | } | - |
| 110 | } | - |
| 111 | | - |
| 112 | if (cancel) { partially evaluated: cancel| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 113 | cancel->setGeometry( | - |
| 114 | centered ? q->width()/2 - cs.width()/2 : q->width() - mlr - cs.width(), | - |
| 115 | q->height() - mtb - cs.height(), | - |
| 116 | cs.width(), cs.height()); | - |
| 117 | } executed: }Execution Count:6 | 6 |
| 118 | | - |
| 119 | if (label) partially evaluated: label| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 120 | label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh); executed: label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh);Execution Count:6 | 6 |
| 121 | bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height()); | - |
| 122 | } executed: }Execution Count:6 | 6 |
| 123 | | - |
| 124 | void QProgressDialogPrivate::retranslateStrings() | - |
| 125 | { | - |
| 126 | QProgressDialog * const q = q_func(); | - |
| 127 | if (useDefaultCancelText) partially evaluated: useDefaultCancelText| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 128 | q->setCancelButtonText(QProgressDialog::tr("Cancel")); executed: q->setCancelButtonText(QProgressDialog::tr("Cancel"));Execution Count:3 | 3 |
| 129 | } executed: }Execution Count:3 | 3 |
| 130 | | - |
| 131 | void QProgressDialogPrivate::_q_disconnectOnClose() | - |
| 132 | { | - |
| 133 | QProgressDialog * const q = q_func(); | - |
| 134 | if (receiverToDisconnectOnClose) { never evaluated: receiverToDisconnectOnClose | 0 |
| 135 | QObject::disconnect(q, "2""canceled()", receiverToDisconnectOnClose, | - |
| 136 | memberToDisconnectOnClose); | - |
| 137 | receiverToDisconnectOnClose = 0; | - |
| 138 | } | 0 |
| 139 | memberToDisconnectOnClose.clear(); | - |
| 140 | } | 0 |
| 141 | QProgressDialog::QProgressDialog(QWidget *parent, Qt::WindowFlags f) | - |
| 142 | : QDialog(*(new QProgressDialogPrivate), parent, f) | - |
| 143 | { | - |
| 144 | QProgressDialogPrivate * const d = d_func(); | - |
| 145 | d->useDefaultCancelText = true; | - |
| 146 | d->init(QString::fromLatin1(""), QString(), 0, 100); | - |
| 147 | } executed: }Execution Count:3 | 3 |
| 148 | QProgressDialog::QProgressDialog(const QString &labelText, | - |
| 149 | const QString &cancelButtonText, | - |
| 150 | int minimum, int maximum, | - |
| 151 | QWidget *parent, Qt::WindowFlags f) | - |
| 152 | : QDialog(*(new QProgressDialogPrivate), parent, f) | - |
| 153 | { | - |
| 154 | QProgressDialogPrivate * const d = d_func(); | - |
| 155 | d->init(labelText, cancelButtonText, minimum, maximum); | - |
| 156 | } executed: }Execution Count:1 | 1 |
| 157 | | - |
| 158 | | - |
| 159 | | - |
| 160 | | - |
| 161 | | - |
| 162 | | - |
| 163 | QProgressDialog::~QProgressDialog() | - |
| 164 | { | - |
| 165 | } | - |
| 166 | void QProgressDialog::setLabel(QLabel *label) | - |
| 167 | { | - |
| 168 | QProgressDialogPrivate * const d = d_func(); | - |
| 169 | delete d->label; | - |
| 170 | d->label = label; | - |
| 171 | if (label) { partially evaluated: label| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 172 | if (label->parentWidget() == this) { never evaluated: label->parentWidget() == this | 0 |
| 173 | label->hide(); | - |
| 174 | } else { | 0 |
| 175 | label->setParent(this, 0); | - |
| 176 | } | 0 |
| 177 | } | - |
| 178 | int w = qMax(isVisible() ? width() : 0, sizeHint().width()); | - |
| 179 | int h = qMax(isVisible() ? height() : 0, sizeHint().height()); | - |
| 180 | resize(w, h); | - |
| 181 | if (label) partially evaluated: label| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 182 | label->show(); never executed: label->show(); | 0 |
| 183 | } executed: }Execution Count:1 | 1 |
| 184 | QString QProgressDialog::labelText() const | - |
| 185 | { | - |
| 186 | const QProgressDialogPrivate * const d = d_func(); | - |
| 187 | if (d->label) never evaluated: d->label | 0 |
| 188 | return d->label->text(); never executed: return d->label->text(); | 0 |
| 189 | return QString(); never executed: return QString(); | 0 |
| 190 | } | - |
| 191 | | - |
| 192 | void QProgressDialog::setLabelText(const QString &text) | - |
| 193 | { | - |
| 194 | QProgressDialogPrivate * const d = d_func(); | - |
| 195 | if (d->label) { never evaluated: d->label | 0 |
| 196 | d->label->setText(text); | - |
| 197 | int w = qMax(isVisible() ? width() : 0, sizeHint().width()); | - |
| 198 | int h = qMax(isVisible() ? height() : 0, sizeHint().height()); | - |
| 199 | resize(w, h); | - |
| 200 | } | 0 |
| 201 | } | 0 |
| 202 | void QProgressDialog::setCancelButton(QPushButton *cancelButton) | - |
| 203 | { | - |
| 204 | QProgressDialogPrivate * const d = d_func(); | - |
| 205 | delete d->cancel; | - |
| 206 | d->cancel = cancelButton; | - |
| 207 | if (cancelButton) { partially evaluated: cancelButton| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 208 | if (cancelButton->parentWidget() == this) { partially evaluated: cancelButton->parentWidget() == this| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 209 | cancelButton->hide(); | - |
| 210 | } else { executed: }Execution Count:4 | 4 |
| 211 | cancelButton->setParent(this, 0); | - |
| 212 | } | 0 |
| 213 | connect(d->cancel, "2""clicked()", this, "2""canceled()"); | - |
| 214 | | - |
| 215 | d->escapeShortcut = new QShortcut(Qt::Key_Escape, this, "2""canceled()"); | - |
| 216 | | - |
| 217 | } else { executed: }Execution Count:4 | 4 |
| 218 | | - |
| 219 | delete d->escapeShortcut; | - |
| 220 | d->escapeShortcut = 0; | - |
| 221 | | - |
| 222 | } | 0 |
| 223 | int w = qMax(isVisible() ? width() : 0, sizeHint().width()); | - |
| 224 | int h = qMax(isVisible() ? height() : 0, sizeHint().height()); | - |
| 225 | resize(w, h); | - |
| 226 | if (cancelButton) partially evaluated: cancelButton| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 227 | cancelButton->show(); executed: cancelButton->show();Execution Count:4 | 4 |
| 228 | } executed: }Execution Count:4 | 4 |
| 229 | void QProgressDialog::setCancelButtonText(const QString &cancelButtonText) | - |
| 230 | { | - |
| 231 | QProgressDialogPrivate * const d = d_func(); | - |
| 232 | d->useDefaultCancelText = false; | - |
| 233 | | - |
| 234 | if (!cancelButtonText.isNull()) { partially evaluated: !cancelButtonText.isNull()| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 235 | if (d->cancel) { partially evaluated: d->cancel| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 236 | d->cancel->setText(cancelButtonText); | - |
| 237 | } else { | 0 |
| 238 | setCancelButton(new QPushButton(cancelButtonText, this)); | - |
| 239 | } executed: }Execution Count:4 | 4 |
| 240 | } else { | - |
| 241 | setCancelButton(0); | - |
| 242 | } | 0 |
| 243 | int w = qMax(isVisible() ? width() : 0, sizeHint().width()); | - |
| 244 | int h = qMax(isVisible() ? height() : 0, sizeHint().height()); | - |
| 245 | resize(w, h); | - |
| 246 | } executed: }Execution Count:4 | 4 |
| 247 | void QProgressDialog::setBar(QProgressBar *bar) | - |
| 248 | { | - |
| 249 | QProgressDialogPrivate * const d = d_func(); | - |
| 250 | if (!bar) { partially evaluated: !bar| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 251 | QMessageLogger("dialogs/qprogressdialog.cpp", 478, __PRETTY_FUNCTION__).warning("QProgressDialog::setBar: Cannot set a null progress bar"); | - |
| 252 | return; executed: return;Execution Count:1 | 1 |
| 253 | } | - |
| 254 | | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | | - |
| 259 | delete d->bar; | - |
| 260 | d->bar = bar; | - |
| 261 | int w = qMax(isVisible() ? width() : 0, sizeHint().width()); | - |
| 262 | int h = qMax(isVisible() ? height() : 0, sizeHint().height()); | - |
| 263 | resize(w, h); | - |
| 264 | } | 0 |
| 265 | | - |
| 266 | | - |
| 267 | | - |
| 268 | | - |
| 269 | | - |
| 270 | | - |
| 271 | | - |
| 272 | bool QProgressDialog::wasCanceled() const | - |
| 273 | { | - |
| 274 | const QProgressDialogPrivate * const d = d_func(); | - |
| 275 | return d->cancellation_flag; never executed: return d->cancellation_flag; | 0 |
| 276 | } | - |
| 277 | int QProgressDialog::maximum() const | - |
| 278 | { | - |
| 279 | const QProgressDialogPrivate * const d = d_func(); | - |
| 280 | return d->bar->maximum(); executed: return d->bar->maximum();Execution Count:3 | 3 |
| 281 | } | - |
| 282 | | - |
| 283 | void QProgressDialog::setMaximum(int maximum) | - |
| 284 | { | - |
| 285 | QProgressDialogPrivate * const d = d_func(); | - |
| 286 | d->bar->setMaximum(maximum); | - |
| 287 | } executed: }Execution Count:6 | 6 |
| 288 | int QProgressDialog::minimum() const | - |
| 289 | { | - |
| 290 | const QProgressDialogPrivate * const d = d_func(); | - |
| 291 | return d->bar->minimum(); executed: return d->bar->minimum();Execution Count:3 | 3 |
| 292 | } | - |
| 293 | | - |
| 294 | void QProgressDialog::setMinimum(int minimum) | - |
| 295 | { | - |
| 296 | QProgressDialogPrivate * const d = d_func(); | - |
| 297 | d->bar->setMinimum(minimum); | - |
| 298 | } executed: }Execution Count:4 | 4 |
| 299 | void QProgressDialog::setRange(int minimum, int maximum) | - |
| 300 | { | - |
| 301 | QProgressDialogPrivate * const d = d_func(); | - |
| 302 | d->bar->setRange(minimum, maximum); | - |
| 303 | } executed: }Execution Count:2 | 2 |
| 304 | void QProgressDialog::reset() | - |
| 305 | { | - |
| 306 | QProgressDialogPrivate * const d = d_func(); | - |
| 307 | | - |
| 308 | if (value() >= 0) { partially evaluated: value() >= 0| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 309 | if (parentWidget()) evaluated: parentWidget()| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
| 310 | parentWidget()->setCursor(d->parentCursor); executed: parentWidget()->setCursor(d->parentCursor);Execution Count:2 | 2 |
| 311 | } executed: }Execution Count:3 | 3 |
| 312 | | - |
| 313 | if (d->autoClose || d->forceHide) partially evaluated: d->autoClose| yes Evaluation Count:3 | no Evaluation Count:0 |
never evaluated: d->forceHide | 0-3 |
| 314 | hide(); executed: hide();Execution Count:3 | 3 |
| 315 | d->bar->reset(); | - |
| 316 | d->cancellation_flag = false; | - |
| 317 | d->shown_once = false; | - |
| 318 | d->forceTimer->stop(); | - |
| 319 | | - |
| 320 | | - |
| 321 | | - |
| 322 | | - |
| 323 | | - |
| 324 | | - |
| 325 | if (d->receiverToDisconnectOnClose) partially evaluated: d->receiverToDisconnectOnClose| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 326 | QMetaObject::invokeMethod(this, "_q_disconnectOnClose", Qt::QueuedConnection); never executed: QMetaObject::invokeMethod(this, "_q_disconnectOnClose", Qt::QueuedConnection); | 0 |
| 327 | } executed: }Execution Count:3 | 3 |
| 328 | | - |
| 329 | | - |
| 330 | | - |
| 331 | | - |
| 332 | | - |
| 333 | | - |
| 334 | | - |
| 335 | void QProgressDialog::cancel() | - |
| 336 | { | - |
| 337 | QProgressDialogPrivate * const d = d_func(); | - |
| 338 | d->forceHide = true; | - |
| 339 | reset(); | - |
| 340 | d->forceHide = false; | - |
| 341 | d->cancellation_flag = true; | - |
| 342 | } | 0 |
| 343 | | - |
| 344 | | - |
| 345 | int QProgressDialog::value() const | - |
| 346 | { | - |
| 347 | const QProgressDialogPrivate * const d = d_func(); | - |
| 348 | return d->bar->value(); executed: return d->bar->value();Execution Count:9 | 9 |
| 349 | } | - |
| 350 | void QProgressDialog::setValue(int progress) | - |
| 351 | { | - |
| 352 | QProgressDialogPrivate * const d = d_func(); | - |
| 353 | if (progress == d->bar->value() partially evaluated: progress == d->bar->value()| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 354 | || (d->bar->value() == -1 && progress == d->bar->maximum())) partially evaluated: d->bar->value() == -1| no Evaluation Count:0 | yes Evaluation Count:8 |
never evaluated: progress == d->bar->maximum() | 0-8 |
| 355 | return; | 0 |
| 356 | | - |
| 357 | d->bar->setValue(progress); | - |
| 358 | | - |
| 359 | if (d->shown_once) { partially evaluated: d->shown_once| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 360 | if (isModal()) never evaluated: isModal() | 0 |
| 361 | QApplication::processEvents(); never executed: QApplication::processEvents(); | 0 |
| 362 | } else { | 0 |
| 363 | if (progress == 0) { evaluated: progress == 0| yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
| 364 | d->starttime.start(); | - |
| 365 | d->forceTimer->start(d->showTime); | - |
| 366 | return; executed: return;Execution Count:1 | 1 |
| 367 | } else { | - |
| 368 | bool need_show; | - |
| 369 | int elapsed = d->starttime.elapsed(); | - |
| 370 | if (elapsed >= d->showTime) { evaluated: elapsed >= d->showTime| yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
| 371 | need_show = true; | - |
| 372 | } else { executed: }Execution Count:2 | 2 |
| 373 | if (elapsed > minWaitTime) { partially evaluated: elapsed > minWaitTime| no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
| 374 | int estimate; | - |
| 375 | int totalSteps = maximum() - minimum(); | - |
| 376 | int myprogress = progress - minimum(); | - |
| 377 | if ((totalSteps - myprogress) >= 2147483647 / elapsed) never evaluated: (totalSteps - myprogress) >= 2147483647 / elapsed | 0 |
| 378 | estimate = (totalSteps - myprogress) / myprogress * elapsed; never executed: estimate = (totalSteps - myprogress) / myprogress * elapsed; | 0 |
| 379 | else | - |
| 380 | estimate = elapsed * (totalSteps - myprogress) / myprogress; never executed: estimate = elapsed * (totalSteps - myprogress) / myprogress; | 0 |
| 381 | need_show = estimate >= d->showTime; | - |
| 382 | } else { | 0 |
| 383 | need_show = false; | - |
| 384 | } executed: }Execution Count:5 | 5 |
| 385 | } | - |
| 386 | if (need_show) { evaluated: need_show| yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
| 387 | int w = qMax(isVisible() ? width() : 0, sizeHint().width()); | - |
| 388 | int h = qMax(isVisible() ? height() : 0, sizeHint().height()); | - |
| 389 | resize(w, h); | - |
| 390 | show(); | - |
| 391 | d->shown_once = true; | - |
| 392 | } executed: }Execution Count:2 | 2 |
| 393 | } executed: }Execution Count:7 | 7 |
| 394 | | - |
| 395 | | - |
| 396 | | - |
| 397 | } | - |
| 398 | | - |
| 399 | if (progress == d->bar->maximum() && d->autoReset) evaluated: progress == d->bar->maximum()| yes Evaluation Count:4 | yes Evaluation Count:3 |
evaluated: d->autoReset| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-4 |
| 400 | reset(); executed: reset();Execution Count:3 | 3 |
| 401 | } executed: }Execution Count:7 | 7 |
| 402 | | - |
| 403 | | - |
| 404 | | - |
| 405 | | - |
| 406 | | - |
| 407 | | - |
| 408 | | - |
| 409 | QSize QProgressDialog::sizeHint() const | - |
| 410 | { | - |
| 411 | const QProgressDialogPrivate * const d = d_func(); | - |
| 412 | QSize sh = d->label ? d->label->sizeHint() : QSize(0, 0); evaluated: d->label| yes Evaluation Count:27 | yes Evaluation Count:3 |
| 3-27 |
| 413 | QSize bh = d->bar->sizeHint(); | - |
| 414 | int margin = style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin); | - |
| 415 | int spacing = style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); | - |
| 416 | int h = margin * 2 + bh.height() + sh.height() + spacing; | - |
| 417 | if (d->cancel) partially evaluated: d->cancel| yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
| 418 | h += d->cancel->sizeHint().height() + spacing; executed: h += d->cancel->sizeHint().height() + spacing;Execution Count:30 | 30 |
| 419 | return QSize(qMax(200, sh.width() + 2 * margin), h); executed: return QSize(qMax(200, sh.width() + 2 * margin), h);Execution Count:30 | 30 |
| 420 | } | - |
| 421 | | - |
| 422 | | - |
| 423 | | - |
| 424 | void QProgressDialog::resizeEvent(QResizeEvent *) | - |
| 425 | { | - |
| 426 | QProgressDialogPrivate * const d = d_func(); | - |
| 427 | d->layout(); | - |
| 428 | } executed: }Execution Count:6 | 6 |
| 429 | | - |
| 430 | | - |
| 431 | | - |
| 432 | | - |
| 433 | void QProgressDialog::changeEvent(QEvent *ev) | - |
| 434 | { | - |
| 435 | QProgressDialogPrivate * const d = d_func(); | - |
| 436 | if (ev->type() == QEvent::StyleChange) { partially evaluated: ev->type() == QEvent::StyleChange| no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
| 437 | d->layout(); | - |
| 438 | } else if (ev->type() == QEvent::LanguageChange) { partially evaluated: ev->type() == QEvent::LanguageChange| no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
| 439 | d->retranslateStrings(); | - |
| 440 | } | 0 |
| 441 | QDialog::changeEvent(ev); | - |
| 442 | } executed: }Execution Count:5 | 5 |
| 443 | void QProgressDialog::setMinimumDuration(int ms) | - |
| 444 | { | - |
| 445 | QProgressDialogPrivate * const d = d_func(); | - |
| 446 | d->showTime = ms; | - |
| 447 | if (d->bar->value() == 0) { partially evaluated: d->bar->value() == 0| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 448 | d->forceTimer->stop(); | - |
| 449 | d->forceTimer->start(ms); | - |
| 450 | } | 0 |
| 451 | } executed: }Execution Count:3 | 3 |
| 452 | | - |
| 453 | int QProgressDialog::minimumDuration() const | - |
| 454 | { | - |
| 455 | const QProgressDialogPrivate * const d = d_func(); | - |
| 456 | return d->showTime; executed: return d->showTime;Execution Count:3 | 3 |
| 457 | } | - |
| 458 | | - |
| 459 | | - |
| 460 | | - |
| 461 | | - |
| 462 | | - |
| 463 | | - |
| 464 | void QProgressDialog::closeEvent(QCloseEvent *e) | - |
| 465 | { | - |
| 466 | canceled(); | - |
| 467 | QDialog::closeEvent(e); | - |
| 468 | } | 0 |
| 469 | void QProgressDialog::setAutoReset(bool b) | - |
| 470 | { | - |
| 471 | QProgressDialogPrivate * const d = d_func(); | - |
| 472 | d->autoReset = b; | - |
| 473 | } executed: }Execution Count:4 | 4 |
| 474 | | - |
| 475 | bool QProgressDialog::autoReset() const | - |
| 476 | { | - |
| 477 | const QProgressDialogPrivate * const d = d_func(); | - |
| 478 | return d->autoReset; executed: return d->autoReset;Execution Count:2 | 2 |
| 479 | } | - |
| 480 | void QProgressDialog::setAutoClose(bool close) | - |
| 481 | { | - |
| 482 | QProgressDialogPrivate * const d = d_func(); | - |
| 483 | d->autoClose = close; | - |
| 484 | } executed: }Execution Count:2 | 2 |
| 485 | | - |
| 486 | bool QProgressDialog::autoClose() const | - |
| 487 | { | - |
| 488 | const QProgressDialogPrivate * const d = d_func(); | - |
| 489 | return d->autoClose; executed: return d->autoClose;Execution Count:2 | 2 |
| 490 | } | - |
| 491 | | - |
| 492 | | - |
| 493 | | - |
| 494 | | - |
| 495 | | - |
| 496 | void QProgressDialog::showEvent(QShowEvent *e) | - |
| 497 | { | - |
| 498 | QProgressDialogPrivate * const d = d_func(); | - |
| 499 | QDialog::showEvent(e); | - |
| 500 | int w = qMax(isVisible() ? width() : 0, sizeHint().width()); | - |
| 501 | int h = qMax(isVisible() ? height() : 0, sizeHint().height()); | - |
| 502 | resize(w, h); | - |
| 503 | d->forceTimer->stop(); | - |
| 504 | } executed: }Execution Count:3 | 3 |
| 505 | void QProgressDialog::forceShow() | - |
| 506 | { | - |
| 507 | QProgressDialogPrivate * const d = d_func(); | - |
| 508 | d->forceTimer->stop(); | - |
| 509 | if (d->shown_once || d->cancellation_flag) never evaluated: d->shown_once never evaluated: d->cancellation_flag | 0 |
| 510 | return; | 0 |
| 511 | | - |
| 512 | show(); | - |
| 513 | d->shown_once = true; | - |
| 514 | } | 0 |
| 515 | void QProgressDialog::open(QObject *receiver, const char *member) | - |
| 516 | { | - |
| 517 | QProgressDialogPrivate * const d = d_func(); | - |
| 518 | connect(this, "2""canceled()", receiver, member); | - |
| 519 | d->receiverToDisconnectOnClose = receiver; | - |
| 520 | d->memberToDisconnectOnClose = member; | - |
| 521 | QDialog::open(); | - |
| 522 | } | 0 |
| 523 | | - |
| 524 | | - |
| 525 | | - |
| 526 | | - |
| | |