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-20 03:37:59 +0000
commit6c3d51e05305f164174e6544a6641b1b4c98fffc (patch)
treeeced7f98c8a44f81f549960eea7f8b9b7d14a720 /src/widgets
parent975782483dde55dcb6b133c8d462a6f9c3379887 (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();
}