diff options
author | Volker Hilsheimer <[email protected]> | 2024-01-11 13:23:21 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2024-01-12 14:31:55 +0000 |
commit | 3ef97639ff04283c440ade2cfe2353660ff673b0 (patch) | |
tree | 05ff4f1a9d2bad19e0609faa5701a647b4c4515b | |
parent | bdaada60629d03f1c6013257311b82abc449dd1b (diff) |
Doc: complete the snippet for a dialog with extension
Add the setting of the layout's size constraint to 'fixed' back to the
snippet, so that the dialog automatically resizes when the extension
gets hidden. The user won't be able to resize the dialog, but allowing
the user to resize the dialog and to show and hide the extension anyway
leads to unpredictable results for the user.
Amends 11da92ba94570e5eec01597fe09f0a9a48acc677.
Change-Id: Ie74ca36eaa1a8e9567e0d5826f91f8633e5cbc05
Reviewed-by: David Faure <[email protected]>
(cherry picked from commit 51a1dfe72ddd922cd6caf28d532b3311db767989)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit 82105e82e553f9f8dbcdbaac177318fd590e40ab)
-rw-r--r-- | src/widgets/dialogs/qdialog.cpp | 4 | ||||
-rw-r--r-- | src/widgets/doc/snippets/dialogs/dialogs.cpp | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index a4c98139659..5fda6f05b03 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -324,6 +324,10 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const \snippet dialogs/dialogs.cpp extension + By setting the \l{QLayout::}{sizeConstraint} property of the dialog's + layout to \l{QLayout::}{SetFixedSize}, the dialog will not be resizable + by the user, and will automatically shrink when the extension gets hidden. + \sa QDialogButtonBox, QTabWidget, QWidget, QProgressDialog, {Standard Dialogs Example} */ diff --git a/src/widgets/doc/snippets/dialogs/dialogs.cpp b/src/widgets/doc/snippets/dialogs/dialogs.cpp index 16b136df4b8..0990d7d7c46 100644 --- a/src/widgets/doc/snippets/dialogs/dialogs.cpp +++ b/src/widgets/doc/snippets/dialogs/dialogs.cpp @@ -236,6 +236,8 @@ void extension() QVBoxLayout *mainLayout; //! [extension] + mainLayout->setSizeConstraint(QLayout::SetFixedSize); + findButton = new QPushButton(tr("&Find")); moreButton = new QPushButton(tr("&More...")); moreButton->setCheckable(true); |