diff options
author | Liang Qi <[email protected]> | 2019-12-10 13:51:40 +0200 |
---|---|---|
committer | Liang Qi <[email protected]> | 2019-12-10 17:53:06 +0200 |
commit | 979b9335e5cec4a4556624dfab06d088b82cec36 (patch) | |
tree | ab2c9463ea3e4a529e52943a823093ee6901eb0f /src/widgets/dialogs/qprogressdialog.cpp | |
parent | 30e32870a052fda1a23099e46864242e52d94a17 (diff) | |
parent | 90210d5d9c4029057035019f144212922494ff0a (diff) |
Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"
Diffstat (limited to 'src/widgets/dialogs/qprogressdialog.cpp')
-rw-r--r-- | src/widgets/dialogs/qprogressdialog.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 94d3928c8b9..40548e22a53 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -708,14 +708,17 @@ void QProgressDialog::setValue(int progress) QSize QProgressDialog::sizeHint() const { Q_D(const QProgressDialog); - QSize sh = d->label ? d->label->sizeHint() : QSize(0, 0); - QSize bh = d->bar->sizeHint(); - int margin = style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin); - int spacing = style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); - int h = margin * 2 + bh.height() + sh.height() + spacing; + QSize labelSize = d->label ? d->label->sizeHint() : QSize(0, 0); + QSize barSize = d->bar->sizeHint(); + int marginBottom = style()->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, this); + int spacing = style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, 0, this); + int marginLeft = style()->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, this); + int marginRight = style()->pixelMetric(QStyle::PM_LayoutRightMargin, 0, this); + + int height = marginBottom * 2 + barSize.height() + labelSize.height() + spacing; if (d->cancel) - h += d->cancel->sizeHint().height() + spacing; - return QSize(qMax(200, sh.width() + 2 * margin), h); + height += d->cancel->sizeHint().height() + spacing; + return QSize(qMax(200, labelSize.width() + marginLeft + marginRight), height); } /*!\reimp |