summaryrefslogtreecommitdiffstats
path: root/examples/widgets/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/dialogs')
-rw-r--r--examples/widgets/dialogs/.prev_CMakeLists.txt13
-rw-r--r--examples/widgets/dialogs/CMakeLists.txt12
-rw-r--r--examples/widgets/dialogs/classwizard/CMakeLists.txt59
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.cpp441
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.h166
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.pro10
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.qrc11
-rw-r--r--examples/widgets/dialogs/classwizard/images/background.pngbin22578 -> 0 bytes
-rw-r--r--examples/widgets/dialogs/classwizard/images/banner.pngbin3947 -> 0 bytes
-rw-r--r--examples/widgets/dialogs/classwizard/images/logo1.pngbin1619 -> 0 bytes
-rw-r--r--examples/widgets/dialogs/classwizard/images/logo2.pngbin1619 -> 0 bytes
-rw-r--r--examples/widgets/dialogs/classwizard/images/logo3.pngbin1619 -> 0 bytes
-rw-r--r--examples/widgets/dialogs/classwizard/images/watermark1.pngbin14516 -> 0 bytes
-rw-r--r--examples/widgets/dialogs/classwizard/images/watermark2.pngbin14912 -> 0 bytes
-rw-r--r--examples/widgets/dialogs/classwizard/main.cpp75
-rw-r--r--examples/widgets/dialogs/dialogs.pro5
-rw-r--r--examples/widgets/dialogs/extension/CMakeLists.txt40
-rw-r--r--examples/widgets/dialogs/extension/extension.pro9
-rw-r--r--examples/widgets/dialogs/extension/finddialog.cpp124
-rw-r--r--examples/widgets/dialogs/extension/finddialog.h88
-rw-r--r--examples/widgets/dialogs/extension/main.cpp63
-rw-r--r--examples/widgets/dialogs/findfiles/CMakeLists.txt40
-rw-r--r--examples/widgets/dialogs/findfiles/findfiles.pro10
-rw-r--r--examples/widgets/dialogs/findfiles/main.cpp61
-rw-r--r--examples/widgets/dialogs/findfiles/window.cpp311
-rw-r--r--examples/widgets/dialogs/findfiles/window.h97
-rw-r--r--examples/widgets/dialogs/licensewizard/CMakeLists.txt48
-rw-r--r--examples/widgets/dialogs/licensewizard/licensewizard.cpp56
-rw-r--r--examples/widgets/dialogs/licensewizard/licensewizard.h51
-rw-r--r--examples/widgets/dialogs/licensewizard/main.cpp53
-rw-r--r--examples/widgets/dialogs/standarddialogs/CMakeLists.txt42
-rw-r--r--examples/widgets/dialogs/standarddialogs/dialog.cpp132
-rw-r--r--examples/widgets/dialogs/standarddialogs/dialog.h52
-rw-r--r--examples/widgets/dialogs/standarddialogs/main.cpp55
-rw-r--r--examples/widgets/dialogs/standarddialogs/main.mm47
-rw-r--r--examples/widgets/dialogs/tabdialog/CMakeLists.txt42
-rw-r--r--examples/widgets/dialogs/tabdialog/main.cpp51
-rw-r--r--examples/widgets/dialogs/tabdialog/tabdialog.cpp51
-rw-r--r--examples/widgets/dialogs/tabdialog/tabdialog.h51
-rw-r--r--examples/widgets/dialogs/trivialwizard/CMakeLists.txt42
-rw-r--r--examples/widgets/dialogs/trivialwizard/trivialwizard.cpp53
41 files changed, 207 insertions, 2254 deletions
diff --git a/examples/widgets/dialogs/.prev_CMakeLists.txt b/examples/widgets/dialogs/.prev_CMakeLists.txt
deleted file mode 100644
index 354424bf1f..0000000000
--- a/examples/widgets/dialogs/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated from dialogs.pro.
-
-if(QT_FEATURE_wizard)
- add_subdirectory(classwizard)
- add_subdirectory(trivialwizard)
-endif()
-add_subdirectory(extension)
-add_subdirectory(findfiles)
-add_subdirectory(standarddialogs)
-add_subdirectory(tabdialog)
-if(QT_FEATURE_wizard AND TARGET Qt::PrintSupport)
- add_subdirectory(licensewizard)
-endif()
diff --git a/examples/widgets/dialogs/CMakeLists.txt b/examples/widgets/dialogs/CMakeLists.txt
index 32f8bc29a8..3148d3585f 100644
--- a/examples/widgets/dialogs/CMakeLists.txt
+++ b/examples/widgets/dialogs/CMakeLists.txt
@@ -1,13 +1,11 @@
-# Generated from dialogs.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
if(QT_FEATURE_wizard)
- qt_internal_add_example(classwizard)
qt_internal_add_example(trivialwizard)
+ if(Qt6::PrintSupport)
+ qt_internal_add_example(licensewizard)
+ endif()
endif()
-qt_internal_add_example(extension)
-qt_internal_add_example(findfiles)
qt_internal_add_example(standarddialogs)
qt_internal_add_example(tabdialog)
-if(QT_FEATURE_wizard AND TARGET Qt::PrintSupport)
- qt_internal_add_example(licensewizard)
-endif()
diff --git a/examples/widgets/dialogs/classwizard/CMakeLists.txt b/examples/widgets/dialogs/classwizard/CMakeLists.txt
deleted file mode 100644
index b45c5bbc15..0000000000
--- a/examples/widgets/dialogs/classwizard/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# Generated from classwizard.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(classwizard LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/classwizard")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(classwizard
- classwizard.cpp classwizard.h
- main.cpp
-)
-set_target_properties(classwizard PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(classwizard PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(classwizard_resource_files
- "images/background.png"
- "images/banner.png"
- "images/logo1.png"
- "images/logo2.png"
- "images/logo3.png"
- "images/watermark1.png"
- "images/watermark2.png"
-)
-
-qt6_add_resources(classwizard "classwizard"
- PREFIX
- "/"
- FILES
- ${classwizard_resource_files}
-)
-
-install(TARGETS classwizard
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/dialogs/classwizard/classwizard.cpp b/examples/widgets/dialogs/classwizard/classwizard.cpp
deleted file mode 100644
index 8421289eab..0000000000
--- a/examples/widgets/dialogs/classwizard/classwizard.cpp
+++ /dev/null
@@ -1,441 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "classwizard.h"
-
-//! [0] //! [1]
-ClassWizard::ClassWizard(QWidget *parent)
- : QWizard(parent)
-{
- addPage(new IntroPage);
- addPage(new ClassInfoPage);
- addPage(new CodeStylePage);
- addPage(new OutputFilesPage);
- addPage(new ConclusionPage);
-//! [0]
-
- setPixmap(QWizard::BannerPixmap, QPixmap(":/images/banner.png"));
- setPixmap(QWizard::BackgroundPixmap, QPixmap(":/images/background.png"));
-
- setWindowTitle(tr("Class Wizard"));
-//! [2]
-}
-//! [1] //! [2]
-
-//! [3]
-void ClassWizard::accept()
-//! [3] //! [4]
-{
- QByteArray className = field("className").toByteArray();
- QByteArray baseClass = field("baseClass").toByteArray();
- QByteArray macroName = field("macroName").toByteArray();
- QByteArray baseInclude = field("baseInclude").toByteArray();
-
- QString outputDir = field("outputDir").toString();
- QString header = field("header").toString();
- QString implementation = field("implementation").toString();
-//! [4]
-
- QByteArray block;
-
- if (field("comment").toBool()) {
- block += "/*\n";
- block += " " + header.toLatin1() + '\n';
- block += "*/\n";
- block += '\n';
- }
- if (field("protect").toBool()) {
- block += "#ifndef " + macroName + '\n';
- block += "#define " + macroName + '\n';
- block += '\n';
- }
- if (field("includeBase").toBool()) {
- block += "#include " + baseInclude + '\n';
- block += '\n';
- }
-
- block += "class " + className;
- if (!baseClass.isEmpty())
- block += " : public " + baseClass;
- block += '\n';
- block += "{\n";
-
- /* qmake ignore Q_OBJECT */
-
- if (field("qobjectMacro").toBool()) {
- block += " Q_OBJECT\n";
- block += '\n';
- }
- block += "public:\n";
-
- if (field("qobjectCtor").toBool()) {
- block += " " + className + "(QObject *parent = nullptr);\n";
- } else if (field("qwidgetCtor").toBool()) {
- block += " " + className + "(QWidget *parent = nullptr);\n";
- } else if (field("defaultCtor").toBool()) {
- block += " " + className + "();\n";
- if (field("copyCtor").toBool()) {
- block += " " + className + "(const " + className + " &other);\n";
- block += '\n';
- block += " " + className + " &operator=" + "(const " + className
- + " &other);\n";
- }
- }
- block += "};\n";
-
- if (field("protect").toBool()) {
- block += '\n';
- block += "#endif\n";
- }
-
- QFile headerFile(outputDir + '/' + header);
- if (!headerFile.open(QFile::WriteOnly | QFile::Text)) {
- QMessageBox::warning(nullptr, QObject::tr("Simple Wizard"),
- QObject::tr("Cannot write file %1:\n%2")
- .arg(headerFile.fileName())
- .arg(headerFile.errorString()));
- return;
- }
- headerFile.write(block);
-
- block.clear();
-
- if (field("comment").toBool()) {
- block += "/*\n";
- block += " " + implementation.toLatin1() + '\n';
- block += "*/\n";
- block += '\n';
- }
- block += "#include \"" + header.toLatin1() + "\"\n";
- block += '\n';
-
- if (field("qobjectCtor").toBool()) {
- block += className + "::" + className + "(QObject *parent)\n";
- block += " : " + baseClass + "(parent)\n";
- block += "{\n";
- block += "}\n";
- } else if (field("qwidgetCtor").toBool()) {
- block += className + "::" + className + "(QWidget *parent)\n";
- block += " : " + baseClass + "(parent)\n";
- block += "{\n";
- block += "}\n";
- } else if (field("defaultCtor").toBool()) {
- block += className + "::" + className + "()\n";
- block += "{\n";
- block += " // missing code\n";
- block += "}\n";
-
- if (field("copyCtor").toBool()) {
- block += "\n";
- block += className + "::" + className + "(const " + className
- + " &other)\n";
- block += "{\n";
- block += " *this = other;\n";
- block += "}\n";
- block += '\n';
- block += className + " &" + className + "::operator=(const "
- + className + " &other)\n";
- block += "{\n";
- if (!baseClass.isEmpty())
- block += " " + baseClass + "::operator=(other);\n";
- block += " // missing code\n";
- block += " return *this;\n";
- block += "}\n";
- }
- }
-
- QFile implementationFile(outputDir + '/' + implementation);
- if (!implementationFile.open(QFile::WriteOnly | QFile::Text)) {
- QMessageBox::warning(nullptr, QObject::tr("Simple Wizard"),
- QObject::tr("Cannot write file %1:\n%2")
- .arg(implementationFile.fileName())
- .arg(implementationFile.errorString()));
- return;
- }
- implementationFile.write(block);
-
-//! [5]
- QDialog::accept();
-//! [5] //! [6]
-}
-//! [6]
-
-//! [7]
-IntroPage::IntroPage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Introduction"));
- setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark1.png"));
-
- label = new QLabel(tr("This wizard will generate a skeleton C++ class "
- "definition, including a few functions. You simply "
- "need to specify the class name and set a few "
- "options to produce a header file and an "
- "implementation file for your new C++ class."));
- label->setWordWrap(true);
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(label);
- setLayout(layout);
-}
-//! [7]
-
-//! [8] //! [9]
-ClassInfoPage::ClassInfoPage(QWidget *parent)
- : QWizardPage(parent)
-{
-//! [8]
- setTitle(tr("Class Information"));
- setSubTitle(tr("Specify basic information about the class for which you "
- "want to generate skeleton source code files."));
- setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo1.png"));
-
-//! [10]
- classNameLabel = new QLabel(tr("&Class name:"));
- classNameLineEdit = new QLineEdit;
- classNameLabel->setBuddy(classNameLineEdit);
-
- baseClassLabel = new QLabel(tr("B&ase class:"));
- baseClassLineEdit = new QLineEdit;
- baseClassLabel->setBuddy(baseClassLineEdit);
-
- qobjectMacroCheckBox = new QCheckBox(tr("Generate Q_OBJECT &macro"));
-
-//! [10]
- groupBox = new QGroupBox(tr("C&onstructor"));
-//! [9]
-
- qobjectCtorRadioButton = new QRadioButton(tr("&QObject-style constructor"));
- qwidgetCtorRadioButton = new QRadioButton(tr("Q&Widget-style constructor"));
- defaultCtorRadioButton = new QRadioButton(tr("&Default constructor"));
- copyCtorCheckBox = new QCheckBox(tr("&Generate copy constructor and "
- "operator="));
-
- defaultCtorRadioButton->setChecked(true);
-
- connect(defaultCtorRadioButton, &QAbstractButton::toggled,
- copyCtorCheckBox, &QWidget::setEnabled);
-
-//! [11] //! [12]
- registerField("className*", classNameLineEdit);
- registerField("baseClass", baseClassLineEdit);
- registerField("qobjectMacro", qobjectMacroCheckBox);
-//! [11]
- registerField("qobjectCtor", qobjectCtorRadioButton);
- registerField("qwidgetCtor", qwidgetCtorRadioButton);
- registerField("defaultCtor", defaultCtorRadioButton);
- registerField("copyCtor", copyCtorCheckBox);
-
- QVBoxLayout *groupBoxLayout = new QVBoxLayout;
-//! [12]
- groupBoxLayout->addWidget(qobjectCtorRadioButton);
- groupBoxLayout->addWidget(qwidgetCtorRadioButton);
- groupBoxLayout->addWidget(defaultCtorRadioButton);
- groupBoxLayout->addWidget(copyCtorCheckBox);
- groupBox->setLayout(groupBoxLayout);
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(classNameLabel, 0, 0);
- layout->addWidget(classNameLineEdit, 0, 1);
- layout->addWidget(baseClassLabel, 1, 0);
- layout->addWidget(baseClassLineEdit, 1, 1);
- layout->addWidget(qobjectMacroCheckBox, 2, 0, 1, 2);
- layout->addWidget(groupBox, 3, 0, 1, 2);
- setLayout(layout);
-//! [13]
-}
-//! [13]
-
-//! [14]
-CodeStylePage::CodeStylePage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Code Style Options"));
- setSubTitle(tr("Choose the formatting of the generated code."));
- setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo2.png"));
-
- commentCheckBox = new QCheckBox(tr("&Start generated files with a "
-//! [14]
- "comment"));
- commentCheckBox->setChecked(true);
-
- protectCheckBox = new QCheckBox(tr("&Protect header file against multiple "
- "inclusions"));
- protectCheckBox->setChecked(true);
-
- macroNameLabel = new QLabel(tr("&Macro name:"));
- macroNameLineEdit = new QLineEdit;
- macroNameLabel->setBuddy(macroNameLineEdit);
-
- includeBaseCheckBox = new QCheckBox(tr("&Include base class definition"));
- baseIncludeLabel = new QLabel(tr("Base class include:"));
- baseIncludeLineEdit = new QLineEdit;
- baseIncludeLabel->setBuddy(baseIncludeLineEdit);
-
- connect(protectCheckBox, &QAbstractButton::toggled,
- macroNameLabel, &QWidget::setEnabled);
- connect(protectCheckBox, &QAbstractButton::toggled,
- macroNameLineEdit, &QWidget::setEnabled);
- connect(includeBaseCheckBox, &QAbstractButton::toggled,
- baseIncludeLabel, &QWidget::setEnabled);
- connect(includeBaseCheckBox, &QAbstractButton::toggled,
- baseIncludeLineEdit, &QWidget::setEnabled);
-
- registerField("comment", commentCheckBox);
- registerField("protect", protectCheckBox);
- registerField("macroName", macroNameLineEdit);
- registerField("includeBase", includeBaseCheckBox);
- registerField("baseInclude", baseIncludeLineEdit);
-
- QGridLayout *layout = new QGridLayout;
- layout->setColumnMinimumWidth(0, 20);
- layout->addWidget(commentCheckBox, 0, 0, 1, 3);
- layout->addWidget(protectCheckBox, 1, 0, 1, 3);
- layout->addWidget(macroNameLabel, 2, 1);
- layout->addWidget(macroNameLineEdit, 2, 2);
- layout->addWidget(includeBaseCheckBox, 3, 0, 1, 3);
- layout->addWidget(baseIncludeLabel, 4, 1);
- layout->addWidget(baseIncludeLineEdit, 4, 2);
-//! [15]
- setLayout(layout);
-}
-//! [15]
-
-//! [16]
-void CodeStylePage::initializePage()
-{
- QString className = field("className").toString();
- macroNameLineEdit->setText(className.toUpper() + "_H");
-
- QString baseClass = field("baseClass").toString();
-
- includeBaseCheckBox->setChecked(!baseClass.isEmpty());
- includeBaseCheckBox->setEnabled(!baseClass.isEmpty());
- baseIncludeLabel->setEnabled(!baseClass.isEmpty());
- baseIncludeLineEdit->setEnabled(!baseClass.isEmpty());
-
- QRegularExpression rx("Q[A-Z].*");
- if (baseClass.isEmpty()) {
- baseIncludeLineEdit->clear();
- } else if (rx.match(baseClass).hasMatch()) {
- baseIncludeLineEdit->setText('<' + baseClass + '>');
- } else {
- baseIncludeLineEdit->setText('"' + baseClass.toLower() + ".h\"");
- }
-}
-//! [16]
-
-OutputFilesPage::OutputFilesPage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Output Files"));
- setSubTitle(tr("Specify where you want the wizard to put the generated "
- "skeleton code."));
- setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo3.png"));
-
- outputDirLabel = new QLabel(tr("&Output directory:"));
- outputDirLineEdit = new QLineEdit;
- outputDirLabel->setBuddy(outputDirLineEdit);
-
- headerLabel = new QLabel(tr("&Header file name:"));
- headerLineEdit = new QLineEdit;
- headerLabel->setBuddy(headerLineEdit);
-
- implementationLabel = new QLabel(tr("&Implementation file name:"));
- implementationLineEdit = new QLineEdit;
- implementationLabel->setBuddy(implementationLineEdit);
-
- registerField("outputDir*", outputDirLineEdit);
- registerField("header*", headerLineEdit);
- registerField("implementation*", implementationLineEdit);
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(outputDirLabel, 0, 0);
- layout->addWidget(outputDirLineEdit, 0, 1);
- layout->addWidget(headerLabel, 1, 0);
- layout->addWidget(headerLineEdit, 1, 1);
- layout->addWidget(implementationLabel, 2, 0);
- layout->addWidget(implementationLineEdit, 2, 1);
- setLayout(layout);
-}
-
-//! [17]
-void OutputFilesPage::initializePage()
-{
- QString className = field("className").toString();
- headerLineEdit->setText(className.toLower() + ".h");
- implementationLineEdit->setText(className.toLower() + ".cpp");
- outputDirLineEdit->setText(QDir::toNativeSeparators(QDir::tempPath()));
-}
-//! [17]
-
-ConclusionPage::ConclusionPage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Conclusion"));
- setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark2.png"));
-
- label = new QLabel;
- label->setWordWrap(true);
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(label);
- setLayout(layout);
-}
-
-void ConclusionPage::initializePage()
-{
- QString finishText = wizard()->buttonText(QWizard::FinishButton);
- finishText.remove('&');
- label->setText(tr("Click %1 to generate the class skeleton.")
- .arg(finishText));
-}
diff --git a/examples/widgets/dialogs/classwizard/classwizard.h b/examples/widgets/dialogs/classwizard/classwizard.h
deleted file mode 100644
index 0c386f0553..0000000000
--- a/examples/widgets/dialogs/classwizard/classwizard.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CLASSWIZARD_H
-#define CLASSWIZARD_H
-
-#include <QWizard>
-
-QT_BEGIN_NAMESPACE
-class QCheckBox;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QRadioButton;
-QT_END_NAMESPACE
-
-//! [0]
-class ClassWizard : public QWizard
-{
- Q_OBJECT
-
-public:
- ClassWizard(QWidget *parent = nullptr);
-
- void accept() override;
-};
-//! [0]
-
-//! [1]
-class IntroPage : public QWizardPage
-{
- Q_OBJECT
-
-public:
- IntroPage(QWidget *parent = nullptr);
-
-private:
- QLabel *label;
-};
-//! [1]
-
-//! [2]
-class ClassInfoPage : public QWizardPage
-{
- Q_OBJECT
-
-public:
- ClassInfoPage(QWidget *parent = nullptr);
-
-private:
- QLabel *classNameLabel;
- QLabel *baseClassLabel;
- QLineEdit *classNameLineEdit;
- QLineEdit *baseClassLineEdit;
- QCheckBox *qobjectMacroCheckBox;
- QGroupBox *groupBox;
- QRadioButton *qobjectCtorRadioButton;
- QRadioButton *qwidgetCtorRadioButton;
- QRadioButton *defaultCtorRadioButton;
- QCheckBox *copyCtorCheckBox;
-};
-//! [2]
-
-//! [3]
-class CodeStylePage : public QWizardPage
-{
- Q_OBJECT
-
-public:
- CodeStylePage(QWidget *parent = nullptr);
-
-protected:
- void initializePage() override;
-
-private:
- QCheckBox *commentCheckBox;
- QCheckBox *protectCheckBox;
- QCheckBox *includeBaseCheckBox;
- QLabel *macroNameLabel;
- QLabel *baseIncludeLabel;
- QLineEdit *macroNameLineEdit;
- QLineEdit *baseIncludeLineEdit;
-};
-//! [3]
-
-class OutputFilesPage : public QWizardPage
-{
- Q_OBJECT
-
-public:
- OutputFilesPage(QWidget *parent = nullptr);
-
-protected:
- void initializePage() override;
-
-private:
- QLabel *outputDirLabel;
- QLabel *headerLabel;
- QLabel *implementationLabel;
- QLineEdit *outputDirLineEdit;
- QLineEdit *headerLineEdit;
- QLineEdit *implementationLineEdit;
-};
-
-class ConclusionPage : public QWizardPage
-{
- Q_OBJECT
-
-public:
- ConclusionPage(QWidget *parent = nullptr);
-
-protected:
- void initializePage() override;
-
-private:
- QLabel *label;
-};
-
-#endif
diff --git a/examples/widgets/dialogs/classwizard/classwizard.pro b/examples/widgets/dialogs/classwizard/classwizard.pro
deleted file mode 100644
index 3ec321f4e8..0000000000
--- a/examples/widgets/dialogs/classwizard/classwizard.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT += widgets
-
-HEADERS = classwizard.h
-SOURCES = classwizard.cpp \
- main.cpp
-RESOURCES = classwizard.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/classwizard
-INSTALLS += target
diff --git a/examples/widgets/dialogs/classwizard/classwizard.qrc b/examples/widgets/dialogs/classwizard/classwizard.qrc
deleted file mode 100644
index 41a5ddc7d1..0000000000
--- a/examples/widgets/dialogs/classwizard/classwizard.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>images/background.png</file>
- <file>images/banner.png</file>
- <file>images/logo1.png</file>
- <file>images/logo2.png</file>
- <file>images/logo3.png</file>
- <file>images/watermark1.png</file>
- <file>images/watermark2.png</file>
-</qresource>
-</RCC>
diff --git a/examples/widgets/dialogs/classwizard/images/background.png b/examples/widgets/dialogs/classwizard/images/background.png
deleted file mode 100644
index 44c7badb85..0000000000
--- a/examples/widgets/dialogs/classwizard/images/background.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/dialogs/classwizard/images/banner.png b/examples/widgets/dialogs/classwizard/images/banner.png
deleted file mode 100644
index 3169152b8e..0000000000
--- a/examples/widgets/dialogs/classwizard/images/banner.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/dialogs/classwizard/images/logo1.png b/examples/widgets/dialogs/classwizard/images/logo1.png
deleted file mode 100644
index f9b594aafc..0000000000
--- a/examples/widgets/dialogs/classwizard/images/logo1.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/dialogs/classwizard/images/logo2.png b/examples/widgets/dialogs/classwizard/images/logo2.png
deleted file mode 100644
index 5dcbd4669d..0000000000
--- a/examples/widgets/dialogs/classwizard/images/logo2.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/dialogs/classwizard/images/logo3.png b/examples/widgets/dialogs/classwizard/images/logo3.png
deleted file mode 100644
index 9fd3ea2358..0000000000
--- a/examples/widgets/dialogs/classwizard/images/logo3.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/dialogs/classwizard/images/watermark1.png b/examples/widgets/dialogs/classwizard/images/watermark1.png
deleted file mode 100644
index 0091f5c17a..0000000000
--- a/examples/widgets/dialogs/classwizard/images/watermark1.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/dialogs/classwizard/images/watermark2.png b/examples/widgets/dialogs/classwizard/images/watermark2.png
deleted file mode 100644
index 3b88f2e360..0000000000
--- a/examples/widgets/dialogs/classwizard/images/watermark2.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/dialogs/classwizard/main.cpp b/examples/widgets/dialogs/classwizard/main.cpp
deleted file mode 100644
index 612d194c06..0000000000
--- a/examples/widgets/dialogs/classwizard/main.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QTranslator>
-#include <QLocale>
-#include <QLibraryInfo>
-
-#include "classwizard.h"
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(classwizard);
-
- QApplication app(argc, argv);
-
-#ifndef QT_NO_TRANSLATION
- QString translatorFileName = QLatin1String("qtbase_");
- translatorFileName += QLocale::system().name();
- QTranslator *translator = new QTranslator(&app);
- if (translator->load(translatorFileName, QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
- app.installTranslator(translator);
-#endif
-
- ClassWizard wizard;
- wizard.show();
- return app.exec();
-}
diff --git a/examples/widgets/dialogs/dialogs.pro b/examples/widgets/dialogs/dialogs.pro
index 753308fc55..2493688297 100644
--- a/examples/widgets/dialogs/dialogs.pro
+++ b/examples/widgets/dialogs/dialogs.pro
@@ -1,10 +1,7 @@
QT_FOR_CONFIG += widgets
TEMPLATE = subdirs
-SUBDIRS = classwizard \
- extension \
- findfiles \
- licensewizard \
+SUBDIRS = licensewizard \
standarddialogs \
tabdialog \
trivialwizard
diff --git a/examples/widgets/dialogs/extension/CMakeLists.txt b/examples/widgets/dialogs/extension/CMakeLists.txt
deleted file mode 100644
index be555e6a10..0000000000
--- a/examples/widgets/dialogs/extension/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# Generated from extension.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(extension LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/extension")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-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 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::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 10a4ae1ac0..0000000000
--- a/examples/widgets/dialogs/extension/finddialog.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#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 9b4b5b5f3d..0000000000
--- a/examples/widgets/dialogs/extension/finddialog.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef FINDDIALOG_H
-#define FINDDIALOG_H
-
-#include <QDialog>
-
-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 7fa2883fe1..0000000000
--- a/examples/widgets/dialogs/extension/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#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/dialogs/findfiles/CMakeLists.txt b/examples/widgets/dialogs/findfiles/CMakeLists.txt
deleted file mode 100644
index cf183d29e2..0000000000
--- a/examples/widgets/dialogs/findfiles/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# Generated from findfiles.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(findfiles LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/findfiles")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(findfiles
- main.cpp
- window.cpp window.h
-)
-set_target_properties(findfiles PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(findfiles PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS findfiles
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/dialogs/findfiles/findfiles.pro b/examples/widgets/dialogs/findfiles/findfiles.pro
deleted file mode 100644
index 4fb77f0dd7..0000000000
--- a/examples/widgets/dialogs/findfiles/findfiles.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT += widgets
-requires(qtConfig(filedialog))
-
-HEADERS = window.h
-SOURCES = main.cpp \
- window.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/findfiles
-INSTALLS += target
diff --git a/examples/widgets/dialogs/findfiles/main.cpp b/examples/widgets/dialogs/findfiles/main.cpp
deleted file mode 100644
index 99725195e5..0000000000
--- a/examples/widgets/dialogs/findfiles/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Window window;
- window.show();
- return app.exec();
-}
diff --git a/examples/widgets/dialogs/findfiles/window.cpp b/examples/widgets/dialogs/findfiles/window.cpp
deleted file mode 100644
index e1f7ccdcc4..0000000000
--- a/examples/widgets/dialogs/findfiles/window.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-//! [17]
-enum { absoluteFileNameRole = Qt::UserRole + 1 };
-//! [17]
-
-//! [18]
-static inline QString fileNameOfItem(const QTableWidgetItem *item)
-{
- return item->data(absoluteFileNameRole).toString();
-}
-//! [18]
-
-//! [14]
-static inline void openFile(const QString &fileName)
-{
- QDesktopServices::openUrl(QUrl::fromLocalFile(fileName));
-}
-//! [14]
-
-//! [0]
-Window::Window(QWidget *parent)
- : QWidget(parent)
-{
- setWindowTitle(tr("Find Files"));
- QPushButton *browseButton = new QPushButton(tr("&Browse..."), this);
- connect(browseButton, &QAbstractButton::clicked, this, &Window::browse);
- findButton = new QPushButton(tr("&Find"), this);
- connect(findButton, &QAbstractButton::clicked, this, &Window::find);
-
- fileComboBox = createComboBox(tr("*"));
- connect(fileComboBox->lineEdit(), &QLineEdit::returnPressed,
- this, &Window::animateFindClick);
- textComboBox = createComboBox();
- connect(textComboBox->lineEdit(), &QLineEdit::returnPressed,
- this, &Window::animateFindClick);
- directoryComboBox = createComboBox(QDir::toNativeSeparators(QDir::currentPath()));
- connect(directoryComboBox->lineEdit(), &QLineEdit::returnPressed,
- this, &Window::animateFindClick);
-
- filesFoundLabel = new QLabel;
-
- createFilesTable();
-
- QGridLayout *mainLayout = new QGridLayout(this);
- mainLayout->addWidget(new QLabel(tr("Named:")), 0, 0);
- mainLayout->addWidget(fileComboBox, 0, 1, 1, 2);
- mainLayout->addWidget(new QLabel(tr("Containing text:")), 1, 0);
- mainLayout->addWidget(textComboBox, 1, 1, 1, 2);
- mainLayout->addWidget(new QLabel(tr("In directory:")), 2, 0);
- mainLayout->addWidget(directoryComboBox, 2, 1);
- mainLayout->addWidget(browseButton, 2, 2);
- mainLayout->addWidget(filesTable, 3, 0, 1, 3);
- mainLayout->addWidget(filesFoundLabel, 4, 0, 1, 2);
- mainLayout->addWidget(findButton, 4, 2);
-//! [0]
-
-//! [1]
- connect(new QShortcut(QKeySequence::Quit, this), &QShortcut::activated,
- qApp, &QApplication::quit);
-//! [1]
-}
-
-//! [2]
-void Window::browse()
-{
- QString directory =
- QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, tr("Find Files"), QDir::currentPath()));
-
- if (!directory.isEmpty()) {
- if (directoryComboBox->findText(directory) == -1)
- directoryComboBox->addItem(directory);
- directoryComboBox->setCurrentIndex(directoryComboBox->findText(directory));
- }
-}
-//! [2]
-
-static void updateComboBox(QComboBox *comboBox)
-{
- if (comboBox->findText(comboBox->currentText()) == -1)
- comboBox->addItem(comboBox->currentText());
-}
-
-//! [3]
-void Window::find()
-{
- filesTable->setRowCount(0);
-
- QString fileName = fileComboBox->currentText();
- QString text = textComboBox->currentText();
- QString path = QDir::cleanPath(directoryComboBox->currentText());
- currentDir = QDir(path);
-//! [3]
-
- updateComboBox(fileComboBox);
- updateComboBox(textComboBox);
- updateComboBox(directoryComboBox);
-
-//! [4]
- QStringList filter;
- if (!fileName.isEmpty())
- filter << fileName;
- QDirIterator it(path, filter, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
- QStringList files;
- while (it.hasNext())
- files << it.next();
- if (!text.isEmpty())
- files = findFiles(files, text);
- files.sort();
- showFiles(files);
-}
-//! [4]
-
-void Window::animateFindClick()
-{
- findButton->animateClick();
-}
-
-//! [5]
-QStringList Window::findFiles(const QStringList &files, const QString &text)
-{
- QProgressDialog progressDialog(this);
- progressDialog.setCancelButtonText(tr("&Cancel"));
- progressDialog.setRange(0, files.size());
- progressDialog.setWindowTitle(tr("Find Files"));
-
-//! [5] //! [6]
- QMimeDatabase mimeDatabase;
- QStringList foundFiles;
-
- for (int i = 0; i < files.size(); ++i) {
- progressDialog.setValue(i);
- progressDialog.setLabelText(tr("Searching file number %1 of %n...", nullptr, files.size()).arg(i));
- QCoreApplication::processEvents();
-//! [6]
-
- if (progressDialog.wasCanceled())
- break;
-
-//! [7]
- const QString fileName = files.at(i);
- const QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileName);
- if (mimeType.isValid() && !mimeType.inherits(QStringLiteral("text/plain"))) {
- qWarning() << "Not searching binary file " << QDir::toNativeSeparators(fileName);
- continue;
- }
- QFile file(fileName);
- if (file.open(QIODevice::ReadOnly)) {
- QString line;
- QTextStream in(&file);
- while (!in.atEnd()) {
- if (progressDialog.wasCanceled())
- break;
- line = in.readLine();
- if (line.contains(text, Qt::CaseInsensitive)) {
- foundFiles << files[i];
- break;
- }
- }
- }
- }
- return foundFiles;
-}
-//! [7]
-
-//! [8]
-void Window::showFiles(const QStringList &paths)
-{
- for (const QString &filePath : paths) {
- const QString toolTip = QDir::toNativeSeparators(filePath);
- const QString relativePath = QDir::toNativeSeparators(currentDir.relativeFilePath(filePath));
- const qint64 size = QFileInfo(filePath).size();
- QTableWidgetItem *fileNameItem = new QTableWidgetItem(relativePath);
- fileNameItem->setData(absoluteFileNameRole, QVariant(filePath));
- fileNameItem->setToolTip(toolTip);
- fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
- QTableWidgetItem *sizeItem = new QTableWidgetItem(QLocale().formattedDataSize(size));
- sizeItem->setData(absoluteFileNameRole, QVariant(filePath));
- sizeItem->setToolTip(toolTip);
- sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
- sizeItem->setFlags(sizeItem->flags() ^ Qt::ItemIsEditable);
-
- int row = filesTable->rowCount();
- filesTable->insertRow(row);
- filesTable->setItem(row, 0, fileNameItem);
- filesTable->setItem(row, 1, sizeItem);
- }
- filesFoundLabel->setText(tr("%n file(s) found (Double click on a file to open it)", nullptr, paths.size()));
- filesFoundLabel->setWordWrap(true);
-}
-//! [8]
-
-//! [10]
-QComboBox *Window::createComboBox(const QString &text)
-{
- QComboBox *comboBox = new QComboBox;
- comboBox->setEditable(true);
- comboBox->addItem(text);
- comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- return comboBox;
-}
-//! [10]
-
-//! [11]
-void Window::createFilesTable()
-{
- filesTable = new QTableWidget(0, 2);
- filesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
-
- QStringList labels;
- labels << tr("Filename") << tr("Size");
- filesTable->setHorizontalHeaderLabels(labels);
- filesTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
- filesTable->verticalHeader()->hide();
- filesTable->setShowGrid(false);
-//! [15]
- filesTable->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(filesTable, &QTableWidget::customContextMenuRequested,
- this, &Window::contextMenu);
- connect(filesTable, &QTableWidget::cellActivated,
- this, &Window::openFileOfItem);
-//! [15]
-}
-//! [11]
-
-
-//! [12]
-
-void Window::openFileOfItem(int row, int /* column */)
-{
- const QTableWidgetItem *item = filesTable->item(row, 0);
- openFile(fileNameOfItem(item));
-}
-
-//! [12]
-
-//! [16]
-void Window::contextMenu(const QPoint &pos)
-{
- const QTableWidgetItem *item = filesTable->itemAt(pos);
- if (!item)
- return;
- QMenu menu;
-#ifndef QT_NO_CLIPBOARD
- QAction *copyAction = menu.addAction("Copy Name");
-#endif
- QAction *openAction = menu.addAction("Open");
- QAction *action = menu.exec(filesTable->mapToGlobal(pos));
- if (!action)
- return;
- const QString fileName = fileNameOfItem(item);
- if (action == openAction)
- openFile(fileName);
-#ifndef QT_NO_CLIPBOARD
- else if (action == copyAction)
- QGuiApplication::clipboard()->setText(QDir::toNativeSeparators(fileName));
-#endif
-}
-//! [16]
diff --git a/examples/widgets/dialogs/findfiles/window.h b/examples/widgets/dialogs/findfiles/window.h
deleted file mode 100644
index b74ba5e70c..0000000000
--- a/examples/widgets/dialogs/findfiles/window.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <QWidget>
-#include <QDir>
-
-QT_BEGIN_NAMESPACE
-class QComboBox;
-class QLabel;
-class QPushButton;
-class QTableWidget;
-class QTableWidgetItem;
-QT_END_NAMESPACE
-
-//! [0]
-class Window : public QWidget
-{
- Q_OBJECT
-
-public:
- Window(QWidget *parent = nullptr);
-
-private slots:
- void browse();
- void find();
- void animateFindClick();
- void openFileOfItem(int row, int column);
- void contextMenu(const QPoint &pos);
-
-private:
- QStringList findFiles(const QStringList &files, const QString &text);
- void showFiles(const QStringList &paths);
- QComboBox *createComboBox(const QString &text = QString());
- void createFilesTable();
-
- QComboBox *fileComboBox;
- QComboBox *textComboBox;
- QComboBox *directoryComboBox;
- QLabel *filesFoundLabel;
- QPushButton *findButton;
- QTableWidget *filesTable;
-
- QDir currentDir;
-};
-//! [0]
-
-#endif
diff --git a/examples/widgets/dialogs/licensewizard/CMakeLists.txt b/examples/widgets/dialogs/licensewizard/CMakeLists.txt
index 7fc7ac65fa..0cf2d61c8b 100644
--- a/examples/widgets/dialogs/licensewizard/CMakeLists.txt
+++ b/examples/widgets/dialogs/licensewizard/CMakeLists.txt
@@ -1,40 +1,29 @@
-# Generated from licensewizard.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(licensewizard LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui PrintSupport Widgets)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/licensewizard")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport)
+qt_standard_project_setup()
qt_add_executable(licensewizard
licensewizard.cpp licensewizard.h
main.cpp
)
+
set_target_properties(licensewizard PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(licensewizard PUBLIC
- Qt::Core
- Qt::Gui
- Qt::PrintSupport
- Qt::Widgets
-)
+target_link_libraries(licensewizard PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::PrintSupport
+ Qt6::Widgets
+)
# Resources:
set(licensewizard_resource_files
@@ -42,7 +31,7 @@ set(licensewizard_resource_files
"images/watermark.png"
)
-qt6_add_resources(licensewizard "licensewizard"
+qt_add_resources(licensewizard "licensewizard"
PREFIX
"/"
FILES
@@ -50,7 +39,14 @@ qt6_add_resources(licensewizard "licensewizard"
)
install(TARGETS licensewizard
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_app_script(
+ TARGET licensewizard
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.cpp b/examples/widgets/dialogs/licensewizard/licensewizard.cpp
index 2eaadd1cba..67fa46bf07 100644
--- a/examples/widgets/dialogs/licensewizard/licensewizard.cpp
+++ b/examples/widgets/dialogs/licensewizard/licensewizard.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
#if defined(QT_PRINTSUPPORT_LIB)
@@ -335,9 +288,12 @@ void ConclusionPage::initializePage()
"You can use this software for 30 days and make one "
"backup, but you are not allowed to distribute it.");
} else if (wizard()->hasVisitedPage(LicenseWizard::Page_Details)) {
+//! [accessField]
+ const QString emailAddress = field("details.email").toString();
licenseText = tr("<u>First-Time License Agreement:</u> "
"You can use this software subject to the license "
- "you will receive by email.");
+ "you will receive by email sent to %1.").arg(emailAddress);
+//! [accessField]
} else {
licenseText = tr("<u>Upgrade License Agreement:</u> "
"This software is licensed under the terms of your "
diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.h b/examples/widgets/dialogs/licensewizard/licensewizard.h
index e2890e484f..c163a2af9d 100644
--- a/examples/widgets/dialogs/licensewizard/licensewizard.h
+++ b/examples/widgets/dialogs/licensewizard/licensewizard.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef LICENSEWIZARD_H
#define LICENSEWIZARD_H
diff --git a/examples/widgets/dialogs/licensewizard/main.cpp b/examples/widgets/dialogs/licensewizard/main.cpp
index 47fdb4a09d..d16b5dc6d1 100644
--- a/examples/widgets/dialogs/licensewizard/main.cpp
+++ b/examples/widgets/dialogs/licensewizard/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
#include <QTranslator>
@@ -57,8 +10,6 @@
int main(int argc, char *argv[])
{
- Q_INIT_RESOURCE(licensewizard);
-
QApplication app(argc, argv);
#ifndef QT_NO_TRANSLATION
diff --git a/examples/widgets/dialogs/standarddialogs/CMakeLists.txt b/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
index 9cb52e22dd..07e22469ee 100644
--- a/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
+++ b/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
@@ -1,40 +1,38 @@
-# Generated from standarddialogs.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(standarddialogs LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/standarddialogs")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+qt_standard_project_setup()
qt_add_executable(standarddialogs
dialog.cpp dialog.h
main.cpp
)
+
set_target_properties(standarddialogs PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(standarddialogs PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+
+target_link_libraries(standarddialogs PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS standarddialogs
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_app_script(
+ TARGET standarddialogs
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/dialogs/standarddialogs/dialog.cpp b/examples/widgets/dialogs/standarddialogs/dialog.cpp
index 7df24e06f6..67fb615794 100644
--- a/examples/widgets/dialogs/standarddialogs/dialog.cpp
+++ b/examples/widgets/dialogs/standarddialogs/dialog.cpp
@@ -1,67 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
#include "dialog.h"
-#define MESSAGE \
- Dialog::tr("<p>Message boxes have a caption, a text, " \
- "and any number of buttons, each with standard or custom texts." \
- "<p>Click a button to close the message box. Pressing the Esc button " \
- "will activate the detected escape button (if any).")
-#define MESSAGE_DETAILS \
- Dialog::tr("If a message box has detailed text, the user can reveal it " \
- "by pressing the Show Details... button.")
-
-
class DialogOptionsWidget : public QGroupBox
{
public:
@@ -99,7 +42,7 @@ void DialogOptionsWidget::addSpacer()
int DialogOptionsWidget::value() const
{
int result = 0;
- for (const CheckBoxEntry &checkboxEntry : qAsConst(checkBoxEntries)) {
+ for (const CheckBoxEntry &checkboxEntry : std::as_const(checkBoxEntries)) {
if (checkboxEntry.first->isChecked())
result |= checkboxEntry.second;
}
@@ -195,8 +138,6 @@ Dialog::Dialog(QWidget *parent)
warningLabel->setFrameStyle(frameStyle);
QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));
- errorLabel = new QLabel;
- errorLabel->setFrameStyle(frameStyle);
QPushButton *errorButton =
new QPushButton(tr("QErrorMessage::showM&essage()"));
@@ -250,6 +191,7 @@ Dialog::Dialog(QWidget *parent)
colorDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QColorDialog::DontUseNativeDialog);
colorDialogOptionsWidget->addCheckBox(tr("Show alpha channel") , QColorDialog::ShowAlphaChannel);
colorDialogOptionsWidget->addCheckBox(tr("No buttons") , QColorDialog::NoButtons);
+ colorDialogOptionsWidget->addCheckBox(tr("Hide Color Picker") , QColorDialog::NoEyeDropperButton);
layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 1, 0);
layout->addWidget(colorDialogOptionsWidget, 2, 0, 1 ,2);
@@ -306,7 +248,6 @@ Dialog::Dialog(QWidget *parent)
layout->addWidget(warningButton, 3, 0);
layout->addWidget(warningLabel, 3, 1);
layout->addWidget(errorButton, 4, 0);
- layout->addWidget(errorLabel, 4, 1);
layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
toolbox->addItem(page, tr("Message Boxes"));
@@ -460,10 +401,14 @@ void Dialog::setSaveFileName()
void Dialog::criticalMessage()
{
- QMessageBox::StandardButton reply;
- reply = QMessageBox::critical(this, tr("QMessageBox::critical()"),
- MESSAGE,
- QMessageBox::Abort | QMessageBox::Retry | QMessageBox::Ignore);
+ QMessageBox msgBox(QMessageBox::Critical, tr("QMessageBox::critical()"),
+ tr("Houston, we have a problem"), { }, this);
+ msgBox.setInformativeText(tr("Activating the liquid oxygen stirring fans caused an explosion in one of the tanks. " \
+ "Liquid oxygen levels are getting low. This may jeopardize the moon landing mission."));
+ msgBox.addButton(QMessageBox::Abort);
+ msgBox.addButton(QMessageBox::Retry);
+ msgBox.addButton(QMessageBox::Ignore);
+ int reply = msgBox.exec();
if (reply == QMessageBox::Abort)
criticalLabel->setText(tr("Abort"));
else if (reply == QMessageBox::Retry)
@@ -474,9 +419,12 @@ void Dialog::criticalMessage()
void Dialog::informationMessage()
{
- QMessageBox::StandardButton reply;
- reply = QMessageBox::information(this, tr("QMessageBox::information()"), MESSAGE);
- if (reply == QMessageBox::Ok)
+ QMessageBox msgBox(QMessageBox::Information, tr("QMessageBox::information()"),
+ tr("Elvis has left the building."), { }, this);
+ msgBox.setInformativeText(tr("This phrase was often used by public address announcers at the conclusion " \
+ "of Elvis Presley concerts in order to disperse audiences who lingered in " \
+ "hopes of an encore. It has since become a catchphrase and punchline."));
+ if (msgBox.exec() == QMessageBox::Ok)
informationLabel->setText(tr("OK"));
else
informationLabel->setText(tr("Escape"));
@@ -484,10 +432,15 @@ void Dialog::informationMessage()
void Dialog::questionMessage()
{
- QMessageBox::StandardButton reply;
- reply = QMessageBox::question(this, tr("QMessageBox::question()"),
- MESSAGE,
- QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+ QMessageBox msgBox(QMessageBox::Question, tr("QMessageBox::question()"),
+ tr("Would you like cheese with that?"), { }, this);
+ msgBox.setInformativeText(tr("A cheeseburger is a hamburger topped with cheese. Traditionally, the slice of " \
+ "cheese is placed on top of the meat patty. The cheese is usually added to the " \
+ "cooking hamburger patty shortly before serving, which allows the cheese to melt."));
+ msgBox.addButton(QMessageBox::Yes);
+ msgBox.addButton(QMessageBox::No);
+ msgBox.addButton(QMessageBox::Cancel);
+ int reply = msgBox.exec();
if (reply == QMessageBox::Yes)
questionLabel->setText(tr("Yes"));
else if (reply == QMessageBox::No)
@@ -499,26 +452,31 @@ void Dialog::questionMessage()
void Dialog::warningMessage()
{
QMessageBox msgBox(QMessageBox::Warning, tr("QMessageBox::warning()"),
- MESSAGE, { }, this);
- msgBox.setDetailedText(MESSAGE_DETAILS);
- msgBox.addButton(tr("Save &Again"), QMessageBox::AcceptRole);
- msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);
- if (msgBox.exec() == QMessageBox::AcceptRole)
- warningLabel->setText(tr("Save Again"));
+ tr("Delete the only copy of your movie manuscript?"), { }, this);
+ msgBox.setInformativeText(tr("You've been working on this manuscript for 738 days now. Hang in there!"));
+ msgBox.setDetailedText("\"A long time ago in a galaxy far, far away....\"");
+ auto *keepButton = msgBox.addButton(tr("&Keep"), QMessageBox::AcceptRole);
+ auto *deleteButton = msgBox.addButton(tr("Delete"), QMessageBox::DestructiveRole);
+ msgBox.exec();
+ if (msgBox.clickedButton() == keepButton)
+ warningLabel->setText(tr("Keep"));
+ else if (msgBox.clickedButton() == deleteButton)
+ warningLabel->setText(tr("Delete"));
else
- warningLabel->setText(tr("Continue"));
-
+ warningLabel->setText("");
}
void Dialog::errorMessage()
{
errorMessageDialog->showMessage(
tr("This dialog shows and remembers error messages. "
- "If the checkbox is checked (as it is by default), "
- "the shown message will be shown again, "
- "but if the user unchecks the box the message "
+ "If the user chooses to not show the dialog again, the dialog "
"will not appear again if QErrorMessage::showMessage() "
"is called with the same message."));
- errorLabel->setText(tr("If the box is unchecked, the message "
- "won't appear again."));
+ errorMessageDialog->showMessage(
+ tr("You can queue up error messages, and they will be "
+ "shown one after each other. Each message maintains "
+ "its own state for whether it will be shown again "
+ "the next time QErrorMessage::showMessage() is called "
+ "with the same message."));
}
diff --git a/examples/widgets/dialogs/standarddialogs/dialog.h b/examples/widgets/dialogs/standarddialogs/dialog.h
index 6d9cbdc07a..88d0f7519f 100644
--- a/examples/widgets/dialogs/standarddialogs/dialog.h
+++ b/examples/widgets/dialogs/standarddialogs/dialog.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef DIALOG_H
#define DIALOG_H
@@ -102,7 +55,6 @@ private:
QLabel *informationLabel;
QLabel *questionLabel;
QLabel *warningLabel;
- QLabel *errorLabel;
QErrorMessage *errorMessageDialog;
DialogOptionsWidget *fileDialogOptionsWidget;
DialogOptionsWidget *colorDialogOptionsWidget;
diff --git a/examples/widgets/dialogs/standarddialogs/main.cpp b/examples/widgets/dialogs/standarddialogs/main.cpp
index 7e7a5ce95b..c982ef36c5 100644
--- a/examples/widgets/dialogs/standarddialogs/main.cpp
+++ b/examples/widgets/dialogs/standarddialogs/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
#include <QScreen>
@@ -57,13 +10,15 @@
#include "dialog.h"
+using namespace Qt::StringLiterals;
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
#if QT_CONFIG(translation)
QTranslator translator;
- if (translator.load(QLocale::system(), u"qtbase"_qs, u"_"_qs,
+ if (translator.load(QLocale::system(), u"qtbase"_s, u"_"_s,
QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
app.installTranslator(&translator);
}
diff --git a/examples/widgets/dialogs/standarddialogs/main.mm b/examples/widgets/dialogs/standarddialogs/main.mm
new file mode 100644
index 0000000000..558ef4e680
--- /dev/null
+++ b/examples/widgets/dialogs/standarddialogs/main.mm
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QApplication>
+#include <QScreen>
+#include <QStyleHints>
+#include <QTranslator>
+#include <QLocale>
+#include <QLibraryInfo>
+
+#include "dialog.h"
+
+#include <AppKit/AppKit.h>
+
+using namespace Qt::StringLiterals;
+
+int main(int argc, char *argv[])
+{
+ [NSApplication sharedApplication];
+ NSApplicationLoad();
+ NSApplicationLoad();
+ [NSApp run];
+
+ QApplication app(argc, argv);
+ //app.setAttribute(Qt::AA_DontUseNativeDialogs);
+
+#if QT_CONFIG(translation)
+ QTranslator translator;
+ if (translator.load(QLocale::system(), u"qtbase"_s, u"_"_s,
+ QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
+ app.installTranslator(&translator);
+ }
+#endif
+
+ QGuiApplication::setApplicationDisplayName(Dialog::tr("Standard Dialogs"));
+
+ Dialog dialog;
+ if (!QGuiApplication::styleHints()->showIsFullScreen() && !QGuiApplication::styleHints()->showIsMaximized()) {
+ const QRect availableGeometry = dialog.screen()->availableGeometry();
+ dialog.resize(availableGeometry.width() / 3, availableGeometry.height() * 2 / 3);
+ dialog.move((availableGeometry.width() - dialog.width()) / 2,
+ (availableGeometry.height() - dialog.height()) / 2);
+ }
+ dialog.show();
+
+ return app.exec();
+}
diff --git a/examples/widgets/dialogs/tabdialog/CMakeLists.txt b/examples/widgets/dialogs/tabdialog/CMakeLists.txt
index b61a8ef89c..b959a5c3e4 100644
--- a/examples/widgets/dialogs/tabdialog/CMakeLists.txt
+++ b/examples/widgets/dialogs/tabdialog/CMakeLists.txt
@@ -1,40 +1,38 @@
-# Generated from tabdialog.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tabdialog LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/tabdialog")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+qt_standard_project_setup()
qt_add_executable(tabdialog
main.cpp
tabdialog.cpp tabdialog.h
)
+
set_target_properties(tabdialog PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(tabdialog PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+
+target_link_libraries(tabdialog PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS tabdialog
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_app_script(
+ TARGET tabdialog
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/dialogs/tabdialog/main.cpp b/examples/widgets/dialogs/tabdialog/main.cpp
index d5ed426320..aa05ad0205 100644
--- a/examples/widgets/dialogs/tabdialog/main.cpp
+++ b/examples/widgets/dialogs/tabdialog/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QApplication>
diff --git a/examples/widgets/dialogs/tabdialog/tabdialog.cpp b/examples/widgets/dialogs/tabdialog/tabdialog.cpp
index e64413d6bb..cb4fcea11d 100644
--- a/examples/widgets/dialogs/tabdialog/tabdialog.cpp
+++ b/examples/widgets/dialogs/tabdialog/tabdialog.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
diff --git a/examples/widgets/dialogs/tabdialog/tabdialog.h b/examples/widgets/dialogs/tabdialog/tabdialog.h
index b7c6c5b8da..27f07747d6 100644
--- a/examples/widgets/dialogs/tabdialog/tabdialog.h
+++ b/examples/widgets/dialogs/tabdialog/tabdialog.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef TABDIALOG_H
#define TABDIALOG_H
diff --git a/examples/widgets/dialogs/trivialwizard/CMakeLists.txt b/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
index d57cbd59c3..966d99a7aa 100644
--- a/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
+++ b/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
@@ -1,39 +1,37 @@
-# Generated from trivialwizard.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(trivialwizard LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/trivialwizard")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+qt_standard_project_setup()
qt_add_executable(trivialwizard
trivialwizard.cpp
)
+
set_target_properties(trivialwizard PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(trivialwizard PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+
+target_link_libraries(trivialwizard PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS trivialwizard
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_app_script(
+ TARGET trivialwizard
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/dialogs/trivialwizard/trivialwizard.cpp b/examples/widgets/dialogs/trivialwizard/trivialwizard.cpp
index e214a4e54a..b9321338a4 100644
--- a/examples/widgets/dialogs/trivialwizard/trivialwizard.cpp
+++ b/examples/widgets/dialogs/trivialwizard/trivialwizard.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtWidgets>
#include <QTranslator>
@@ -133,10 +86,12 @@ int main(int argc, char *argv[])
app.installTranslator(translator);
#endif
+//! [linearAddPage]
QWizard wizard;
wizard.addPage(createIntroPage());
wizard.addPage(createRegistrationPage());
wizard.addPage(createConclusionPage());
+//! [linearAddPage]
wizard.setWindowTitle("Trivial Wizard");
wizard.show();