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