summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-07-29 23:25:45 +0200
committerMarc Mutz <marc.mutz@kdab.com>2014-07-30 23:40:34 +0200
commitab79a8a76c6fae9d92b9b0718eee60d60c73ecc8 (patch)
treede1ff92bda4fa6ee84265d732a725420f1c6596c /src
parente2331c6f76bda6d19f3b4cb2b9e3cbbfe0bdc2f6 (diff)
QProgressDialog: Extract Method QProgressDialogPrivate::setCancelButtonText()
This is in preparation of a fix for the broken online-retranslatability of the cancel button. Change-Id: Ie62540766e50e1f1ec07d251cc56a2ee0745d434 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index b514b75324..d160ab0ae1 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -84,6 +84,7 @@ public:
void init(const QString &labelText, const QString &cancelText, int min, int max);
void layout();
void retranslateStrings();
+ void setCancelButtonText(const QString &cancelButtonText);
void _q_disconnectOnClose();
QLabel *label;
@@ -458,19 +459,25 @@ void QProgressDialog::setCancelButtonText(const QString &cancelButtonText)
{
Q_D(QProgressDialog);
d->useDefaultCancelText = false;
+ d->setCancelButtonText(cancelButtonText);
+}
+
+void QProgressDialogPrivate::setCancelButtonText(const QString &cancelButtonText)
+{
+ Q_Q(QProgressDialog);
if (!cancelButtonText.isNull()) {
- if (d->cancel) {
- d->cancel->setText(cancelButtonText);
+ if (cancel) {
+ cancel->setText(cancelButtonText);
} else {
- setCancelButton(new QPushButton(cancelButtonText, this));
+ q->setCancelButton(new QPushButton(cancelButtonText, q));
}
} else {
- setCancelButton(0);
+ q->setCancelButton(0);
}
- int w = qMax(isVisible() ? width() : 0, sizeHint().width());
- int h = qMax(isVisible() ? height() : 0, sizeHint().height());
- resize(w, h);
+ int w = qMax(q->isVisible() ? q->width() : 0, q->sizeHint().width());
+ int h = qMax(q->isVisible() ? q->height() : 0, q->sizeHint().height());
+ q->resize(w, h);
}