summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qdialog.cpp14
-rw-r--r--src/widgets/doc/snippets/dialogs/dialogs.cpp27
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp2
3 files changed, 37 insertions, 6 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index f29f1dfded..aa5e5f6d54 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -299,7 +299,8 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
\section1 Escape Key
If the user presses the Esc key in a dialog, QDialog::reject()
- will be called. This will cause the window to close: The \l{QCloseEvent}{close event} cannot be \l{QEvent::ignore()}{ignored}.
+ will be called. This will cause the window to close:
+ The \l{QCloseEvent}{close event} cannot be \l{QEvent::ignore()}{ignored}.
\section1 Extensibility
@@ -307,9 +308,8 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
partial dialog that shows the most commonly used options, and a
full dialog that shows all the options. Typically an extensible
dialog will initially appear as a partial dialog, but with a
- \uicontrol More toggle button. If the user presses the \uicontrol More button down,
- the dialog is expanded. The \l{Extension Example} shows how to achieve
- extensible dialogs using Qt.
+ \uicontrol More toggle button. If the user presses the
+ \uicontrol More button down, the dialog is expanded.
\target return
\section1 Return Value (Modal Dialogs)
@@ -339,7 +339,11 @@ QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const
\snippet dialogs/dialogs.cpp 0
- \sa QDialogButtonBox, QTabWidget, QWidget, QProgressDialog, {Extension Example},
+ A dialog with an extension:
+
+ \snippet dialogs/dialogs.cpp extension
+
+ \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 441ca8f795..16b136df4b 100644
--- a/src/widgets/doc/snippets/dialogs/dialogs.cpp
+++ b/src/widgets/doc/snippets/dialogs/dialogs.cpp
@@ -227,6 +227,33 @@ void Operation::cancel()
}
//! [6]
+void extension()
+{
+ using ExtendedControls = QWidget;
+ QPushButton *findButton;
+ QPushButton *moreButton;
+ QWidget *extension;
+ QVBoxLayout *mainLayout;
+
+//! [extension]
+ findButton = new QPushButton(tr("&Find"));
+ moreButton = new QPushButton(tr("&More..."));
+ moreButton->setCheckable(true);
+
+ extension = new ExtendedControls;
+ mainLayout->addWidget(extension);
+ extension->hide();
+
+ connect(moreButton, &QAbstractButton::toggled, extension, &QWidget::setVisible);
+//! [extension]
+
+//! [buttonbox]
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Vertical);
+ buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
+ buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
+//! [buttonbox]
+}
+
int main()
{
}
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 1f8bdc0f94..5afecc8d0a 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
the buttons (or button texts) yourself and add them to the button box,
specifying their role.
- \snippet dialogs/extension/finddialog.cpp 1
+ \snippet dialogs/dialogs.cpp buttonbox
Alternatively, QDialogButtonBox provides several standard buttons (e.g. OK, Cancel, Save)
that you can use. They exist as flags so you can OR them together in the constructor.