summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorQiang Li <liqianga@uniontech.com>2021-04-14 11:15:46 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-19 15:20:08 +0000
commit731768345ff211e60ac416e1ee7f0b3a192451d9 (patch)
tree4cb50c91759b58eabe365750b8cac17cfea09729 /src/widgets
parent0dcf8c232f327ea50573c57ae5ba2d6d72b9e7fb (diff)
Re-layout QProgressDialog when setting the cancel button
Setting a cancel button on QProgressDialog more than once caused the layout to be invalid. The layout was only applied when the dialog resizes or the style changes, but not when a new cancel button is set. The solution is to update the layout() before showing the dialog when adopting new child widgets. Fixes: QTBUG-19983 Change-Id: Id8fb1ac56e94a9bd97d4559a2e8d4835856fd7d0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 777053cfff40570282e861527e0e52e22a359629) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 32834291b8..448acfc7f9 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -485,6 +485,8 @@ void QProgressDialogPrivate::adoptChildWidget(QWidget *c)
c->setParent(q, { });
}
ensureSizeIsAtLeastSizeHint();
+ //The layout should be updated again to prevent layout errors when the new 'widget' is replaced
+ layout();
if (c)
c->show();
}