From 11da92ba94570e5eec01597fe09f0a9a48acc677 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 16 May 2023 14:17:35 +0200 Subject: Convert "extension" dialog example into snippets Pick-to: 6.5 Task-number: QTBUG-108751 Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4 Reviewed-by: Axel Spoerl --- doc/src/images/extension-example.png | Bin 9929 -> 0 bytes doc/src/images/extension_more.png | Bin 13523 -> 0 bytes examples/widgets/dialogs/CMakeLists.txt | 1 - examples/widgets/dialogs/dialogs.pro | 1 - examples/widgets/dialogs/extension/CMakeLists.txt | 37 ------- examples/widgets/dialogs/extension/extension.pro | 9 -- examples/widgets/dialogs/extension/finddialog.cpp | 77 ------------- examples/widgets/dialogs/extension/finddialog.h | 41 ------- examples/widgets/dialogs/extension/main.cpp | 16 --- examples/widgets/doc/src/extension.qdoc | 121 --------------------- src/widgets/dialogs/qdialog.cpp | 14 ++- src/widgets/doc/snippets/dialogs/dialogs.cpp | 27 +++++ src/widgets/widgets/qdialogbuttonbox.cpp | 2 +- .../widgets/dialogs/extension/CMakeLists.txt | 37 +++++++ .../widgets/dialogs/extension/extension.pro | 9 ++ .../widgets/dialogs/extension/finddialog.cpp | 77 +++++++++++++ .../widgets/dialogs/extension/finddialog.h | 41 +++++++ .../examples/widgets/dialogs/extension/main.cpp | 16 +++ 18 files changed, 217 insertions(+), 309 deletions(-) delete mode 100644 doc/src/images/extension-example.png delete mode 100644 doc/src/images/extension_more.png delete mode 100644 examples/widgets/dialogs/extension/CMakeLists.txt delete mode 100644 examples/widgets/dialogs/extension/extension.pro delete mode 100644 examples/widgets/dialogs/extension/finddialog.cpp delete mode 100644 examples/widgets/dialogs/extension/finddialog.h delete mode 100644 examples/widgets/dialogs/extension/main.cpp delete mode 100644 examples/widgets/doc/src/extension.qdoc create mode 100644 tests/manual/examples/widgets/dialogs/extension/CMakeLists.txt create mode 100644 tests/manual/examples/widgets/dialogs/extension/extension.pro create mode 100644 tests/manual/examples/widgets/dialogs/extension/finddialog.cpp create mode 100644 tests/manual/examples/widgets/dialogs/extension/finddialog.h create mode 100644 tests/manual/examples/widgets/dialogs/extension/main.cpp diff --git a/doc/src/images/extension-example.png b/doc/src/images/extension-example.png deleted file mode 100644 index 18fab52825..0000000000 Binary files a/doc/src/images/extension-example.png and /dev/null differ diff --git a/doc/src/images/extension_more.png b/doc/src/images/extension_more.png deleted file mode 100644 index 407af27cab..0000000000 Binary files a/doc/src/images/extension_more.png and /dev/null differ diff --git a/examples/widgets/dialogs/CMakeLists.txt b/examples/widgets/dialogs/CMakeLists.txt index a4031a6807..c40dc94ccb 100644 --- a/examples/widgets/dialogs/CMakeLists.txt +++ b/examples/widgets/dialogs/CMakeLists.txt @@ -5,7 +5,6 @@ if(QT_FEATURE_wizard) qt_internal_add_example(classwizard) qt_internal_add_example(trivialwizard) endif() -qt_internal_add_example(extension) qt_internal_add_example(standarddialogs) qt_internal_add_example(tabdialog) if(QT_FEATURE_wizard AND TARGET Qt6::PrintSupport) diff --git a/examples/widgets/dialogs/dialogs.pro b/examples/widgets/dialogs/dialogs.pro index 1983c854a1..14dbec67b6 100644 --- a/examples/widgets/dialogs/dialogs.pro +++ b/examples/widgets/dialogs/dialogs.pro @@ -2,7 +2,6 @@ QT_FOR_CONFIG += widgets TEMPLATE = subdirs SUBDIRS = classwizard \ - extension \ licensewizard \ standarddialogs \ tabdialog \ diff --git a/examples/widgets/dialogs/extension/CMakeLists.txt b/examples/widgets/dialogs/extension/CMakeLists.txt deleted file mode 100644 index 8dd008cc20..0000000000 --- a/examples/widgets/dialogs/extension/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -cmake_minimum_required(VERSION 3.16) -project(extension LANGUAGES CXX) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/extension") - -find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) - -qt_standard_project_setup() - -qt_add_executable(extension - finddialog.cpp finddialog.h - main.cpp -) - -set_target_properties(extension PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(extension PRIVATE - Qt6::Core - Qt6::Gui - Qt6::Widgets -) - -install(TARGETS extension - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/widgets/dialogs/extension/extension.pro b/examples/widgets/dialogs/extension/extension.pro deleted file mode 100644 index f51052cd56..0000000000 --- a/examples/widgets/dialogs/extension/extension.pro +++ /dev/null @@ -1,9 +0,0 @@ -QT += widgets - -HEADERS = finddialog.h -SOURCES = finddialog.cpp \ - main.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/extension -INSTALLS += target diff --git a/examples/widgets/dialogs/extension/finddialog.cpp b/examples/widgets/dialogs/extension/finddialog.cpp deleted file mode 100644 index f6b5943467..0000000000 --- a/examples/widgets/dialogs/extension/finddialog.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include - -#include "finddialog.h" - -//! [0] -FindDialog::FindDialog(QWidget *parent) - : QDialog(parent) -{ - label = new QLabel(tr("Find &what:")); - lineEdit = new QLineEdit; - label->setBuddy(lineEdit); - - caseCheckBox = new QCheckBox(tr("Match &case")); - fromStartCheckBox = new QCheckBox(tr("Search from &start")); - fromStartCheckBox->setChecked(true); - -//! [1] - findButton = new QPushButton(tr("&Find")); - findButton->setDefault(true); - - moreButton = new QPushButton(tr("&More")); - moreButton->setCheckable(true); -//! [0] - moreButton->setAutoDefault(false); - -//! [1] - -//! [2] - extension = new QWidget; - - wholeWordsCheckBox = new QCheckBox(tr("&Whole words")); - backwardCheckBox = new QCheckBox(tr("Search &backward")); - searchSelectionCheckBox = new QCheckBox(tr("Search se&lection")); -//! [2] - -//! [3] - buttonBox = new QDialogButtonBox(Qt::Vertical); - buttonBox->addButton(findButton, QDialogButtonBox::ActionRole); - buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole); - - connect(moreButton, &QAbstractButton::toggled, extension, &QWidget::setVisible); - - QVBoxLayout *extensionLayout = new QVBoxLayout; - extensionLayout->setContentsMargins(QMargins()); - extensionLayout->addWidget(wholeWordsCheckBox); - extensionLayout->addWidget(backwardCheckBox); - extensionLayout->addWidget(searchSelectionCheckBox); - extension->setLayout(extensionLayout); -//! [3] - -//! [4] - QHBoxLayout *topLeftLayout = new QHBoxLayout; - topLeftLayout->addWidget(label); - topLeftLayout->addWidget(lineEdit); - - QVBoxLayout *leftLayout = new QVBoxLayout; - leftLayout->addLayout(topLeftLayout); - leftLayout->addWidget(caseCheckBox); - leftLayout->addWidget(fromStartCheckBox); - - QGridLayout *mainLayout = new QGridLayout; - mainLayout->setSizeConstraint(QLayout::SetFixedSize); - mainLayout->addLayout(leftLayout, 0, 0); - mainLayout->addWidget(buttonBox, 0, 1); - mainLayout->addWidget(extension, 1, 0, 1, 2); - mainLayout->setRowStretch(2, 1); - - setLayout(mainLayout); - - setWindowTitle(tr("Extension")); -//! [4] //! [5] - extension->hide(); -} -//! [5] diff --git a/examples/widgets/dialogs/extension/finddialog.h b/examples/widgets/dialogs/extension/finddialog.h deleted file mode 100644 index 61bc442f46..0000000000 --- a/examples/widgets/dialogs/extension/finddialog.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#ifndef FINDDIALOG_H -#define FINDDIALOG_H - -#include - -QT_BEGIN_NAMESPACE -class QCheckBox; -class QDialogButtonBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -QT_END_NAMESPACE - -//! [0] -class FindDialog : public QDialog -{ - Q_OBJECT - -public: - FindDialog(QWidget *parent = nullptr); - -private: - QLabel *label; - QLineEdit *lineEdit; - QCheckBox *caseCheckBox; - QCheckBox *fromStartCheckBox; - QCheckBox *wholeWordsCheckBox; - QCheckBox *searchSelectionCheckBox; - QCheckBox *backwardCheckBox; - QDialogButtonBox *buttonBox; - QPushButton *findButton; - QPushButton *moreButton; - QWidget *extension; -}; -//! [0] - -#endif diff --git a/examples/widgets/dialogs/extension/main.cpp b/examples/widgets/dialogs/extension/main.cpp deleted file mode 100644 index 730a0347f4..0000000000 --- a/examples/widgets/dialogs/extension/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include - -#include "finddialog.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - FindDialog dialog; - - dialog.show(); - - return app.exec(); -} diff --git a/examples/widgets/doc/src/extension.qdoc b/examples/widgets/doc/src/extension.qdoc deleted file mode 100644 index 8f35e0e196..0000000000 --- a/examples/widgets/doc/src/extension.qdoc +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only - -/*! - \example dialogs/extension - \title Extension Example - \ingroup examples-dialogs - - \brief The Extension example shows how to add an extension to a QDialog - using the QAbstractButton::toggled() signal and the - QWidget::setVisible() slot. - - \image extension-example.png Screenshot of the Extension example - - The Extension application lets the user add search parameters in - a dialog and launch a simple or advanced search. - - The simple search has two options: \uicontrol {Match case} and \uicontrol - {Search from start}. The advanced search offers search for \uicontrol {Whole words}, - \uicontrol {Search backward}, and \uicontrol {Search selection}. The - application starts with simple search as the default. Click the \uicontrol More button - to show the advanced search options: - - \image extension_more.png Screenshot of the Extension example - - \section1 FindDialog Class Definition - - The \c FindDialog class inherits QDialog. QDialog is the - base class for dialog windows. A dialog window is a top-level - window mostly used for short-term tasks and brief communications - with the user. - - \snippet dialogs/extension/finddialog.h 0 - - The \c FindDialog widget is the main application widget, and - displays the application's search options and controlling - buttons. - - In addition to the constructor, there are several child widgets: - - \list - \li A QLineEdit with an associated QLabel to let the - user type a word to search for. - \li Several \l {QCheckBox}{QCheckBox}es to facilitate the search options. - \li Three \l {QPushButton}{QPushButton}s: - \list - \li the \uicontrol Find button to start a search - \li the \uicontrol More button to enable an advanced search - \li a QWidget representing the application's extension part - \endlist - \endlist - - \section1 FindDialog Class Implementation - - Create the standard child widgets for the simple search in the constructor: - the QLineEdit with the associated QLabel, two {QCheckBox}es and all the - \l {QPushButton}{QPushButton}s. - - \snippet dialogs/extension/finddialog.cpp 0 - - This snippet illustrates how you can define a shortcut key - for a widget. A shortcut should be defined by putting the ampersand - character (\c &) in front of the letter that should - become the shortcut. - For example, for \uicontrol {Find what}, pressing \uicontrol Alt - and \uicontrol w transfers focus to the QLineEdit widget. - Shortcuts can also be used for checking on or off a checkmark. - For example, pressing \uicontrol Alt and \uicontrol c puts the check mark - on \uicontrol {Match Case} if it was unchecked and vice versa. - It is the QLabel::setBuddy() method that links a widget to the shortcut - character if it has been defined. - - Set the \uicontrol Find button's default property to true, using the - QPushButton::setDefault() function. Then the push button will be - pressed if the user presses the Enter (or Return) key. Note that a - QDialog can only have one default button. - - \snippet dialogs/extension/finddialog.cpp 2 - - Create the extension widget, and the \l {QCheckBox}{QCheckBox}es associated - with the advanced search options. - - \snippet dialogs/extension/finddialog.cpp 3 - - Now that the extension widget is created, connect the \uicontrol - More button's \l{QAbstractButton::toggled()}{toggled()} signal to - the extension widget's \l{QWidget::setVisible()}{setVisible()} slot. - - The QAbstractButton::toggled() signal is emitted whenever a - checkable button changes its state. The signal's argument is true - if the button is checked, or false if the button is unchecked. The - QWidget::setVisible() slot sets the widget's visible status. If - the status is true the widget is shown, otherwise the widget is - hidden. - - Since the \uicontrol More button is checkable, the connection makes - sure that the extension widget is shown depending on the state of - the \uicontrol More button. - - Create checkboxes associated with the advanced search options in - a layout installed on the extension widget. - - \snippet dialogs/extension/finddialog.cpp 4 - - Before creating the main layout, create several child layouts - for the widgets. First align the QLabel and its buddy, the - QLineEdit, using a QHBoxLayout. Then align the QLabel and the QLineEdit - vertically with the checkboxes associated with the simple search, - using a QVBoxLayout. Create also a QVBoxLayout for the buttons. - Finally, lay out the two latter layouts and the extension widget - using a QGridLayout. - - \snippet dialogs/extension/finddialog.cpp 5 - - Hide the extension widget using the QWidget::hide() - function, making the application only show the simple search - options when it starts. When the user wants to access the advanced - search options, the dialog only needs to change the visibility of - the extension widget. Qt's layout management takes care of the - dialog's appearance. -*/ 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. diff --git a/tests/manual/examples/widgets/dialogs/extension/CMakeLists.txt b/tests/manual/examples/widgets/dialogs/extension/CMakeLists.txt new file mode 100644 index 0000000000..8dd008cc20 --- /dev/null +++ b/tests/manual/examples/widgets/dialogs/extension/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) +project(extension LANGUAGES CXX) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/extension") + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) + +qt_standard_project_setup() + +qt_add_executable(extension + finddialog.cpp finddialog.h + main.cpp +) + +set_target_properties(extension PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) + +target_link_libraries(extension PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Widgets +) + +install(TARGETS extension + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/tests/manual/examples/widgets/dialogs/extension/extension.pro b/tests/manual/examples/widgets/dialogs/extension/extension.pro new file mode 100644 index 0000000000..f51052cd56 --- /dev/null +++ b/tests/manual/examples/widgets/dialogs/extension/extension.pro @@ -0,0 +1,9 @@ +QT += widgets + +HEADERS = finddialog.h +SOURCES = finddialog.cpp \ + main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/extension +INSTALLS += target diff --git a/tests/manual/examples/widgets/dialogs/extension/finddialog.cpp b/tests/manual/examples/widgets/dialogs/extension/finddialog.cpp new file mode 100644 index 0000000000..f6b5943467 --- /dev/null +++ b/tests/manual/examples/widgets/dialogs/extension/finddialog.cpp @@ -0,0 +1,77 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include + +#include "finddialog.h" + +//! [0] +FindDialog::FindDialog(QWidget *parent) + : QDialog(parent) +{ + label = new QLabel(tr("Find &what:")); + lineEdit = new QLineEdit; + label->setBuddy(lineEdit); + + caseCheckBox = new QCheckBox(tr("Match &case")); + fromStartCheckBox = new QCheckBox(tr("Search from &start")); + fromStartCheckBox->setChecked(true); + +//! [1] + findButton = new QPushButton(tr("&Find")); + findButton->setDefault(true); + + moreButton = new QPushButton(tr("&More")); + moreButton->setCheckable(true); +//! [0] + moreButton->setAutoDefault(false); + +//! [1] + +//! [2] + extension = new QWidget; + + wholeWordsCheckBox = new QCheckBox(tr("&Whole words")); + backwardCheckBox = new QCheckBox(tr("Search &backward")); + searchSelectionCheckBox = new QCheckBox(tr("Search se&lection")); +//! [2] + +//! [3] + buttonBox = new QDialogButtonBox(Qt::Vertical); + buttonBox->addButton(findButton, QDialogButtonBox::ActionRole); + buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole); + + connect(moreButton, &QAbstractButton::toggled, extension, &QWidget::setVisible); + + QVBoxLayout *extensionLayout = new QVBoxLayout; + extensionLayout->setContentsMargins(QMargins()); + extensionLayout->addWidget(wholeWordsCheckBox); + extensionLayout->addWidget(backwardCheckBox); + extensionLayout->addWidget(searchSelectionCheckBox); + extension->setLayout(extensionLayout); +//! [3] + +//! [4] + QHBoxLayout *topLeftLayout = new QHBoxLayout; + topLeftLayout->addWidget(label); + topLeftLayout->addWidget(lineEdit); + + QVBoxLayout *leftLayout = new QVBoxLayout; + leftLayout->addLayout(topLeftLayout); + leftLayout->addWidget(caseCheckBox); + leftLayout->addWidget(fromStartCheckBox); + + QGridLayout *mainLayout = new QGridLayout; + mainLayout->setSizeConstraint(QLayout::SetFixedSize); + mainLayout->addLayout(leftLayout, 0, 0); + mainLayout->addWidget(buttonBox, 0, 1); + mainLayout->addWidget(extension, 1, 0, 1, 2); + mainLayout->setRowStretch(2, 1); + + setLayout(mainLayout); + + setWindowTitle(tr("Extension")); +//! [4] //! [5] + extension->hide(); +} +//! [5] diff --git a/tests/manual/examples/widgets/dialogs/extension/finddialog.h b/tests/manual/examples/widgets/dialogs/extension/finddialog.h new file mode 100644 index 0000000000..61bc442f46 --- /dev/null +++ b/tests/manual/examples/widgets/dialogs/extension/finddialog.h @@ -0,0 +1,41 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef FINDDIALOG_H +#define FINDDIALOG_H + +#include + +QT_BEGIN_NAMESPACE +class QCheckBox; +class QDialogButtonBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +QT_END_NAMESPACE + +//! [0] +class FindDialog : public QDialog +{ + Q_OBJECT + +public: + FindDialog(QWidget *parent = nullptr); + +private: + QLabel *label; + QLineEdit *lineEdit; + QCheckBox *caseCheckBox; + QCheckBox *fromStartCheckBox; + QCheckBox *wholeWordsCheckBox; + QCheckBox *searchSelectionCheckBox; + QCheckBox *backwardCheckBox; + QDialogButtonBox *buttonBox; + QPushButton *findButton; + QPushButton *moreButton; + QWidget *extension; +}; +//! [0] + +#endif diff --git a/tests/manual/examples/widgets/dialogs/extension/main.cpp b/tests/manual/examples/widgets/dialogs/extension/main.cpp new file mode 100644 index 0000000000..730a0347f4 --- /dev/null +++ b/tests/manual/examples/widgets/dialogs/extension/main.cpp @@ -0,0 +1,16 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include + +#include "finddialog.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + FindDialog dialog; + + dialog.show(); + + return app.exec(); +} -- cgit v1.2.1