summaryrefslogtreecommitdiffstats
path: root/examples/designer
diff options
context:
space:
mode:
Diffstat (limited to 'examples/designer')
-rw-r--r--examples/designer/CMakeLists.txt19
-rw-r--r--examples/designer/README4
-rw-r--r--examples/designer/calculatorbuilder/CMakeLists.txt25
-rw-r--r--examples/designer/calculatorbuilder/calculatorbuilder.pro4
-rw-r--r--examples/designer/calculatorbuilder/calculatorform.cpp104
-rw-r--r--examples/designer/calculatorbuilder/calculatorform.h80
-rw-r--r--examples/designer/calculatorbuilder/main.cpp112
-rw-r--r--examples/designer/calculatorform/CMakeLists.txt18
-rw-r--r--examples/designer/calculatorform/calculatorform.cpp65
-rw-r--r--examples/designer/calculatorform/calculatorform.h54
-rw-r--r--examples/designer/calculatorform/main.cpp51
-rw-r--r--examples/designer/calculatorform_mi/CMakeLists.txt38
-rw-r--r--examples/designer/calculatorform_mi/calculatorform.cpp28
-rw-r--r--examples/designer/calculatorform_mi/calculatorform.h25
-rw-r--r--examples/designer/calculatorform_mi/calculatorform.ui303
-rw-r--r--examples/designer/calculatorform_mi/calculatorform_mi.pro11
-rw-r--r--examples/designer/calculatorform_mi/main.cpp15
-rw-r--r--examples/designer/containerextension/.prev_CMakeLists.txt44
-rw-r--r--examples/designer/containerextension/CMakeLists.txt42
-rw-r--r--examples/designer/containerextension/containerextension.pro13
-rw-r--r--examples/designer/containerextension/multipagewidget.cpp65
-rw-r--r--examples/designer/containerextension/multipagewidget.h53
-rw-r--r--examples/designer/containerextension/multipagewidgetcontainerextension.cpp51
-rw-r--r--examples/designer/containerextension/multipagewidgetcontainerextension.h51
-rw-r--r--examples/designer/containerextension/multipagewidgetextensionfactory.cpp53
-rw-r--r--examples/designer/containerextension/multipagewidgetextensionfactory.h51
-rw-r--r--examples/designer/containerextension/multipagewidgetplugin.cpp103
-rw-r--r--examples/designer/containerextension/multipagewidgetplugin.h51
-rw-r--r--examples/designer/customwidgetplugin/.prev_CMakeLists.txt42
-rw-r--r--examples/designer/customwidgetplugin/CMakeLists.txt42
-rw-r--r--examples/designer/customwidgetplugin/analogclock.cpp109
-rw-r--r--examples/designer/customwidgetplugin/analogclock.h55
-rw-r--r--examples/designer/customwidgetplugin/customwidgetplugin.cpp69
-rw-r--r--examples/designer/customwidgetplugin/customwidgetplugin.h51
-rw-r--r--examples/designer/customwidgetplugin/customwidgetplugin.pro25
-rw-r--r--examples/designer/designer.pro12
-rw-r--r--examples/designer/doc/images/arthurplugin-demo.pngbin77481 -> 0 bytes
-rw-r--r--examples/designer/doc/images/calculatorbuilder-example.pngbin4326 -> 0 bytes
-rw-r--r--examples/designer/doc/images/calculatorbuilder-example.webpbin0 -> 8724 bytes
-rw-r--r--examples/designer/doc/images/calculatorform-example.pngbin3967 -> 0 bytes
-rw-r--r--examples/designer/doc/images/calculatorform-example.webpbin0 -> 7518 bytes
-rw-r--r--examples/designer/doc/images/containerextension-example.pngbin43032 -> 0 bytes
-rw-r--r--examples/designer/doc/images/containerextension-example.webpbin0 -> 22794 bytes
-rw-r--r--examples/designer/doc/images/customwidgetplugin-example.pngbin2175 -> 0 bytes
-rw-r--r--examples/designer/doc/images/customwidgetplugin-example.webpbin0 -> 26828 bytes
-rw-r--r--examples/designer/doc/images/taskmenuextension-dialog.pngbin15163 -> 0 bytes
-rw-r--r--examples/designer/doc/images/taskmenuextension-dialog.webpbin0 -> 20384 bytes
-rw-r--r--examples/designer/doc/images/taskmenuextension-example-faded.pngbin5596 -> 0 bytes
-rw-r--r--examples/designer/doc/images/taskmenuextension-example.pngbin5014 -> 0 bytes
-rw-r--r--examples/designer/doc/images/taskmenuextension-example.webpbin0 -> 20164 bytes
-rw-r--r--examples/designer/doc/images/taskmenuextension-menu.pngbin3067 -> 0 bytes
-rw-r--r--examples/designer/doc/images/taskmenuextension-menu.webpbin0 -> 18886 bytes
-rw-r--r--examples/designer/doc/images/worldtimeclock-connection.pngbin12119 -> 0 bytes
-rw-r--r--examples/designer/doc/images/worldtimeclock-signalandslot.pngbin9907 -> 0 bytes
-rw-r--r--examples/designer/doc/images/worldtimeclockbuilder-example.pngbin8168 -> 0 bytes
-rw-r--r--examples/designer/doc/images/worldtimeclockplugin-example.pngbin13232 -> 0 bytes
-rw-r--r--examples/designer/doc/snippets/doc_src_examples_containerextension.pro51
-rw-r--r--examples/designer/doc/snippets/doc_src_examples_customwidgetplugin.pro51
-rw-r--r--examples/designer/doc/snippets/doc_src_examples_taskmenuextension.pro51
-rw-r--r--examples/designer/doc/snippets/doc_src_examples_worldtimeclockplugin.pro54
-rw-r--r--examples/designer/doc/src/calculatorbuilder.qdoc92
-rw-r--r--examples/designer/doc/src/calculatorform.qdoc81
-rw-r--r--examples/designer/doc/src/calculatorform_mi.qdoc74
-rw-r--r--examples/designer/doc/src/containerextension.qdoc125
-rw-r--r--examples/designer/doc/src/customwidgetplugin.qdoc126
-rw-r--r--examples/designer/doc/src/taskmenuextension.qdoc120
-rw-r--r--examples/designer/doc/src/worldtimeclockbuilder.qdoc97
-rw-r--r--examples/designer/doc/src/worldtimeclockplugin.qdoc188
-rw-r--r--examples/designer/taskmenuextension/.prev_CMakeLists.txt44
-rw-r--r--examples/designer/taskmenuextension/CMakeLists.txt42
-rw-r--r--examples/designer/taskmenuextension/taskmenuextension.pro21
-rw-r--r--examples/designer/taskmenuextension/tictactoe.cpp55
-rw-r--r--examples/designer/taskmenuextension/tictactoe.h51
-rw-r--r--examples/designer/taskmenuextension/tictactoedialog.cpp59
-rw-r--r--examples/designer/taskmenuextension/tictactoedialog.h51
-rw-r--r--examples/designer/taskmenuextension/tictactoeplugin.cpp77
-rw-r--r--examples/designer/taskmenuextension/tictactoeplugin.h51
-rw-r--r--examples/designer/taskmenuextension/tictactoetaskmenu.cpp53
-rw-r--r--examples/designer/taskmenuextension/tictactoetaskmenu.h51
-rw-r--r--examples/designer/worldtimeclockbuilder/CMakeLists.txt54
-rw-r--r--examples/designer/worldtimeclockbuilder/form.ui162
-rw-r--r--examples/designer/worldtimeclockbuilder/main.cpp80
-rw-r--r--examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro8
-rw-r--r--examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.qrc5
-rw-r--r--examples/designer/worldtimeclockplugin/.prev_CMakeLists.txt42
-rw-r--r--examples/designer/worldtimeclockplugin/CMakeLists.txt45
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclock.cpp131
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclock.h82
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp130
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclockplugin.h86
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro30
91 files changed, 1061 insertions, 3397 deletions
diff --git a/examples/designer/CMakeLists.txt b/examples/designer/CMakeLists.txt
index f5de4c52f..d7c90bda1 100644
--- a/examples/designer/CMakeLists.txt
+++ b/examples/designer/CMakeLists.txt
@@ -1,19 +1,18 @@
-# Generated from designer.pro.
-
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
qt_exclude_tool_directories_from_default_target(
containerextension
taskmenuextension
)
-add_subdirectory(calculatorform)
+qt_internal_add_example(calculatorform)
+qt_internal_add_example(calculatorform_mi)
if(QT_BUILD_SHARED_LIBS AND NOT solaris-cc_x_)
- add_subdirectory(calculatorbuilder)
- add_subdirectory(worldtimeclockbuilder)
+ qt_internal_add_example(calculatorbuilder)
endif()
-if(QT_BUILD_SHARED_LIBS)
- add_subdirectory(containerextension)
- add_subdirectory(customwidgetplugin)
- add_subdirectory(taskmenuextension)
- add_subdirectory(worldtimeclockplugin)
+if(QT_BUILD_SHARED_LIBS AND NOT CMAKE_CROSSCOMPILING)
+ qt_internal_add_example(containerextension)
+ qt_internal_add_example(customwidgetplugin)
+ qt_internal_add_example(taskmenuextension)
endif()
diff --git a/examples/designer/README b/examples/designer/README
index 922507442..239383445 100644
--- a/examples/designer/README
+++ b/examples/designer/README
@@ -1,6 +1,6 @@
-Qt Designer is a capable graphical user interface designer that lets you
+Qt Widgets Designer is a capable graphical user interface designer that lets you
create and configure forms without writing code. GUIs created with
-Qt Designer can be compiled into an application or created at run-time.
+Qt Widgets Designer can be compiled into an application or created at run-time.
Some of the examples in this directory can only be used from within Qt
Designer.
diff --git a/examples/designer/calculatorbuilder/CMakeLists.txt b/examples/designer/calculatorbuilder/CMakeLists.txt
index dc1d9de5b..5aa0d90ea 100644
--- a/examples/designer/calculatorbuilder/CMakeLists.txt
+++ b/examples/designer/calculatorbuilder/CMakeLists.txt
@@ -1,45 +1,42 @@
-# Generated from calculatorbuilder.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(calculatorbuilder 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")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/designer/calculatorbuilder")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiTools)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui UiTools Widgets)
+
+qt_add_executable(calculatorbuilder main.cpp)
-qt_add_executable(calculatorbuilder
- calculatorform.cpp calculatorform.h
- main.cpp
-)
set_target_properties(calculatorbuilder PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
+#! [0]
target_link_libraries(calculatorbuilder PUBLIC
Qt::Core
Qt::Gui
Qt::UiTools
Qt::Widgets
)
-
+#! [0]
# Resources:
+#! [1]
set(calculatorbuilder_resource_files
"calculatorform.ui"
)
+#! [1]
qt6_add_resources(calculatorbuilder "calculatorbuilder"
PREFIX
diff --git a/examples/designer/calculatorbuilder/calculatorbuilder.pro b/examples/designer/calculatorbuilder/calculatorbuilder.pro
index 052dbd38a..740c31a6c 100644
--- a/examples/designer/calculatorbuilder/calculatorbuilder.pro
+++ b/examples/designer/calculatorbuilder/calculatorbuilder.pro
@@ -1,8 +1,6 @@
#! [0]
-HEADERS = calculatorform.h
RESOURCES = calculatorbuilder.qrc
-SOURCES = calculatorform.cpp \
- main.cpp
+SOURCES = main.cpp
QT += widgets uitools
#! [0]
diff --git a/examples/designer/calculatorbuilder/calculatorform.cpp b/examples/designer/calculatorbuilder/calculatorform.cpp
deleted file mode 100644
index 30a9ac665..000000000
--- a/examples/designer/calculatorbuilder/calculatorform.cpp
+++ /dev/null
@@ -1,104 +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$
-**
-****************************************************************************/
-
-//! [0]
-#include <QtUiTools>
-//! [0]
-#include <QSpinBox>
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QFile>
-
-#include "calculatorform.h"
-
-//! [1]
-CalculatorForm::CalculatorForm(QWidget *parent)
- : QWidget(parent)
-{
- QUiLoader loader;
-
- QFile file(":/forms/calculatorform.ui");
- file.open(QFile::ReadOnly);
- QWidget *formWidget = loader.load(&file, this);
- file.close();
-//! [1]
-
-//! [2]
- ui_inputSpinBox1 = findChild<QSpinBox*>("inputSpinBox1");
- ui_inputSpinBox2 = findChild<QSpinBox*>("inputSpinBox2");
- ui_outputWidget = findChild<QLabel*>("outputWidget");
-//! [2]
-
-//! [3]
- QMetaObject::connectSlotsByName(this);
-//! [3]
-
-//! [4]
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(formWidget);
- setLayout(layout);
-
- setWindowTitle(tr("Calculator Builder"));
-}
-//! [4]
-
-//! [5]
-void CalculatorForm::on_inputSpinBox1_valueChanged(int value)
-{
- ui_outputWidget->setText(QString::number(value + ui_inputSpinBox2->value()));
-}
-//! [5] //! [6]
-
-//! [6] //! [7]
-void CalculatorForm::on_inputSpinBox2_valueChanged(int value)
-{
- ui_outputWidget->setText(QString::number(value + ui_inputSpinBox1->value()));
-}
-//! [7]
diff --git a/examples/designer/calculatorbuilder/calculatorform.h b/examples/designer/calculatorbuilder/calculatorform.h
deleted file mode 100644
index 1a1f00c8c..000000000
--- a/examples/designer/calculatorbuilder/calculatorform.h
+++ /dev/null
@@ -1,80 +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 CALCULATORFORM_H
-#define CALCULATORFORM_H
-
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-class QLabel;
-class QSpinBox;
-QT_END_NAMESPACE
-
-//! [0]
-class CalculatorForm : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit CalculatorForm(QWidget *parent = nullptr);
-
-private slots:
- void on_inputSpinBox1_valueChanged(int value);
- void on_inputSpinBox2_valueChanged(int value);
-
-private:
- QSpinBox *ui_inputSpinBox1;
- QSpinBox *ui_inputSpinBox2;
- QLabel *ui_outputWidget;
-};
-//! [0]
-
-#endif
diff --git a/examples/designer/calculatorbuilder/main.cpp b/examples/designer/calculatorbuilder/main.cpp
index 82c0c6f58..78d071e4e 100644
--- a/examples/designer/calculatorbuilder/main.cpp
+++ b/examples/designer/calculatorbuilder/main.cpp
@@ -1,63 +1,67 @@
-/****************************************************************************
-**
-** 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
+
+//! [0]
+#include <QtUiTools>
+//! [0]
#include <QApplication>
+#include <QLabel>
+#include <QSpinBox>
+#include <QVBoxLayout>
-#include "calculatorform.h"
+#include <QFile>
-int main(int argc, char *argv[])
+#include <memory>
+
+using namespace Qt::StringLiterals;
+
+//! [1]
+static QWidget *loadCalculatorForm(QWidget *parent = nullptr)
{
- Q_INIT_RESOURCE(calculatorbuilder);
+ QUiLoader loader;
+
+ QFile file(u":/forms/calculatorform.ui"_s);
+ if (!file.open(QFile::ReadOnly))
+ return nullptr;
+ QWidget *formWidget = loader.load(&file, parent);
+ file.close();
+ if (formWidget == nullptr)
+ return nullptr;
+//! [1]
+
+//! [2]
+ auto *inputSpinBox1 = formWidget->findChild<QSpinBox*>(u"inputSpinBox1"_s);
+ auto *inputSpinBox2 = formWidget->findChild<QSpinBox*>(u"inputSpinBox2"_s);
+ auto *outputWidget = formWidget->findChild<QLabel*>(u"outputWidget"_s);
+//! [2]
+//! [3]
+ auto updateResult = [inputSpinBox1, inputSpinBox2, outputWidget]()
+ {
+ const int sum = inputSpinBox1->value() + inputSpinBox2->value();
+ outputWidget->setText(QString::number(sum));
+ };
+ QObject::connect(inputSpinBox1, &QSpinBox::valueChanged, formWidget, updateResult);
+ QObject::connect(inputSpinBox2, &QSpinBox::valueChanged, formWidget, updateResult);
+//! [3]
+
+ return formWidget;
+}
+
+int main(int argc, char *argv[])
+{
QApplication app(argc, argv);
- CalculatorForm calculator;
- calculator.show();
+ QWidget w;
+ auto *formWidget = loadCalculatorForm(&w);
+ if (formWidget == nullptr)
+ return -1;
+ //! [4]
+ auto *layout = new QVBoxLayout(&w);
+ layout->addWidget(formWidget);
+ w.setWindowTitle(QCoreApplication::translate("CalculatorForm",
+ "Calculator Builder"));
+ //! [4]
+ w.show();
return app.exec();
}
diff --git a/examples/designer/calculatorform/CMakeLists.txt b/examples/designer/calculatorform/CMakeLists.txt
index 7034d6b17..c07ed3d69 100644
--- a/examples/designer/calculatorform/CMakeLists.txt
+++ b/examples/designer/calculatorform/CMakeLists.txt
@@ -1,32 +1,34 @@
-# Generated from calculatorform.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(calculatorform LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
+#! [0]
set(CMAKE_AUTOUIC ON)
+#! [0]
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/designer/calculatorform")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+#! [1]
qt_add_executable(calculatorform
calculatorform.cpp calculatorform.h calculatorform.ui
main.cpp
)
+#! [1]
+
set_target_properties(calculatorform PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(calculatorform PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/designer/calculatorform/calculatorform.cpp b/examples/designer/calculatorform/calculatorform.cpp
index 1b7ff26ba..24ce24a61 100644
--- a/examples/designer/calculatorform/calculatorform.cpp
+++ b/examples/designer/calculatorform/calculatorform.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 "calculatorform.h"
@@ -55,19 +8,15 @@ CalculatorForm::CalculatorForm(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
+ connect(ui.inputSpinBox1, &QSpinBox::valueChanged, this, &CalculatorForm::updateResult);
+ connect(ui.inputSpinBox2, &QSpinBox::valueChanged, this, &CalculatorForm::updateResult);
}
//! [0]
//! [1]
-void CalculatorForm::on_inputSpinBox1_valueChanged(int value)
+void CalculatorForm::updateResult()
{
- ui.outputWidget->setText(QString::number(value + ui.inputSpinBox2->value()));
+ const int sum = ui.inputSpinBox1->value() + ui.inputSpinBox2->value();
+ ui.outputWidget->setText(QString::number(sum));
}
//! [1]
-
-//! [2]
-void CalculatorForm::on_inputSpinBox2_valueChanged(int value)
-{
- ui.outputWidget->setText(QString::number(value + ui.inputSpinBox1->value()));
-}
-//! [2]
diff --git a/examples/designer/calculatorform/calculatorform.h b/examples/designer/calculatorform/calculatorform.h
index a521b0c73..9224ba027 100644
--- a/examples/designer/calculatorform/calculatorform.h
+++ b/examples/designer/calculatorform/calculatorform.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 CALCULATORFORM_H
#define CALCULATORFORM_H
@@ -64,8 +17,7 @@ public:
explicit CalculatorForm(QWidget *parent = nullptr);
private slots:
- void on_inputSpinBox1_valueChanged(int value);
- void on_inputSpinBox2_valueChanged(int value);
+ void updateResult();
private:
Ui::CalculatorForm ui;
diff --git a/examples/designer/calculatorform/main.cpp b/examples/designer/calculatorform/main.cpp
index 10329f9c9..893c90bbe 100644
--- a/examples/designer/calculatorform/main.cpp
+++ b/examples/designer/calculatorform/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/designer/calculatorform_mi/CMakeLists.txt b/examples/designer/calculatorform_mi/CMakeLists.txt
new file mode 100644
index 000000000..1123a05ba
--- /dev/null
+++ b/examples/designer/calculatorform_mi/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(calculatorform_mi LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/designer/calculatorform_mi")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(calculatorform_mi
+ calculatorform.cpp calculatorform.h calculatorform.ui
+ main.cpp
+)
+
+set_target_properties(calculatorform_mi PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(calculatorform_mi PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS calculatorform_mi
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/calculatorform_mi/calculatorform.cpp b/examples/designer/calculatorform_mi/calculatorform.cpp
new file mode 100644
index 000000000..6a877de7e
--- /dev/null
+++ b/examples/designer/calculatorform_mi/calculatorform.cpp
@@ -0,0 +1,28 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "calculatorform.h"
+#include <QWidget>
+
+
+//! [0]
+CalculatorForm::CalculatorForm(QWidget *parent)
+ : QWidget(parent)
+{
+ setupUi(this);
+}
+//! [0]
+
+//! [1]
+void CalculatorForm::on_inputSpinBox1_valueChanged(int value)
+{
+ outputWidget->setText(QString::number(value + inputSpinBox2->value()));
+}
+//! [1]
+
+//! [2]
+void CalculatorForm::on_inputSpinBox2_valueChanged(int value)
+{
+ outputWidget->setText(QString::number(value + inputSpinBox1->value()));
+}
+//! [2]
diff --git a/examples/designer/calculatorform_mi/calculatorform.h b/examples/designer/calculatorform_mi/calculatorform.h
new file mode 100644
index 000000000..aba28c2ce
--- /dev/null
+++ b/examples/designer/calculatorform_mi/calculatorform.h
@@ -0,0 +1,25 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef CALCULATORFORM_H
+#define CALCULATORFORM_H
+
+//! [0]
+#include "ui_calculatorform.h"
+//! [0]
+
+//! [1]
+class CalculatorForm : public QWidget, private Ui::CalculatorForm
+{
+ Q_OBJECT
+
+public:
+ explicit CalculatorForm(QWidget *parent = nullptr);
+
+private slots:
+ void on_inputSpinBox1_valueChanged(int value);
+ void on_inputSpinBox2_valueChanged(int value);
+};
+//! [1]
+
+#endif
diff --git a/examples/designer/calculatorform_mi/calculatorform.ui b/examples/designer/calculatorform_mi/calculatorform.ui
new file mode 100644
index 000000000..9bcca91b2
--- /dev/null
+++ b/examples/designer/calculatorform_mi/calculatorform.ui
@@ -0,0 +1,303 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>CalculatorForm</class>
+ <widget class="QWidget" name="CalculatorForm" >
+ <property name="objectName" >
+ <string notr="true" >CalculatorForm</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>276</width>
+ <height>98</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Calculator Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="objectName" >
+ <string notr="true" >label</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>45</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Input 1</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="inputSpinBox1" >
+ <property name="objectName" >
+ <string notr="true" >inputSpinBox1</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>26</y>
+ <width>45</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property name="mouseTracking" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3" >
+ <property name="objectName" >
+ <string notr="true" >label_3</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>54</x>
+ <y>1</y>
+ <width>7</width>
+ <height>52</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>+</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="objectName" >
+ <string notr="true" >label_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>45</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Input 2</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="inputSpinBox2" >
+ <property name="objectName" >
+ <string notr="true" >inputSpinBox2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>26</y>
+ <width>45</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property name="mouseTracking" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3_2" >
+ <property name="objectName" >
+ <string notr="true" >label_3_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>1</y>
+ <width>7</width>
+ <height>52</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>=</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2_2_2" >
+ <property name="objectName" >
+ <string notr="true" >label_2_2_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>37</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Output</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="outputWidget" >
+ <property name="objectName" >
+ <string notr="true" >outputWidget</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>24</y>
+ <width>37</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text" >
+ <string>0</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="objectName" >
+ <string notr="true" >verticalSpacer</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>85</x>
+ <y>69</y>
+ <width>20</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1" >
+ <spacer>
+ <property name="objectName" >
+ <string notr="true" >horizontalSpacer</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>188</x>
+ <y>26</y>
+ <width>79</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/designer/calculatorform_mi/calculatorform_mi.pro b/examples/designer/calculatorform_mi/calculatorform_mi.pro
new file mode 100644
index 000000000..c0f50316e
--- /dev/null
+++ b/examples/designer/calculatorform_mi/calculatorform_mi.pro
@@ -0,0 +1,11 @@
+#! [0]
+QT += widgets
+
+HEADERS = calculatorform.h
+SOURCES = calculatorform.cpp main.cpp
+FORMS = calculatorform.ui
+#! [0]
+
+target.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorform_mi
+INSTALLS += target
+
diff --git a/examples/designer/calculatorform_mi/main.cpp b/examples/designer/calculatorform_mi/main.cpp
new file mode 100644
index 000000000..d6b0aee09
--- /dev/null
+++ b/examples/designer/calculatorform_mi/main.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "calculatorform.h"
+#include <QApplication>
+
+//! [0]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ CalculatorForm calculator;
+ calculator.show();
+ return app.exec();
+}
+//! [0]
diff --git a/examples/designer/containerextension/.prev_CMakeLists.txt b/examples/designer/containerextension/.prev_CMakeLists.txt
deleted file mode 100644
index 3225c4093..000000000
--- a/examples/designer/containerextension/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from containerextension.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(containerextension 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}")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Designer)
-
-qt_add_executable(containerextension
- multipagewidget.cpp multipagewidget.h
- multipagewidgetcontainerextension.cpp multipagewidgetcontainerextension.h
- multipagewidgetextensionfactory.cpp multipagewidgetextensionfactory.h
- multipagewidgetplugin.cpp multipagewidgetplugin.h
-)
-set_target_properties(containerextension PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(containerextension PUBLIC
- Qt::Core
- Qt::Designer
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS containerextension
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/designer/containerextension/CMakeLists.txt b/examples/designer/containerextension/CMakeLists.txt
index efc0e8ef7..2b2c150e3 100644
--- a/examples/designer/containerextension/CMakeLists.txt
+++ b/examples/designer/containerextension/CMakeLists.txt
@@ -1,47 +1,55 @@
-# Generated from containerextension.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(containerextension 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}/plugins/designer") # special case
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Designer)
+#! [0]
+find_package(Qt6 REQUIRED COMPONENTS Core Designer Gui Widgets)
-# special case begin
qt_add_plugin(containerextension)
+#! [0]
+
+#! [1]
target_sources(containerextension PRIVATE
multipagewidget.cpp multipagewidget.h
multipagewidgetcontainerextension.cpp multipagewidgetcontainerextension.h
multipagewidgetextensionfactory.cpp multipagewidgetextensionfactory.h
multipagewidgetplugin.cpp multipagewidgetplugin.h
)
-# special case end
+#! [1]
+
set_target_properties(containerextension PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
+#! [2]
target_link_libraries(containerextension PUBLIC
Qt::Core
Qt::Designer
Qt::Gui
Qt::Widgets
)
+#! [2]
+
+if(QT6_INSTALL_PREFIX)
+#! [3]
+ set(INSTALL_EXAMPLEDIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_PLUGINS}/designer")
+#! [3]
+else()
+ if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+ endif()
+ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer")
+endif()
+#! [4]
install(TARGETS containerextension
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+#! [4]
diff --git a/examples/designer/containerextension/containerextension.pro b/examples/designer/containerextension/containerextension.pro
index 39b6dc2a2..bf7b18e97 100644
--- a/examples/designer/containerextension/containerextension.pro
+++ b/examples/designer/containerextension/containerextension.pro
@@ -1,12 +1,3 @@
-QTDIR_build {
-# This is only for the Qt build. Do not use externally. We mean it.
-PLUGIN_TYPE = designer
-PLUGIN_CLASS_NAME = MultiPageWidgetPlugin
-load(qt_plugin)
-CONFIG += install_ok
-} else {
-# Public example:
-
#! [0]
TEMPLATE = lib
CONFIG += plugin
@@ -14,10 +5,10 @@ CONFIG += plugin
TARGET = $$qtLibraryTarget($$TARGET)
+#! [3]
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-
-}
+#! [3]
#! [1]
QT += widgets designer
diff --git a/examples/designer/containerextension/multipagewidget.cpp b/examples/designer/containerextension/multipagewidget.cpp
index d73d3972b..c4131ba67 100644
--- a/examples/designer/containerextension/multipagewidget.cpp
+++ b/examples/designer/containerextension/multipagewidget.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 <QComboBox>
#include <QVBoxLayout>
@@ -59,19 +12,19 @@ MultiPageWidget::MultiPageWidget(QWidget *parent)
, stackWidget(new QStackedWidget)
, comboBox(new QComboBox)
{
- comboBox->setObjectName(QStringLiteral("__qt__passive_comboBox"));
+ comboBox->setObjectName("__qt__passive_comboBox");
- connect(comboBox, QOverload<int>::of(&QComboBox::activated),
+ connect(comboBox, &QComboBox::activated,
this, &MultiPageWidget::setCurrentIndex);
- QVBoxLayout *layout = new QVBoxLayout(this);
+ auto *layout = new QVBoxLayout(this);
layout->addWidget(comboBox);
layout->addWidget(stackWidget);
}
QSize MultiPageWidget::sizeHint() const
{
- return QSize(200, 150);
+ return {200, 150};
}
void MultiPageWidget::addPage(QWidget *page)
@@ -81,7 +34,7 @@ void MultiPageWidget::addPage(QWidget *page)
void MultiPageWidget::removePage(int index)
{
- QWidget *widget = stackWidget->widget(index);
+ auto *widget = stackWidget->widget(index);
stackWidget->removeWidget(widget);
comboBox->removeItem(index);
@@ -138,10 +91,10 @@ QString MultiPageWidget::pageTitle() const
{
if (const QWidget *currentWidget = stackWidget->currentWidget())
return currentWidget->windowTitle();
- return QString();
+ return {};
}
-void MultiPageWidget::setPageTitle(QString const &newTitle)
+void MultiPageWidget::setPageTitle(const QString &newTitle)
{
if (QWidget *currentWidget = stackWidget->currentWidget())
currentWidget->setWindowTitle(newTitle);
diff --git a/examples/designer/containerextension/multipagewidget.h b/examples/designer/containerextension/multipagewidget.h
index ed83fc3aa..788aaa67e 100644
--- a/examples/designer/containerextension/multipagewidget.h
+++ b/examples/designer/containerextension/multipagewidget.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 MULTIPAGEWIDGET_H
#define MULTIPAGEWIDGET_H
@@ -79,7 +32,7 @@ public slots:
void addPage(QWidget *page);
void insertPage(int index, QWidget *page);
void removePage(int index);
- void setPageTitle(QString const &newTitle);
+ void setPageTitle(const QString &newTitle);
void setCurrentIndex(int index);
private slots:
diff --git a/examples/designer/containerextension/multipagewidgetcontainerextension.cpp b/examples/designer/containerextension/multipagewidgetcontainerextension.cpp
index 2c8eff6bd..d94e91a0e 100644
--- a/examples/designer/containerextension/multipagewidgetcontainerextension.cpp
+++ b/examples/designer/containerextension/multipagewidgetcontainerextension.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 "multipagewidgetcontainerextension.h"
#include "multipagewidget.h"
diff --git a/examples/designer/containerextension/multipagewidgetcontainerextension.h b/examples/designer/containerextension/multipagewidgetcontainerextension.h
index 47814c692..cecef3650 100644
--- a/examples/designer/containerextension/multipagewidgetcontainerextension.h
+++ b/examples/designer/containerextension/multipagewidgetcontainerextension.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 MULTIPAGEWIDGETCONTAINEREXTENSION_H
#define MULTIPAGEWIDGETCONTAINEREXTENSION_H
diff --git a/examples/designer/containerextension/multipagewidgetextensionfactory.cpp b/examples/designer/containerextension/multipagewidgetextensionfactory.cpp
index 09c228e87..746fe3111 100644
--- a/examples/designer/containerextension/multipagewidgetextensionfactory.cpp
+++ b/examples/designer/containerextension/multipagewidgetextensionfactory.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 "multipagewidgetextensionfactory.h"
#include "multipagewidgetcontainerextension.h"
@@ -63,7 +16,7 @@ QObject *MultiPageWidgetExtensionFactory::createExtension(QObject *object,
const QString &iid,
QObject *parent) const
{
- MultiPageWidget *widget = qobject_cast<MultiPageWidget*>(object);
+ auto *widget = qobject_cast<MultiPageWidget*>(object);
if (widget && (iid == Q_TYPEID(QDesignerContainerExtension)))
return new MultiPageWidgetContainerExtension(widget, parent);
diff --git a/examples/designer/containerextension/multipagewidgetextensionfactory.h b/examples/designer/containerextension/multipagewidgetextensionfactory.h
index bb26f40eb..9610715d6 100644
--- a/examples/designer/containerextension/multipagewidgetextensionfactory.h
+++ b/examples/designer/containerextension/multipagewidgetextensionfactory.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 MULTIPAGEWIDGETEXTENSIONFACTORY_H
#define MULTIPAGEWIDGETEXTENSIONFACTORY_H
diff --git a/examples/designer/containerextension/multipagewidgetplugin.cpp b/examples/designer/containerextension/multipagewidgetplugin.cpp
index a5a3272b5..fe0e8da16 100644
--- a/examples/designer/containerextension/multipagewidgetplugin.cpp
+++ b/examples/designer/containerextension/multipagewidgetplugin.cpp
@@ -1,52 +1,9 @@
-/****************************************************************************
-**
-** 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 "multipagewidget.h"
+#include "multipagewidgetplugin.h"
+#include "multipagewidgetextensionfactory.h"
#include <QtDesigner/QExtensionFactory>
#include <QtDesigner/QExtensionManager>
@@ -58,9 +15,7 @@
#include <QIcon>
#include <QtPlugin>
-#include "multipagewidget.h"
-#include "multipagewidgetplugin.h"
-#include "multipagewidgetextensionfactory.h"
+using namespace Qt::StringLiterals;
//! [0]
MultiPageWidgetPlugin::MultiPageWidgetPlugin(QObject *parent)
@@ -70,32 +25,32 @@ MultiPageWidgetPlugin::MultiPageWidgetPlugin(QObject *parent)
QString MultiPageWidgetPlugin::name() const
{
- return QLatin1String("MultiPageWidget");
+ return u"MultiPageWidget"_s;
}
QString MultiPageWidgetPlugin::group() const
{
- return QLatin1String("Display Widgets [Examples]");
+ return u"Display Widgets [Examples]"_s;
}
QString MultiPageWidgetPlugin::toolTip() const
{
- return QString();
+ return {};
}
QString MultiPageWidgetPlugin::whatsThis() const
{
- return QString();
+ return {};
}
QString MultiPageWidgetPlugin::includeFile() const
{
- return QLatin1String("multipagewidget.h");
+ return u"multipagewidget.h"_s;
}
QIcon MultiPageWidgetPlugin::icon() const
{
- return QIcon();
+ return {};
}
//! [0] //! [1]
@@ -107,7 +62,7 @@ bool MultiPageWidgetPlugin::isContainer() const
//! [1] //! [2]
QWidget *MultiPageWidgetPlugin::createWidget(QWidget *parent)
{
- MultiPageWidget *widget = new MultiPageWidget(parent);
+ auto *widget = new MultiPageWidget(parent);
connect(widget, &MultiPageWidget::currentIndexChanged,
this, &MultiPageWidgetPlugin::currentIndexChanged);
connect(widget, &MultiPageWidget::pageTitleChanged,
@@ -130,11 +85,11 @@ void MultiPageWidgetPlugin::initialize(QDesignerFormEditorInterface *formEditor)
//! [4]
//! [5]
- QExtensionManager *manager = formEditor->extensionManager();
+ auto *manager = formEditor->extensionManager();
//! [5] //! [6]
- QExtensionFactory *factory = new MultiPageWidgetExtensionFactory(manager);
+ auto *factory = new MultiPageWidgetExtensionFactory(manager);
- Q_ASSERT(manager != 0);
+ Q_ASSERT(manager != nullptr);
manager->registerExtensions(factory, Q_TYPEID(QDesignerContainerExtension));
initialized = true;
@@ -144,10 +99,10 @@ void MultiPageWidgetPlugin::initialize(QDesignerFormEditorInterface *formEditor)
//! [7]
QString MultiPageWidgetPlugin::domXml() const
{
- return QLatin1String(R"(
+ return uR"(
<ui language="c++">
<widget class="MultiPageWidget" name="multipagewidget">
- <widget class="QWidget" name="page" />
+ <widget class="QWidget" name="page"/>
</widget>
<customwidgets>
<customwidget>
@@ -156,7 +111,7 @@ QString MultiPageWidgetPlugin::domXml() const
<addpagemethod>addPage</addpagemethod>
</customwidget>
</customwidgets>
-</ui>)");
+</ui>)"_s;
}
//! [7]
@@ -164,10 +119,10 @@ QString MultiPageWidgetPlugin::domXml() const
void MultiPageWidgetPlugin::currentIndexChanged(int index)
{
Q_UNUSED(index);
- MultiPageWidget *widget = qobject_cast<MultiPageWidget*>(sender());
+ auto *widget = qobject_cast<MultiPageWidget*>(sender());
//! [8] //! [9]
if (widget) {
- QDesignerFormWindowInterface *form = QDesignerFormWindowInterface::findFormWindow(widget);
+ auto *form = QDesignerFormWindowInterface::findFormWindow(widget);
if (form)
form->emitSelectionChanged();
}
@@ -178,20 +133,18 @@ void MultiPageWidgetPlugin::currentIndexChanged(int index)
void MultiPageWidgetPlugin::pageTitleChanged(const QString &title)
{
Q_UNUSED(title);
- MultiPageWidget *widget = qobject_cast<MultiPageWidget*>(sender());
+ auto *widget = qobject_cast<MultiPageWidget*>(sender());
//! [10] //! [11]
if (widget) {
- QWidget *page = widget->widget(widget->currentIndex());
- QDesignerFormWindowInterface *form;
- form = QDesignerFormWindowInterface::findFormWindow(widget);
+ auto *page = widget->widget(widget->currentIndex());
+ auto *form = QDesignerFormWindowInterface::findFormWindow(widget);
//! [11]
if (form) {
//! [12]
- QDesignerFormEditorInterface *editor = form->core();
- QExtensionManager *manager = editor->extensionManager();
+ auto *editor = form->core();
+ auto *manager = editor->extensionManager();
//! [12] //! [13]
- QDesignerPropertySheetExtension *sheet;
- sheet = qt_extension<QDesignerPropertySheetExtension*>(manager, page);
+ auto *sheet = qt_extension<QDesignerPropertySheetExtension*>(manager, page);
const int propertyIndex = sheet->indexOf(QLatin1String("windowTitle"));
sheet->setChanged(propertyIndex, true);
}
diff --git a/examples/designer/containerextension/multipagewidgetplugin.h b/examples/designer/containerextension/multipagewidgetplugin.h
index a5dace524..f26f74320 100644
--- a/examples/designer/containerextension/multipagewidgetplugin.h
+++ b/examples/designer/containerextension/multipagewidgetplugin.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
//! [0]
#ifndef MULTIPAGEWIDGETPLUGIN_H
diff --git a/examples/designer/customwidgetplugin/.prev_CMakeLists.txt b/examples/designer/customwidgetplugin/.prev_CMakeLists.txt
deleted file mode 100644
index 1e25517f8..000000000
--- a/examples/designer/customwidgetplugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from customwidgetplugin.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(customwidgetplugin 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}")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiPlugin)
-
-qt_add_executable(customwidgetplugin
- analogclock.cpp analogclock.h
- customwidgetplugin.cpp customwidgetplugin.h
-)
-set_target_properties(customwidgetplugin PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(customwidgetplugin PUBLIC
- Qt::Core
- Qt::Gui
- Qt::UiPlugin
- Qt::Widgets
-)
-
-install(TARGETS customwidgetplugin
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/designer/customwidgetplugin/CMakeLists.txt b/examples/designer/customwidgetplugin/CMakeLists.txt
index ca2b0448b..259661c1f 100644
--- a/examples/designer/customwidgetplugin/CMakeLists.txt
+++ b/examples/designer/customwidgetplugin/CMakeLists.txt
@@ -1,45 +1,53 @@
-# Generated from customwidgetplugin.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(customwidgetplugin 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}/plugins/designer") # special case
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiPlugin)
+#! [0]
+find_package(Qt6 REQUIRED COMPONENTS Core Gui UiPlugin Widgets)
-# special case begin
qt_add_plugin(customwidgetplugin)
+#! [0]
+
+#! [1]
target_sources(customwidgetplugin PRIVATE
analogclock.cpp analogclock.h
customwidgetplugin.cpp customwidgetplugin.h
)
-# special case end
+#! [1]
+
set_target_properties(customwidgetplugin PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
+#! [2]
target_link_libraries(customwidgetplugin PUBLIC
Qt::Core
Qt::Gui
Qt::UiPlugin
Qt::Widgets
)
+#! [2]
+
+if(QT6_INSTALL_PREFIX)
+#! [3]
+ set(INSTALL_EXAMPLEDIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_PLUGINS}/designer")
+#! [3]
+else()
+ if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+ endif()
+ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer")
+endif()
+#! [4]
install(TARGETS customwidgetplugin
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+#! [4]
diff --git a/examples/designer/customwidgetplugin/analogclock.cpp b/examples/designer/customwidgetplugin/analogclock.cpp
index 713d24e5e..590fe6efa 100644
--- a/examples/designer/customwidgetplugin/analogclock.cpp
+++ b/examples/designer/customwidgetplugin/analogclock.cpp
@@ -1,57 +1,11 @@
-/****************************************************************************
-**
-** 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 "analogclock.h"
#include <QMouseEvent>
#include <QPainter>
+
#include <QTime>
#include <QTimer>
@@ -59,7 +13,7 @@ AnalogClock::AnalogClock(QWidget *parent)
: QWidget(parent)
{
QTimer *timer = new QTimer(this);
- connect(timer, &QTimer::timeout, this, QOverload<>::of(&QWidget::update));
+ connect(timer, &QTimer::timeout, this, qOverload<>(&QWidget::update));
timer->start(1000);
setWindowTitle(tr("Analog Clock"));
@@ -68,56 +22,71 @@ AnalogClock::AnalogClock(QWidget *parent)
void AnalogClock::paintEvent(QPaintEvent *)
{
- static const QPoint hourHand[3] = {
- QPoint(7, 8),
- QPoint(-7, 8),
- QPoint(0, -40)
+ static const QPoint hourHand[4] = {
+ QPoint(5, 14),
+ QPoint(-5, 14),
+ QPoint(-4, -71),
+ QPoint(4, -71)
+ };
+ static const QPoint minuteHand[4] = {
+ QPoint(4, 14),
+ QPoint(-4, 14),
+ QPoint(-3, -89),
+ QPoint(3, -89)
};
- static const QPoint minuteHand[3] = {
- QPoint(7, 8),
- QPoint(-7, 8),
- QPoint(0, -70)
+ static const QPoint secondsHand[4] = {
+ QPoint(1, 14),
+ QPoint(-1, 14),
+ QPoint(-1, -89),
+ QPoint(1, -89)
};
- QColor hourColor(127, 0, 127);
- QColor minuteColor(0, 127, 127, 191);
+ const QColor hourColor(palette().color(QPalette::Text));
+ const QColor minuteColor(palette().color(QPalette::Text));
+ const QColor secondsColor(palette().color(QPalette::Accent));
int side = qMin(width(), height());
- QTime time = QTime::currentTime();
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.translate(width() / 2, height() / 2);
painter.scale(side / 200.0, side / 200.0);
+ QTime time = QTime::currentTime();
+
painter.setPen(Qt::NoPen);
painter.setBrush(hourColor);
painter.save();
painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0)));
- painter.drawConvexPolygon(hourHand, 3);
+ painter.drawConvexPolygon(hourHand, 4);
painter.restore();
- painter.setPen(hourColor);
-
for (int i = 0; i < 12; ++i) {
- painter.drawLine(88, 0, 96, 0);
+ painter.drawRect(73, -3, 16, 6);
painter.rotate(30.0);
}
- painter.setPen(Qt::NoPen);
painter.setBrush(minuteColor);
painter.save();
- painter.rotate(6.0 * (time.minute() + time.second() / 60.0));
- painter.drawConvexPolygon(minuteHand, 3);
+ painter.rotate(6.0 * time.minute());
+ painter.drawConvexPolygon(minuteHand, 4);
+ painter.restore();
+
+ painter.setBrush(secondsColor);
+
+ painter.save();
+ painter.rotate(6.0 * time.second());
+ painter.drawConvexPolygon(secondsHand, 4);
+ painter.drawEllipse(-3, -3, 6, 6);
+ painter.drawEllipse(-5, -68, 10, 10);
painter.restore();
painter.setPen(minuteColor);
for (int j = 0; j < 60; ++j) {
- if ((j % 5) != 0)
- painter.drawLine(92, 0, 96, 0);
+ painter.drawLine(92, 0, 96, 0);
painter.rotate(6.0);
}
}
diff --git a/examples/designer/customwidgetplugin/analogclock.h b/examples/designer/customwidgetplugin/analogclock.h
index cf2d854b3..c3eabf584 100644
--- a/examples/designer/customwidgetplugin/analogclock.h
+++ b/examples/designer/customwidgetplugin/analogclock.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 ANALOGCLOCK_H
#define ANALOGCLOCK_H
@@ -54,15 +7,19 @@
#include <QWidget>
#include <QtUiPlugin/QDesignerExportWidget>
+//! [0]
class QDESIGNER_WIDGET_EXPORT AnalogClock : public QWidget
{
Q_OBJECT
+//! [0]
public:
explicit AnalogClock(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent *event) override;
+//! [1]
};
+//! [1]
#endif
diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.cpp b/examples/designer/customwidgetplugin/customwidgetplugin.cpp
index a728a689c..b85bf4ca0 100644
--- a/examples/designer/customwidgetplugin/customwidgetplugin.cpp
+++ b/examples/designer/customwidgetplugin/customwidgetplugin.cpp
@@ -1,58 +1,13 @@
-/****************************************************************************
-**
-** 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 "analogclock.h"
#include "customwidgetplugin.h"
#include <QtPlugin>
+using namespace Qt::StringLiterals;
+
//! [0]
AnalogClockPlugin::AnalogClockPlugin(QObject *parent)
: QObject(parent)
@@ -87,35 +42,35 @@ QWidget *AnalogClockPlugin::createWidget(QWidget *parent)
//! [4]
QString AnalogClockPlugin::name() const
{
- return QStringLiteral("AnalogClock");
+ return u"AnalogClock"_s;
}
//! [4]
//! [5]
QString AnalogClockPlugin::group() const
{
- return QStringLiteral("Display Widgets [Examples]");
+ return u"Display Widgets [Examples]"_s;
}
//! [5]
//! [6]
QIcon AnalogClockPlugin::icon() const
{
- return QIcon();
+ return {};
}
//! [6]
//! [7]
QString AnalogClockPlugin::toolTip() const
{
- return QString();
+ return {};
}
//! [7]
//! [8]
QString AnalogClockPlugin::whatsThis() const
{
- return QString();
+ return {};
}
//! [8]
@@ -129,7 +84,7 @@ bool AnalogClockPlugin::isContainer() const
//! [10]
QString AnalogClockPlugin::domXml() const
{
- return QLatin1String(R"(
+ return uR"(
<ui language="c++">
<widget class="AnalogClock" name="analogClock">
)"
@@ -154,13 +109,13 @@ R"(
</property>
</widget>
</ui>
-)");
+)"_s;
}
//! [10]
//! [12]
QString AnalogClockPlugin::includeFile() const
{
- return QStringLiteral("analogclock.h");
+ return u"analogclock.h"_s;
}
//! [12]
diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.h b/examples/designer/customwidgetplugin/customwidgetplugin.h
index d9b7c022b..90afe4250 100644
--- a/examples/designer/customwidgetplugin/customwidgetplugin.h
+++ b/examples/designer/customwidgetplugin/customwidgetplugin.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 CUSTOMWIDGETPLUGIN_H
#define CUSTOMWIDGETPLUGIN_H
diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.pro b/examples/designer/customwidgetplugin/customwidgetplugin.pro
index 1447acdc4..07428304b 100644
--- a/examples/designer/customwidgetplugin/customwidgetplugin.pro
+++ b/examples/designer/customwidgetplugin/customwidgetplugin.pro
@@ -1,32 +1,23 @@
-#! [0]
+#! [1]
QT += widgets uiplugin
-#! [0]
+#! [1]
-QTDIR_build {
-# This is only for the Qt build. Do not use externally. We mean it.
-PLUGIN_TYPE = designer
-PLUGIN_CLASS_NAME = AnalogClockPlugin
-load(qt_plugin)
-CONFIG += install_ok
-} else {
-# Public example:
-
-#! [2]
+#! [0]
CONFIG += plugin
TEMPLATE = lib
-#! [2]
+#! [0]
+#! [3]
TARGET = $$qtLibraryTarget($$TARGET)
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-
-}
-
#! [3]
+
+#! [2]
HEADERS = analogclock.h \
customwidgetplugin.h
SOURCES = analogclock.cpp \
customwidgetplugin.cpp
OTHER_FILES += analogclock.json
-#! [3]
+#! [2]
diff --git a/examples/designer/designer.pro b/examples/designer/designer.pro
index 3ffd443e1..3f2f6367f 100644
--- a/examples/designer/designer.pro
+++ b/examples/designer/designer.pro
@@ -1,20 +1,14 @@
TEMPLATE = subdirs
-SUBDIRS = calculatorform
+SUBDIRS = calculatorform \
+ calculatorform_mi
!contains(CONFIG, static) {
SUBDIRS += calculatorbuilder \
containerextension \
customwidgetplugin \
- taskmenuextension \
- worldtimeclockbuilder \
- worldtimeclockplugin
+ taskmenuextension
}
# the sun cc compiler has a problem with the include lines for the form.prf
solaris-cc*:SUBDIRS -= calculatorbuilder \
worldtimeclockbuilder
-
-qtNomakeTools( \
- containerextension \
- taskmenuextension \
-)
diff --git a/examples/designer/doc/images/arthurplugin-demo.png b/examples/designer/doc/images/arthurplugin-demo.png
deleted file mode 100644
index 6d372c258..000000000
--- a/examples/designer/doc/images/arthurplugin-demo.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/calculatorbuilder-example.png b/examples/designer/doc/images/calculatorbuilder-example.png
deleted file mode 100644
index 561e50005..000000000
--- a/examples/designer/doc/images/calculatorbuilder-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/calculatorbuilder-example.webp b/examples/designer/doc/images/calculatorbuilder-example.webp
new file mode 100644
index 000000000..2dabb43e9
--- /dev/null
+++ b/examples/designer/doc/images/calculatorbuilder-example.webp
Binary files differ
diff --git a/examples/designer/doc/images/calculatorform-example.png b/examples/designer/doc/images/calculatorform-example.png
deleted file mode 100644
index 91432ac8b..000000000
--- a/examples/designer/doc/images/calculatorform-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/calculatorform-example.webp b/examples/designer/doc/images/calculatorform-example.webp
new file mode 100644
index 000000000..30fea1ca4
--- /dev/null
+++ b/examples/designer/doc/images/calculatorform-example.webp
Binary files differ
diff --git a/examples/designer/doc/images/containerextension-example.png b/examples/designer/doc/images/containerextension-example.png
deleted file mode 100644
index 2427f9101..000000000
--- a/examples/designer/doc/images/containerextension-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/containerextension-example.webp b/examples/designer/doc/images/containerextension-example.webp
new file mode 100644
index 000000000..b4fe4fde2
--- /dev/null
+++ b/examples/designer/doc/images/containerextension-example.webp
Binary files differ
diff --git a/examples/designer/doc/images/customwidgetplugin-example.png b/examples/designer/doc/images/customwidgetplugin-example.png
deleted file mode 100644
index 87fde81a3..000000000
--- a/examples/designer/doc/images/customwidgetplugin-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/customwidgetplugin-example.webp b/examples/designer/doc/images/customwidgetplugin-example.webp
new file mode 100644
index 000000000..a867ff886
--- /dev/null
+++ b/examples/designer/doc/images/customwidgetplugin-example.webp
Binary files differ
diff --git a/examples/designer/doc/images/taskmenuextension-dialog.png b/examples/designer/doc/images/taskmenuextension-dialog.png
deleted file mode 100644
index 7ad6d40bd..000000000
--- a/examples/designer/doc/images/taskmenuextension-dialog.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/taskmenuextension-dialog.webp b/examples/designer/doc/images/taskmenuextension-dialog.webp
new file mode 100644
index 000000000..25b16044e
--- /dev/null
+++ b/examples/designer/doc/images/taskmenuextension-dialog.webp
Binary files differ
diff --git a/examples/designer/doc/images/taskmenuextension-example-faded.png b/examples/designer/doc/images/taskmenuextension-example-faded.png
deleted file mode 100644
index 7e96f3ad8..000000000
--- a/examples/designer/doc/images/taskmenuextension-example-faded.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/taskmenuextension-example.png b/examples/designer/doc/images/taskmenuextension-example.png
deleted file mode 100644
index f1d46d2b4..000000000
--- a/examples/designer/doc/images/taskmenuextension-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/taskmenuextension-example.webp b/examples/designer/doc/images/taskmenuextension-example.webp
new file mode 100644
index 000000000..667a6d428
--- /dev/null
+++ b/examples/designer/doc/images/taskmenuextension-example.webp
Binary files differ
diff --git a/examples/designer/doc/images/taskmenuextension-menu.png b/examples/designer/doc/images/taskmenuextension-menu.png
deleted file mode 100644
index d626c81da..000000000
--- a/examples/designer/doc/images/taskmenuextension-menu.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/taskmenuextension-menu.webp b/examples/designer/doc/images/taskmenuextension-menu.webp
new file mode 100644
index 000000000..f855f3594
--- /dev/null
+++ b/examples/designer/doc/images/taskmenuextension-menu.webp
Binary files differ
diff --git a/examples/designer/doc/images/worldtimeclock-connection.png b/examples/designer/doc/images/worldtimeclock-connection.png
deleted file mode 100644
index 42c256003..000000000
--- a/examples/designer/doc/images/worldtimeclock-connection.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/worldtimeclock-signalandslot.png b/examples/designer/doc/images/worldtimeclock-signalandslot.png
deleted file mode 100644
index d9d3271f4..000000000
--- a/examples/designer/doc/images/worldtimeclock-signalandslot.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/worldtimeclockbuilder-example.png b/examples/designer/doc/images/worldtimeclockbuilder-example.png
deleted file mode 100644
index 4b91af3ff..000000000
--- a/examples/designer/doc/images/worldtimeclockbuilder-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/images/worldtimeclockplugin-example.png b/examples/designer/doc/images/worldtimeclockplugin-example.png
deleted file mode 100644
index 89481ade8..000000000
--- a/examples/designer/doc/images/worldtimeclockplugin-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/designer/doc/snippets/doc_src_examples_containerextension.pro b/examples/designer/doc/snippets/doc_src_examples_containerextension.pro
index 8f8823abe..903cef948 100644
--- a/examples/designer/doc/snippets/doc_src_examples_containerextension.pro
+++ b/examples/designer/doc/snippets/doc_src_examples_containerextension.pro
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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
#! [0]
target.path = $$[QT_INSTALL_PLUGINS]/designer
diff --git a/examples/designer/doc/snippets/doc_src_examples_customwidgetplugin.pro b/examples/designer/doc/snippets/doc_src_examples_customwidgetplugin.pro
index 8f8823abe..903cef948 100644
--- a/examples/designer/doc/snippets/doc_src_examples_customwidgetplugin.pro
+++ b/examples/designer/doc/snippets/doc_src_examples_customwidgetplugin.pro
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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
#! [0]
target.path = $$[QT_INSTALL_PLUGINS]/designer
diff --git a/examples/designer/doc/snippets/doc_src_examples_taskmenuextension.pro b/examples/designer/doc/snippets/doc_src_examples_taskmenuextension.pro
index 8f8823abe..903cef948 100644
--- a/examples/designer/doc/snippets/doc_src_examples_taskmenuextension.pro
+++ b/examples/designer/doc/snippets/doc_src_examples_taskmenuextension.pro
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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
#! [0]
target.path = $$[QT_INSTALL_PLUGINS]/designer
diff --git a/examples/designer/doc/snippets/doc_src_examples_worldtimeclockplugin.pro b/examples/designer/doc/snippets/doc_src_examples_worldtimeclockplugin.pro
deleted file mode 100644
index 8f8823abe..000000000
--- a/examples/designer/doc/snippets/doc_src_examples_worldtimeclockplugin.pro
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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$
-**
-****************************************************************************/
-
-#! [0]
-target.path = $$[QT_INSTALL_PLUGINS]/designer
-INSTALLS += target
-#! [0]
diff --git a/examples/designer/doc/src/calculatorbuilder.qdoc b/examples/designer/doc/src/calculatorbuilder.qdoc
index c830367a7..eeec5923b 100644
--- a/examples/designer/doc/src/calculatorbuilder.qdoc
+++ b/examples/designer/doc/src/calculatorbuilder.qdoc
@@ -1,38 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example calculatorbuilder
+ \examplecategory {Desktop}
+ \meta tags {widgets,designer}
\ingroup examples-designer
- \title Calculator Builder Example
+ \title Calculator Builder
\brief Creating a user interface from a \QD form at run-time.
- \image calculatorbuilder-example.png
+ \image calculatorbuilder-example.webp
We use the form created in the \l{calculatorform}{Calculator Form}
example to show that the same user interface can be generated when the
@@ -49,36 +27,31 @@
\c QtUiTools module library. The project file we use contains all the
necessary information to do this:
- \snippet calculatorbuilder/calculatorbuilder.pro 0
+ \snippet calculatorbuilder/CMakeLists.txt 0
- All the other necessary files are declared as usual.
+ The UI file is loaded from a resource:
- \section1 CalculatorForm Class Definition
+ \snippet calculatorbuilder/CMakeLists.txt 1
- The \c CalculatorForm class defines the widget used to host the form's
- user interface:
+ For \c qmake:
- \snippet calculatorbuilder/calculatorform.h 0
+ \snippet calculatorbuilder/calculatorbuilder.pro 0
- Note that we do not need to include a header file to describe the user
- interface. We only define two public slots, using the auto-connection
- naming convention required by \c uic, and declare private variables
- that we will use to access widgets provided by the form after they are
- constructed.
+ All the other necessary files are declared as usual.
- \section1 CalculatorForm Class Implementation
+ \section1 Loading the Calculator Form
We will need to use the QUiLoader class that is provided by the
\c libQtUiTools library, so we first ensure that we include the header
file for the module:
- \snippet calculatorbuilder/calculatorform.cpp 0
+ \snippet calculatorbuilder/main.cpp 0
- The constructor uses a form loader object to construct the user
- interface that we retrieve, via a QFile object, from the example's
- resources:
+ We create a static helper function that creates a top level
+ widget and loads the user interface that we retrieve,
+ via a QFile object, from the example's resources:
- \snippet calculatorbuilder/calculatorform.cpp 1
+ \snippet calculatorbuilder/main.cpp 1
By including the user interface in the example's resources, we ensure
that it will be present when the example is run. The \c{loader.load()}
@@ -88,32 +61,27 @@
We are interested in three widgets in the generated user interface:
two spin boxes and a label. For convenience, we retrieve pointers to
these widgets from the widget that was constructed by the \c FormBuilder,
- and we record them for later use. The \c qFindChild() template function
+ and we record them for later use. The \c findChild() template function
allows us to query widgets in order to find named child widgets.
- \snippet calculatorbuilder/calculatorform.cpp 2
+ \snippet calculatorbuilder/main.cpp 2
- The widgets created by the form loader need to be connected to the
- specially-named slots in the \c CalculatorForm object. We use Qt's
- meta-object system to enable these connections:
+ The slot that modifies the output widget provided by the form is defined
+ in a similar way to that in the
+ \l{calculatorform}{Calculator Form} example, except that we use a
+ lambda, capturing the widgets found:
- \snippet calculatorbuilder/calculatorform.cpp 3
+ \snippet calculatorbuilder/main.cpp 3
The form widget is added to a layout, and the window title is set:
- \snippet calculatorbuilder/calculatorform.cpp 4
-
- The two slots that modify widgets provided by the form are defined
- in a similar way to those in the \l{calculatorform}{Calculator
- Form} example, except that we read the values from the spin boxes and
- write the result to the output widget via the pointers we recorded in
- the constructor:
-
- \snippet calculatorbuilder/calculatorform.cpp 5
- \codeline
- \snippet calculatorbuilder/calculatorform.cpp 7
+ \snippet calculatorbuilder/main.cpp 4
The advantage of this approach is that we can replace the form when the
application is run, but we can still manipulate the widgets it contains
as long as they are given appropriate names.
+
+ However, loading a form at runtime incurs a runtime cost compared
+ to converting it to C++ code using the \l {User Interface Compiler (uic)}
+ tool.
*/
diff --git a/examples/designer/doc/src/calculatorform.qdoc b/examples/designer/doc/src/calculatorform.qdoc
index 526e087c3..ccfe16ae6 100644
--- a/examples/designer/doc/src/calculatorform.qdoc
+++ b/examples/designer/doc/src/calculatorform.qdoc
@@ -1,44 +1,20 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example calculatorform
+ \examplecategory {Desktop}
+ \meta tags {widgets,designer}
\ingroup examples-designer
- \title Calculator Form Example
+ \title Calculator Form
\brief Using a form created with \QD in an application.
The Calculator Form Example shows how to use a form created with
\QD in an application by using the user interface information from
- a QWidget subclass. We use \l{Using a Designer UI File in Your Application}
- {uic's auto-connection} feature to automatically connect signals
- from widgets on the form to slots in our code.
+ a QWidget subclass.
- \image calculatorform-example.png Screenshot of the Calculator Form example
+ \image calculatorform-example.webp Screenshot of the Calculator Form example
The example presents two spin boxes that are used to input integer values
and a label that shows their sum. Whenever either of the spin boxes are
@@ -51,8 +27,14 @@
result is a UI file describing the form, the widgets used, any signal-slot
connections between them, and other standard user interface properties.
- To ensure that the example can use this file, we need to include a \c FORMS
- declaration in the example's project file:
+ To ensure that the example can use this file, we enable the \c CMAKE_AUTOUIC
+ feature and list the UI file in the source files:
+
+ \snippet calculatorform/CMakeLists.txt 0
+ \codeline
+ \snippet calculatorform/CMakeLists.txt 1
+
+ For \c qmake, we need to include a \c FORMS declaration in the example's project file:
\snippet calculatorform/calculatorform.pro 1
@@ -73,16 +55,17 @@
\snippet calculatorform/calculatorform.h 1
- Apart from the constructor, the class contains two private slots that
- are named according to the auto-connection naming convention required
- by \c uic.
+ Apart from the constructor, the class contains a private slot
+ \c updateResult() that performs the calculation and updates the output
+ widget accordingly.
The private \c ui member variable refers to the form, and is used to
access the contents of the user interface.
\section1 CalculatorForm Class Implementation
- The constructor simply calls the base class's constructor and
- sets up the form's user interface.
+ The constructor simply calls the base class's constructor,
+ sets up the form's user interface and connects
+ the signals \l{QSpinBox::valueChanged()} to the slot \c updateResult().
\snippet calculatorform/calculatorform.cpp 0
@@ -90,26 +73,10 @@
\c this as the argument to this function to use the \c CalculatorForm
widget itself as the container for the user interface.
- To automatically connect signals from the spin boxes defined in the
- user interface, we use the naming convention that indicates which
- widgets and their signals in the user interface should be connected
- to each slot. The first slot is called whenever the spin box called
- "inputSpinBox1" in the user interface emits the
- \l{QSpinBox::valueChanged()}{valueChanged()} signal:
+ Slot \c updateResult() adds the values and sets the result on
+ the output widget:
\snippet calculatorform/calculatorform.cpp 1
- When this occurs, we use the value supplied by the signal to update the
- output label by setting its new text directly. We access the output label
- and the other spin box via the class's private \c ui variable.
-
- The second slot is called whenever the second spin box, called
- "inputSpinBox2", emits the \l{QSpinBox::valueChanged()}{valueChanged()}
- signal:
-
- \snippet calculatorform/calculatorform.cpp 2
-
- In this case, the value from the first spin box is read and combined
- with the value supplied by the signal. Again, the output label is
- updated directly via the \c ui variable.
+ It is called whenever the value of one of the spin boxes changes.
*/
diff --git a/examples/designer/doc/src/calculatorform_mi.qdoc b/examples/designer/doc/src/calculatorform_mi.qdoc
new file mode 100644
index 000000000..7cf0bca16
--- /dev/null
+++ b/examples/designer/doc/src/calculatorform_mi.qdoc
@@ -0,0 +1,74 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \example calculatorform_mi
+ \examplecategory {Desktop}
+ \meta tags {widgets,designer}
+ \ingroup examples-designer
+ \title Calculator Form/Multiple Inheritance
+
+ \brief Using a form created with \QD in an application.
+
+ The Multiple Inheritance Example shows how to use a form created with
+ \l{Qt Widgets Designer} in an application by subclassing both QWidget and the user
+ interface class, which is \c{Ui::CalculatorForm}.
+
+ \image calculatorform-example.webp
+
+ To subclass the \c calculatorform.ui file and ensure that \c qmake
+ processes it with the \c uic, we have to include \c calculatorform.ui
+ in the \c .pro file, as shown below:
+
+ \snippet calculatorform_mi/calculatorform_mi.pro 0
+
+ When the project is compiled, the \c uic will generate a corresponding
+ \c ui_calculatorform.h.
+
+ \section1 CalculatorForm Definition
+
+ In the \c CalculatorForm definition, we include the \c ui_calculatorform.h
+ that was generated earlier.
+
+ \snippet calculatorform_mi/calculatorform.h 0
+
+ As mentioned earlier, the class is a subclass of both QWidget and
+ \c{Ui::CalculatorForm}.
+
+ \snippet calculatorform_mi/calculatorform.h 1
+
+ Two slots are defined according to the \l{Automatic Connections}
+ {automatic connection} naming convention required by \c uic. This is
+ to ensure that \l{QMetaObject}'s auto-connection facilities connect
+ all the signals and slots involved automatically.
+
+ \section1 CalculatorForm Implementation
+
+ In the constructor, we call \c setupUi() to load the user interface file.
+ Note that setupUi is a method of \c Ui::CalculatorForm.
+
+ \snippet calculatorform_mi/calculatorform.cpp 0
+
+ We include two slots, \c{on_inputSpinBox1_valueChanged()} and
+ \c{on_inputSpinBox2_valueChanged()}. These slots respond to the
+ \l{QSpinBox::valueChanged()}{valueChanged()} signal that both spin boxes
+ emit. Whenever there is a change in one spin box's value, we take that
+ value and add it to whatever value the other spin box has.
+
+ \snippet calculatorform_mi/calculatorform.cpp 1
+ \codeline
+ \snippet calculatorform_mi/calculatorform.cpp 2
+
+ \section1 \c main() Function
+
+ The \c main() function instantiates QApplication and \c CalculatorForm.
+ The \c calculator object is displayed by invoking the \l{QWidget::show()}
+ {show()} function.
+
+ \snippet calculatorform_mi/main.cpp 0
+
+ There are various approaches to include forms into applications. The
+ Multiple Inheritance approach is just one of them. See
+ \l{Using a Designer UI File in Your Application} for more information on
+ the other approaches available.
+*/
diff --git a/examples/designer/doc/src/containerextension.qdoc b/examples/designer/doc/src/containerextension.qdoc
index 6b3f9c989..5fe5a2c8b 100644
--- a/examples/designer/doc/src/containerextension.qdoc
+++ b/examples/designer/doc/src/containerextension.qdoc
@@ -1,32 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example containerextension
+ \examplecategory {Desktop}
+ \meta tags {widgets,designer}
\ingroup examples-designer
\title Container Extension Example
@@ -36,7 +14,7 @@
plugin for \QD using the
QDesignerContainerExtension class.
- \image containerextension-example.png
+ \image containerextension-example.webp
To provide a custom widget that can be used with \QD, we need to
supply a self-contained implementation. In this example we use a
@@ -53,11 +31,11 @@
\list
\li QDesignerMemberSheetExtension provides an extension that allows
you to manipulate a widget's member functions which is displayed
- when configuring connections using Qt Designer's mode for editing
+ when configuring connections using \QD's mode for editing
signals and slots.
\li QDesignerPropertySheetExtension provides an extension that
allows you to manipulate a widget's properties which is displayed
- in Qt Designer's property editor.
+ in \QD's property editor.
\li QDesignerTaskMenuExtension provides an extension that allows
you to add custom menu entries to \QD's task menu.
\li QDesignerContainerExtension provides an extension that allows
@@ -67,7 +45,7 @@
You can use all the extensions following the same pattern as in
this example, only replacing the respective extension base
- class. For more information, see \l{Qt Designer C++ Classes}.
+ class. For more information, see \l{Qt Widgets Designer C++ Classes}.
The Container Extension example consists of four classes:
@@ -83,41 +61,32 @@
extension.
\endlist
- The project file for custom widget plugins needs some additional
+ Project files for custom widget plugins need some additional
information to ensure that they will work within \QD. For example,
custom widget plugins rely on components supplied with \QD, and
- this must be specified in the project file that we use. We will
- first take a look at the plugin's project file.
+ this must be specified in the project files that we use. We will
+ first take a look at the plugin's project files.
Then we will continue by reviewing the \c MultiPageWidgetPlugin
class, and take a look at the \c MultiPageWidgetExtensionFactory
and \c MultiPageWidgetContainerExtension classes. Finally, we will
take a quick look at the \c MultiPageWidget class definition.
- \section1 The Project File: containerextension.pro
+ \section1 Project files
- The project file must contain some additional information to
- ensure that the plugin will work as expected:
+ \section2 CMake
- \snippet containerextension/containerextension.pro 0
- \snippet containerextension/containerextension.pro 1
-
- The \c TEMPLATE variable's value makes \c qmake create the custom
- widget as a library. Later, we will ensure that the widget will be
- recognized as a plugin by Qt by using the Q_PLUGIN_METADATA() macro
- to export the relevant widget information.
+ The project files need to state that a plugin linking
+ to the \QD libraries is to be built:
- The \c CONFIG variable is set to \c plugin, which ensures that \c qmake
- considers the custom widget a plugin library.
-
- The \c QT variable contains the value \c designer. Since the plugin uses
- components supplied with \QD that require linkage, this value ensures
- that our plugin links against \QD's library (\c libQtDesigner.so).
+ \snippet containerextension/CMakeLists.txt 0
+ \codeline
+ \snippet containerextension/CMakeLists.txt 2
- The header and source files for the widget are declared in the
- usual way:
+ The following example shows how to add the header and source files of the
+ widget:
- \snippet containerextension/containerextension.pro 2
+ \snippet containerextension/CMakeLists.txt 1
We provide an implementation of the plugin interface so that \QD
can use the custom widget. In this particular example we also
@@ -129,21 +98,33 @@
target path for the project and adding it to the list of items to
install:
- \snippet doc/snippets/doc_src_examples_containerextension.pro 0
+ \snippet containerextension/CMakeLists.txt 3
+ \snippet containerextension/CMakeLists.txt 4
- The container extension is created as a library, and will be
+ The container extension is created as a library. It will be
installed alongside the other \QD plugins when the project is
- installed (using \c{make install} or an equivalent installation
+ installed (using \c{ninja install} or an equivalent installation
procedure).
- Note that if you want the plugins to appear in a Visual Studio
- integration, the plugins must be built in release mode and their
- libraries must be copied into the plugin directory in the install
- path of the integration (for an example, see \c {C:/program
- files/trolltech as/visual studio integration/plugins}).
+ For more information about plugins, see the
+ \l {How to Create Qt Plugins} documentation.
+
+ \section2 qmake
+
+ The following example shows how to link a plugin to the \QD libraries:
+
+ \snippet containerextension/containerextension.pro 0
+ \codeline
+ \snippet containerextension/containerextension.pro 1
- For more information about plugins, see the \l {How to Create Qt
- Plugins} documentation.
+ The following example shows how to add the header and source files of the
+ widget:
+
+ \snippet containerextension/containerextension.pro 2
+
+ The following example shows how to install a plugin to the \QD's plugin path:
+
+ \snippet containerextension/containerextension.pro 3
\section1 MultiPageWidgetPlugin Class Definition
@@ -184,6 +165,14 @@
enables \QD to use qobject_cast() to query for supported
interfaces using nothing but a QObject pointer.
+ To ensure that Qt recognizes the widget as a plugin, export relevant
+ information about the widget by adding the \c Q_PLUGIN_METADATA() macro:
+
+ \snippet containerextension/multipagewidgetplugin.h 1
+
+ With this macro, \QD can access and construct the custom widget.
+ Without this macro, there is no way for \QD to use the widget.
+
\section1 MultiPageWidgetPlugin Class Implementation
The MultiPageWidgetPlugin class implementation is in most parts
@@ -227,7 +216,7 @@
Once we have the widget we can update the property editor. \QD
uses the QDesignerPropertySheetExtension class to feed its
property editor, and whenever a widget is selected in its
- workspace, Qt Designer will query for the widget's property sheet
+ workspace, \QD will query for the widget's property sheet
extension and update the property editor.
So what we want to achieve is to notify \QD that our widget's \e
@@ -235,7 +224,7 @@
QDesignerFormWindowInterface::findFormWindow() function to
retrieve the QDesignerFormWindowInterface object containing the
widget. The QDesignerFormWindowInterface class allows you to query
- and manipulate form windows appearing in Qt Designer's
+ and manipulate form windows appearing in \QD's
workspace. Then, all we have to do is to emit its \l
{QDesignerFormWindowInterface::emitSelectionChanged()}{emitSelectionChanged()}
signal, forcing an update of the property editor.
@@ -334,14 +323,6 @@
page; any inital pages of a multi-page widget must be specified
within this function.
- \snippet containerextension/multipagewidgetplugin.h 1
-
- Remember to use the Q_PLUGIN_METADATA() macro to export the
- MultiPageWidgetPlugin class for use with Qt's plugin handling
- classes: This macro ensures that \QD can access and construct the
- custom widget. Without this macro, there is no way for \QD to use
- the widget.
-
\section1 MultiPageWidgetExtensionFactory Class Definition
The \c MultiPageWidgetExtensionFactory class inherits QExtensionFactory
diff --git a/examples/designer/doc/src/customwidgetplugin.qdoc b/examples/designer/doc/src/customwidgetplugin.qdoc
index 82b70cea3..dd8faf6a5 100644
--- a/examples/designer/doc/src/customwidgetplugin.qdoc
+++ b/examples/designer/doc/src/customwidgetplugin.qdoc
@@ -1,38 +1,16 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example customwidgetplugin
+ \examplecategory {Desktop}
+ \meta tags {widgets,designer}
\ingroup examples-designer
- \title Custom Widget Plugin Example
+ \title Custom Widget Plugin
- \brief Creating a custom widget plugin for Qt Designer.
+ \brief Creating a custom widget plugin for \QD.
- \image customwidgetplugin-example.png
+ \image customwidgetplugin-example.webp
In this example, the custom widget used is based on the
\l{widgets/analogclock}{Analog Clock example}, and does not provide any custom
@@ -45,59 +23,68 @@
example, we reuse the \l{widgets/analogclock}{Analog Clock example} for
convenience.
- Since custom widgets plugins rely on components supplied with \QD, the
- project file that we use needs to contain information about \QD's
- library components:
+ \section1 Project files
- \snippet customwidgetplugin/customwidgetplugin.pro 2
- \snippet customwidgetplugin/customwidgetplugin.pro 0
+ \section2 CMake
- The \c TEMPLATE variable's value makes \c qmake create the custom
- widget as a library. Later, we will ensure that the widget will be
- recognized as a plugin by Qt by using the Q_PLUGIN_METADATA() macro
- to export the relevant widget information.
+ The project files need to state that a plugin linking
+ to the \QD libraries is to be built:
+ \snippet customwidgetplugin/CMakeLists.txt 0
+ \codeline
+ \snippet customwidgetplugin/CMakeLists.txt 2
- The \c CONFIG variable is set to \c plugin, which ensures that \c qmake
- considers the custom widget a plugin library.
+ The link libraries list specifies \c Qt::UiPlugin. This indicates that
+ the plugin uses the abstract interfaces QDesignerCustomWidgetInterface
+ and QDesignerCustomWidgetCollectionInterface only and has no linkage
+ to the \QD libraries. When accessing other interfaces of \QD that have
+ linkage, \c Designer should be used instead; this ensures that the plugin
+ dynamically links to the \QD libraries and has a run-time dependency on
+ them.
- The \c QT variable contains the keyword \c uiplugin. This plugin type
- provides a factory function for custom widget creation by implementing
- the abstract interfaces QDesignerCustomWidgetInterface or
- QDesignerCustomWidgetCollectionInterface, suitable for use with
- QUiLoader. It does not have a dependency on the \QD libraries.
- Plugins accessing other interfaces of \QD to implement container extensions
- or other \QD specific functionality follow different rules and are covered
- by other examples.
+ The following example shows how to add the header and source files of the
+ widget:
- The header and source files for the widget are declared in the usual way,
- and we provide an implementation of the plugin interface so that \QD can
- use the custom widget:
+ \snippet customwidgetplugin/CMakeLists.txt 1
- \snippet customwidgetplugin/customwidgetplugin.pro 3
+ We provide an implementation of the plugin interface so that \QD
+ can use the custom widget.
It is also important to ensure that the plugin is installed in a
location that is searched by \QD. We do this by specifying a
target path for the project and adding it to the list of items to
install:
- \snippet doc/snippets/doc_src_examples_customwidgetplugin.pro 0
+ \snippet customwidgetplugin/CMakeLists.txt 3
+ \snippet customwidgetplugin/CMakeLists.txt 4
+
+ The custom widget is created as a library. It will be
+ installed alongside the other \QD plugins when the project is
+ installed (using \c{ninja install} or an equivalent installation
+ procedure).
+
+ For more information about plugins, see the
+ \l {How to Create Qt Plugins} documentation.
+
+ \section2 qmake
+
+ The following example shows how to link a plugin to the \QD libraries:
- The custom widget is created as a library, and will be installed
- alongside the other \QD plugins when the project is installed
- (using \c{make install} or an equivalent installation procedure).
- Later, we will ensure that it is recognized as a plugin by \QD by
- using the Q_PLUGIN_METADATA() macro to export the relevant widget
- information.
+ \snippet customwidgetplugin/customwidgetplugin.pro 0
+ \codeline
+ \snippet customwidgetplugin/customwidgetplugin.pro 1
+
+ The \c QT variable contains the keyword \c uiplugin, which is
+ the equivalent of the \c Qt::UiPlugin library.
- Note that if you want the plugins to appear in a Visual Studio
- integration, the plugins must be built in release mode and their
- libraries must be copied into the plugin directory in the install
- path of the integration (for an example, see \c {C:/program
- files/trolltech as/visual studio integration/plugins}).
+ The following example shows how to add the header and source files of the
+ widget:
+
+ \snippet customwidgetplugin/customwidgetplugin.pro 2
- For more information about plugins, see the \l {How to
- Create Qt Plugins} documentation.
+ The following example shows how to install a plugin to the \QD's plugin path:
+
+ \snippet customwidgetplugin/customwidgetplugin.pro 3
\section1 AnalogClock Class Definition and Implementation
@@ -112,12 +99,15 @@
The \c AnalogClock class is exposed to \QD through the \c
AnalogClockPlugin class. This class inherits from both QObject and
the QDesignerCustomWidgetInterface class, and implements an
- interface defined by QDesignerCustomWidgetInterface:
+ interface defined by QDesignerCustomWidgetInterface.
+
+ To ensure that Qt recognizes the widget as a plugin, export relevant
+ information about the widget by adding the \c Q_PLUGIN_METADATA() macro:
\snippet customwidgetplugin/customwidgetplugin.h 0
The functions provide information about the widget that \QD can use in
- the \l{Getting to Know Qt Designer#WidgetBox}{widget box}.
+ the \l{Getting to Know Qt Widgets Designer#WidgetBox}{widget box}.
The \c initialized private member variable is used to record whether
the plugin has been initialized by \QD.
diff --git a/examples/designer/doc/src/taskmenuextension.qdoc b/examples/designer/doc/src/taskmenuextension.qdoc
index 6b5df136a..6a9521a7c 100644
--- a/examples/designer/doc/src/taskmenuextension.qdoc
+++ b/examples/designer/doc/src/taskmenuextension.qdoc
@@ -1,44 +1,22 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example taskmenuextension
+ \examplecategory {Desktop}
+ \meta tags {widgets,designer}
\ingroup examples-designer
- \title Task Menu Extension Example
+ \title Task Menu Extension
\brief Creating a custom widget plugin for \QD and providing custom task
menu entries that are associated with the plugin.
The Task Menu Extension example shows how to create a custom
- widget plugin for \l {Qt Designer Manual}{\QD}, and how to to use
+ widget plugin for \l {Qt Widgets Designer Manual}{\QD}, and how to use
the QDesignerTaskMenuExtension class to provide custom task menu
entries associated with the plugin.
- \image taskmenuextension-example-faded.png
+ \image taskmenuextension-example.webp
To provide a custom widget that can be used with \QD, we need to
supply a self-contained implementation. In this example we use a
@@ -57,18 +35,18 @@
in \QD.
\li QDesignerMemberSheetExtension provides an extension that allows
you to manipulate a widget's member functions which is displayed
- when configuring connections using Qt Designer's mode for editing
+ when configuring connections using \QD's mode for editing
signals and slots.
\li QDesignerPropertySheetExtension provides an extension that
allows you to manipulate a widget's properties which is displayed
- in Qt Designer's property editor.
+ in \QD's property editor.
\li QDesignerTaskMenuExtension provides an extension that allows
you to add custom menu entries to \QD's task menu.
\endlist
You can use all the extensions following the same pattern as in
this example, only replacing the respective extension base
- class. For more information, see the \l{Qt Designer C++ Classes}.
+ class. For more information, see the \l{Qt Widgets Designer C++ Classes}.
The Task Menu Extension example consists of five classes:
@@ -95,30 +73,21 @@
TicTacToeDialog class before we take a quick look at the \c
TicTacToe widget's class definition.
- \section1 The Project File: taskmenuextension.pro
+ \section1 Project files
- The project file must contain some additional information to
- ensure that the plugin will work as expected:
+ \section2 CMake
- \snippet taskmenuextension/taskmenuextension.pro 0
- \snippet taskmenuextension/taskmenuextension.pro 1
-
- The \c TEMPLATE variable's value makes \c qmake create the custom
- widget as a library. Later, we will ensure that the widget will be
- recognized as a plugin by Qt by using the Q_PLUGIN_METADATA() macro to
- export the relevant widget information.
-
- The \c CONFIG variable is set to \c plugin, which ensures that \c qmake
- considers the custom widget a plugin library.
+ The project files need to state that a plugin linking
+ to the \QD libraries is to be built:
- The \c QT variable contains the value \c designer. Since the plugin uses
- components supplied with \QD that require linkage, this value ensures
- that our plugin links against \QD's library (\c libQtDesigner.so).
+ \snippet taskmenuextension/CMakeLists.txt 0
+ \codeline
+ \snippet taskmenuextension/CMakeLists.txt 2
- The header and source files for the widget are declared in the
- usual way:
+ The following example shows how to add the header and source files of the
+ widget:
- \snippet taskmenuextension/taskmenuextension.pro 2
+ \snippet taskmenuextension/CMakeLists.txt 1
We provide an implementation of the plugin interface so that \QD
can use the custom widget. In this particular example we also
@@ -130,21 +99,33 @@
target path for the project and adding it to the list of items to
install:
- \snippet doc/snippets/doc_src_examples_taskmenuextension.pro 0
+ \snippet taskmenuextension/CMakeLists.txt 3
+ \snippet taskmenuextension/CMakeLists.txt 4
- The task menu extension is created as a library, and will be
+ The task menu extension is created as a library. It will be
installed alongside the other \QD plugins when the project is
- installed (using \c{make install} or an equivalent installation
+ installed (using \c{ninja install} or an equivalent installation
procedure).
- Note that if you want the plugins to appear in a Visual Studio
- integration, the plugins must be built in release mode and their
- libraries must be copied into the plugin directory in the install
- path of the integration (for an example, see \c {C:/program
- files/trolltech as/visual studio integration/plugins}).
+ For more information about plugins, see the
+ \l {How to Create Qt Plugins} documentation.
+
+ \section2 qmake
- For more information about plugins, see the \l {How to Create Qt
- Plugins} documentation.
+ The following example shows how to link a plugin to the \QD libraries:
+
+ \snippet taskmenuextension/taskmenuextension.pro 0
+ \codeline
+ \snippet taskmenuextension/taskmenuextension.pro 1
+
+ The following example shows how to add the header and source files of the
+ widget:
+
+ \snippet taskmenuextension/taskmenuextension.pro 2
+
+ The following example shows how to install a plugin to the \QD's plugin path:
+
+ \snippet taskmenuextension/taskmenuextension.pro 3
\section1 TicTacToePlugin Class Definition
@@ -153,7 +134,10 @@
{customwidgetplugin}{Custom Widget Plugin} example's
plugin class which is explained in detail. The only part of the
class definition that is specific to this particular custom widget
- is the class name:
+ is the class name.
+
+ To ensure that Qt recognizes the widget as a plugin, export relevant
+ information about the widget by adding the \c Q_PLUGIN_METADATA() macro:
\snippet taskmenuextension/tictactoeplugin.h 0
@@ -189,7 +173,7 @@
The \c initialize() function takes a QDesignerFormEditorInterface
object as argument. The QDesignerFormEditorInterface class
- provides access to Qt Designer's components.
+ provides access to \QD's components.
In \QD you can create two kinds of plugins: custom widget plugins
and tool plugins. QDesignerFormEditorInterface provides access to
@@ -241,7 +225,7 @@
We omit to reimplement the
QDesignerCustomWidgetInterface::domXml() function (which include
default settings for the widget in the standard XML format used by
- Qt Designer), since no default values are necessary.
+ \QD), since no default values are necessary.
\snippet taskmenuextension/tictactoeplugin.h 1
@@ -292,7 +276,7 @@
\section1 TicTacToeTaskMenu Class Definition
- \image taskmenuextension-menu.png
+ \image taskmenuextension-menu.webp
The \c TicTacToeTaskMenu class inherits QDesignerTaskMenuExtension
which allows you to add custom entries (in the form of QActions)
@@ -341,7 +325,7 @@
\section1 TicTacToeDialog Class Definition
- \image taskmenuextension-dialog.png
+ \image taskmenuextension-dialog.webp
The \c TicTacToeDialog class inherits QDialog. The dialog lets the
user modify the state of the currently selected Tic-Tac-Toe
@@ -390,8 +374,8 @@
QDesignerFormWindowInterface provides you with information about
the associated form window as well as allowing you to alter its
properties. The interface is not intended to be instantiated
- directly, but to provide access to Qt Designer's current form
- windows controlled by Qt Designer's form window manager.
+ directly, but to provide access to \QD's current form
+ windows controlled by \QD's form window manager.
If you are looking for the form window containing a specific
widget, you can use the static
diff --git a/examples/designer/doc/src/worldtimeclockbuilder.qdoc b/examples/designer/doc/src/worldtimeclockbuilder.qdoc
deleted file mode 100644
index 7360dcafe..000000000
--- a/examples/designer/doc/src/worldtimeclockbuilder.qdoc
+++ /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 documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example worldtimeclockbuilder
- \ingroup examples-designer
- \title World Time Clock Builder Example
-
- \brief Creating forms with Qt Designer that contain custom widgets that can be
- dynamically generated at run-time.
-
- \image worldtimeclockbuilder-example.png
-
- This example uses a form containing the custom widget plugin described in the
- \l{worldtimeclockplugin}{World Time Clock Plugin} example, and
- dynamically generates a user interface using the QUiLoader class, part of
- the QtUiTools module.
-
- \section1 Preparation
-
- As with the \l{calculatorbuilder}{Calculator Builder} example, the
- project file for this example needs to include the appropriate definitions
- to ensure that it is built against the required Qt modules.
-
- \snippet worldtimeclockbuilder/worldtimeclockbuilder.pro 0
-
- By appending \c form to the \c CONFIG declaration, we instruct \c qmake to
- generate a dependency on the \c libQtUiTools library containing the QtUiTools
- classes.
-
- Note that we do not inform \c qmake about any UI files, and so none will
- be processed and built into the application. The resource file contains
- an entry for the particular form that we wish to use:
-
- \quotefile worldtimeclockbuilder/worldtimeclockbuilder.qrc
-
- Forms do not need to be included with the application in this way. We only
- include a form in the application's resources for convenience, and to keep
- the example short.
-
- \section1 Loading and Building the Form
-
- Since this example only loads and displays a pre-prepared form, all of the
- work can be done in the main() function. We are using a class from the
- QtUiTools library so, in addition to any other Qt classes that are normally
- required to write an application, we must include the appropriate header
- file:
-
- \snippet worldtimeclockbuilder/main.cpp 0
-
- The main function initializes the resource system with the Q_INIT_RESOURCE()
- macro and constructs an QApplication instance in the usual way:
-
- \snippet worldtimeclockbuilder/main.cpp 1
-
- We construct a QUiLoader object to handle the form we want to use.
-
- The form itself is obtained from the resource file system using the path
- defined in the resource file. We use the form loader to load and construct
- the form:
-
- \snippet worldtimeclockbuilder/main.cpp 2
-
- Once the form has been loaded, the resource file can be closed and the
- widget is shown.
-
- \snippet worldtimeclockbuilder/main.cpp 3
-
- The form loader ensures that all the signal and slot connections between
- objects in the form are set up correctly when the form is loaded. As a
- result, the time is updated by the World Time Clock widget, and the time
- zone spin box can be used to change the position of the hour hand.
-*/
diff --git a/examples/designer/doc/src/worldtimeclockplugin.qdoc b/examples/designer/doc/src/worldtimeclockplugin.qdoc
deleted file mode 100644
index 19ec83f6b..000000000
--- a/examples/designer/doc/src/worldtimeclockplugin.qdoc
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example worldtimeclockplugin
- \ingroup examples-designer
- \title World Time Clock Plugin Example
-
- \brief Creating a custom widget plugin for \QD that uses signals and slots.
-
- \image worldtimeclockplugin-example.png
-
- In this example, we simply extend the \l
- {customwidgetplugin}{Custom Widget Plugin} example and
- its custom widget (based on the \l{widgets/analogclock}{Analog
- Clock} example), by introducing the concept of signals and slots.
-
- The World Time Clock Plugin example consists of two classes:
-
- \list
- \li \c WorldTimeClock is a custom clock widget with hour and
- minute hands that is automatically updated every few seconds.
- \li \c WorldTimeClockPlugin exposes the \c WorldTimeClock class to \QD.
- \endlist
-
- First we will take a look at the \c WorldTimeClock class which
- extends the \l {customwidgetplugin}{Custom Widget Plugin}
- example's \c AnalogClock class by providing a signal and a
- slot. Then we will take a quick look at the \c
- WorldTimeClockPlugin class, but this class is in most parts
- identical to the \l {customwidgetplugin}{Custom Widget
- Plugin} example's implementation.
-
- Finally we take a look at the plugin's project file. The project
- file for custom widget plugins needs some additional information
- to ensure that they will work within \QD. This is also covered in
- the \l {customwidgetplugin}{Custom Widget Plugin} example,
- but due to its importance (custom widget plugins rely on
- components supplied with \QD which must be specified in the
- project file that we use) we will repeat it here.
-
- \section1 WorldTimeClock Class
-
- The \c WorldTimeClock class inherits QWidget, and is a custom
- clock widget with hour and minute hands that is automatically
- updated every few seconds. What makes this example different from
- the \l {customwidgetplugin}{Custom Widget Plugin}
- example, is the introduction of the signal and slot in the custom
- widget class:
-
- \snippet worldtimeclockplugin/worldtimeclock.h 1
-
- Note the use of the QDESIGNER_WIDGET_EXPORT macro. This is needed
- to ensure that \QD can create instances of the widget on some
- platforms, but it is a good idea to use it on all platforms.
-
- We declare the \c setTimeZone() slot with an associated \c
- timeZoneOffset variable, and we declare an \c updated() signal
- which takes the current time as argument and is emitted whenever
- the widget is repainted.
-
- \image worldtimeclock-connection.png
-
- In \QD's workspace we can then, for example, connect the \c
- WorldTimeClock widget's \c updated() signal to a QTimeEdit's \l
- {QDateTimeEdit::setTime()}{setTime()} slot using \QD's mode
- for editing signal and slots.
-
- \image worldtimeclock-signalandslot.png
-
- We can also connect a QSpinBox's \l
- {QSpinBox::valueChanged()}{valueChanged()} signal to the \c
- WorldTimeClock's \c setTimeZone() slot.
-
- \section1 WorldTimeClockPlugin Class
-
- The \c WorldTimeClockPlugin class exposes the \c WorldTimeClock
- class to \QD. Its definition is equivalent to the \l
- {customwidgetplugin}{Custom Widget Plugin} example's
- plugin class which is explained in detail. The only part of the
- class definition that is specific to this particular custom widget
- is the class name:
-
- \snippet worldtimeclockplugin/worldtimeclockplugin.h 0
-
- The plugin class provides \QD with basic information about our
- plugin, such as its class name and its include file. Furthermore
- it knows how to create instances of the \c WorldTimeClockPlugin
- widget. \c WorldTimeClockPlugin also defines the \l
- {QDesignerCustomWidgetInterface::initialize()}{initialize()}
- function which is called after the plugin is loaded into \QD. The
- function's QDesignerFormEditorInterface parameter provides the
- plugin with a gateway to all of \QD's API's.
-
- The \c WorldTimeClockPlugin class inherits from both QObject and
- QDesignerCustomWidgetInterface. It is important to remember, when
- using multiple inheritance, to ensure that all the interfaces
- (i.e. the classes that doesn't inherit Q_OBJECT) are made known to
- the meta object system using the Q_INTERFACES() macro. This
- enables \QD to use qobject_cast() to query for supported
- interfaces using nothing but a QObject pointer.
-
- The implementation of the \c WorldTimeClockPlugin is also
- equivalent to the plugin interface implementation in the \l
- {customwidgetplugin}{Custom Widget Plugin} example (only
- the class name and the implementation of
- QDesignerCustomWidgetInterface::domXml() differ). The main thing
- to remember is to use the Q_PLUGIN_METADATA() macro to export the \c
- WorldTimeClockPlugin class for use with \QD:
-
- \snippet worldtimeclockplugin/worldtimeclockplugin.h 1
-
- Without this macro, there is no way for Qt Designer to use the
- widget.
-
- \section1 The Project File: worldtimeclockplugin.pro
-
- The project file for custom widget plugins needs some additional
- information to ensure that they will work as expected within \QD:
-
- \snippet worldtimeclockplugin/worldtimeclockplugin.pro 0
- \snippet worldtimeclockplugin/worldtimeclockplugin.pro 1
-
- The \c TEMPLATE variable's value in conjunction with the keyword
- \c plugin in the \c CONFIG variable make \c qmake create the custom
- widget as a plugin library.
-
- The \c QT variable contains the keyword \c uiplugin. This plugin type
- provides a factory function for custom widget creation by implementing
- the abstract interfaces QDesignerCustomWidgetInterface or
- QDesignerCustomWidgetCollectionInterface, suitable for use with
- QUiLoader. It does not have a dependency on the \QD libraries.
- Plugins accessing other interfaces of \QD to implement container extensions
- or other \QD specific functionality follow different rules and are covered
- by other examples.
-
- The header and source files for the widget are declared in the
- usual way, and in addition we provide an implementation of the
- plugin interface so that \QD can use the custom widget.
-
- \snippet worldtimeclockplugin/worldtimeclockplugin.pro 2
-
- It is important to ensure that the plugin is installed in a location that
- is searched by \QD. We do this by specifying a target path for the project
- and adding it to the list of items to install:
-
- \snippet doc/snippets/doc_src_examples_worldtimeclockplugin.pro 0
-
- The custom widget is created as a library, and will be installed
- alongside the other \QD plugins when the project is installed
- (using \c{make install} or an equivalent installation procedure).
- Later, we will ensure that it is recognized as a plugin by \QD by
- using the Q_PLUGIN_METADATA() macro to export the relevant widget
- information.
-
- Note that if you want the plugins to appear in a Visual Studio
- integration, the plugins must be built in release mode and their
- libraries must be copied into the plugin directory in the install
- path of the integration (for an example, see \c {C:/program
- files/trolltech as/visual studio integration/plugins}).
-
- For more information about plugins, see the \l {How to Create Qt
- Plugins} document.
-*/
diff --git a/examples/designer/taskmenuextension/.prev_CMakeLists.txt b/examples/designer/taskmenuextension/.prev_CMakeLists.txt
deleted file mode 100644
index 8551d0a46..000000000
--- a/examples/designer/taskmenuextension/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Generated from taskmenuextension.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(taskmenuextension 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}")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Designer)
-
-qt_add_executable(taskmenuextension
- tictactoe.cpp tictactoe.h
- tictactoedialog.cpp tictactoedialog.h
- tictactoeplugin.cpp tictactoeplugin.h
- tictactoetaskmenu.cpp tictactoetaskmenu.h
-)
-set_target_properties(taskmenuextension PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(taskmenuextension PUBLIC
- Qt::Core
- Qt::Designer
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS taskmenuextension
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/designer/taskmenuextension/CMakeLists.txt b/examples/designer/taskmenuextension/CMakeLists.txt
index eb565d600..b1ed49154 100644
--- a/examples/designer/taskmenuextension/CMakeLists.txt
+++ b/examples/designer/taskmenuextension/CMakeLists.txt
@@ -1,47 +1,55 @@
-# Generated from taskmenuextension.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(taskmenuextension 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}/plugins/designer") # special case
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Designer)
+#! [0]
+find_package(Qt6 REQUIRED COMPONENTS Core Designer Gui Widgets)
-# special case begin
qt_add_plugin(taskmenuextension)
+#! [0]
+
+#! [1]
target_sources(taskmenuextension PRIVATE
tictactoe.cpp tictactoe.h
tictactoedialog.cpp tictactoedialog.h
tictactoeplugin.cpp tictactoeplugin.h
tictactoetaskmenu.cpp tictactoetaskmenu.h
)
-# special case end
+#! [1]
+
set_target_properties(taskmenuextension PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
+#! [2]
target_link_libraries(taskmenuextension PUBLIC
Qt::Core
Qt::Designer
Qt::Gui
Qt::Widgets
)
+#! [2]
+
+if(QT6_INSTALL_PREFIX)
+#! [3]
+ set(INSTALL_EXAMPLEDIR "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_PLUGINS}/designer")
+#! [3]
+else()
+ if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+ endif()
+ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer")
+endif()
+#! [4]
install(TARGETS taskmenuextension
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+#! [4]
diff --git a/examples/designer/taskmenuextension/taskmenuextension.pro b/examples/designer/taskmenuextension/taskmenuextension.pro
index 71a3806d6..b4f8cbd1a 100644
--- a/examples/designer/taskmenuextension/taskmenuextension.pro
+++ b/examples/designer/taskmenuextension/taskmenuextension.pro
@@ -1,27 +1,18 @@
-#! [0]
+#! [1]
QT += widgets designer
-#! [0]
-
-QTDIR_build {
-# This is only for the Qt build. Do not use externally. We mean it.
-PLUGIN_TYPE = designer
-PLUGIN_CLASS_NAME = TicTacToePlugin
-load(qt_plugin)
-CONFIG += install_ok
-} else {
-# Public example:
-
#! [1]
+
+#! [0]
TEMPLATE = lib
CONFIG += plugin
-#! [1]
+#! [0]
TARGET = $$qtLibraryTarget($$TARGET)
+#! [3]
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
-
-}
+#! [3]
#! [2]
HEADERS += tictactoe.h \
diff --git a/examples/designer/taskmenuextension/tictactoe.cpp b/examples/designer/taskmenuextension/tictactoe.cpp
index f96c5af2b..58bc359b3 100644
--- a/examples/designer/taskmenuextension/tictactoe.cpp
+++ b/examples/designer/taskmenuextension/tictactoe.cpp
@@ -1,59 +1,14 @@
-/****************************************************************************
-**
-** 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 "tictactoe.h"
#include <QMouseEvent>
#include <QPainter>
-static inline QString defaultState() { return QStringLiteral("---------"); }
+using namespace Qt::StringLiterals;
+
+static inline QString defaultState() { return u"---------"_s; }
TicTacToe::TicTacToe(QWidget *parent)
: QWidget(parent), myState(defaultState())
diff --git a/examples/designer/taskmenuextension/tictactoe.h b/examples/designer/taskmenuextension/tictactoe.h
index 5f081bbdc..60b82a58b 100644
--- a/examples/designer/taskmenuextension/tictactoe.h
+++ b/examples/designer/taskmenuextension/tictactoe.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 TICTACTOE_H
#define TICTACTOE_H
diff --git a/examples/designer/taskmenuextension/tictactoedialog.cpp b/examples/designer/taskmenuextension/tictactoedialog.cpp
index a13b093d2..b0c9acc3d 100644
--- a/examples/designer/taskmenuextension/tictactoedialog.cpp
+++ b/examples/designer/taskmenuextension/tictactoedialog.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 "tictactoe.h"
#include "tictactoedialog.h"
@@ -74,7 +27,7 @@ TicTacToeDialog::TicTacToeDialog(TicTacToe *tic, QWidget *parent)
connect(buttonBox, &QDialogButtonBox::accepted, this, &TicTacToeDialog::saveState);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
- QVBoxLayout *mainLayout = new QVBoxLayout(this);
+ auto *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(editor);
mainLayout->addWidget(buttonBox);
@@ -85,7 +38,7 @@ TicTacToeDialog::TicTacToeDialog(TicTacToe *tic, QWidget *parent)
//! [1]
QSize TicTacToeDialog::sizeHint() const
{
- return QSize(250, 250);
+ return {250, 250};
}
//! [1]
@@ -100,10 +53,8 @@ void TicTacToeDialog::resetState()
void TicTacToeDialog::saveState()
{
//! [3] //! [4]
- if (QDesignerFormWindowInterface *formWindow
- = QDesignerFormWindowInterface::findFormWindow(ticTacToe)) {
+ if (auto *formWindow = QDesignerFormWindowInterface::findFormWindow(ticTacToe))
formWindow->cursor()->setProperty("state", editor->state());
- }
//! [4] //! [5]
accept();
}
diff --git a/examples/designer/taskmenuextension/tictactoedialog.h b/examples/designer/taskmenuextension/tictactoedialog.h
index e82edaa11..4dfae744e 100644
--- a/examples/designer/taskmenuextension/tictactoedialog.h
+++ b/examples/designer/taskmenuextension/tictactoedialog.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 TICTACTOEDIALOG_H
#define TICTACTOEDIALOG_H
diff --git a/examples/designer/taskmenuextension/tictactoeplugin.cpp b/examples/designer/taskmenuextension/tictactoeplugin.cpp
index 5515526bc..fc729c8d8 100644
--- a/examples/designer/taskmenuextension/tictactoeplugin.cpp
+++ b/examples/designer/taskmenuextension/tictactoeplugin.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 "tictactoe.h"
#include "tictactoeplugin.h"
@@ -56,6 +9,8 @@
#include <QtDesigner/QExtensionManager>
#include <QtPlugin>
+using namespace Qt::StringLiterals;
+
//! [0]
TicTacToePlugin::TicTacToePlugin(QObject *parent)
: QObject(parent)
@@ -64,32 +19,32 @@ TicTacToePlugin::TicTacToePlugin(QObject *parent)
QString TicTacToePlugin::name() const
{
- return QStringLiteral("TicTacToe");
+ return u"TicTacToe"_s;
}
QString TicTacToePlugin::group() const
{
- return QStringLiteral("Display Widgets [Examples]");
+ return u"Display Widgets [Examples]"_s;
}
QString TicTacToePlugin::toolTip() const
{
- return QStringLiteral("Tic Tac Toe Example, demonstrating class QDesignerTaskMenuExtension (C++)");
+ return u"Tic Tac Toe Example, demonstrating class QDesignerTaskMenuExtension (C++)"_s;
}
QString TicTacToePlugin::whatsThis() const
{
- return QString();
+ return {};
}
QString TicTacToePlugin::includeFile() const
{
- return QStringLiteral("tictactoe.h");
+ return u"tictactoe.h"_s;
}
QIcon TicTacToePlugin::icon() const
{
- return QIcon();
+ return {};
}
bool TicTacToePlugin::isContainer() const
@@ -99,8 +54,8 @@ bool TicTacToePlugin::isContainer() const
QWidget *TicTacToePlugin::createWidget(QWidget *parent)
{
- TicTacToe *ticTacToe = new TicTacToe(parent);
- ticTacToe->setState(QStringLiteral("-X-XO----"));
+ auto *ticTacToe = new TicTacToe(parent);
+ ticTacToe->setState(u"-X-XO----"_s);
return ticTacToe;
}
@@ -116,8 +71,8 @@ void TicTacToePlugin::initialize(QDesignerFormEditorInterface *formEditor)
if (initialized)
return;
- QExtensionManager *manager = formEditor->extensionManager();
- Q_ASSERT(manager != 0);
+ auto *manager = formEditor->extensionManager();
+ Q_ASSERT(manager != nullptr);
//! [2]
//! [3]
@@ -129,7 +84,7 @@ void TicTacToePlugin::initialize(QDesignerFormEditorInterface *formEditor)
QString TicTacToePlugin::domXml() const
{
- return QLatin1String(R"(
+ return uR"(
<ui language="c++">
<widget class="TicTacToe" name="ticTacToe"/>
<customwidgets>
@@ -142,7 +97,7 @@ QString TicTacToePlugin::domXml() const
</customwidget>
</customwidgets>
</ui>
-)");
+)"_s;
}
//! [3]
diff --git a/examples/designer/taskmenuextension/tictactoeplugin.h b/examples/designer/taskmenuextension/tictactoeplugin.h
index 9aa8b5650..8826266a4 100644
--- a/examples/designer/taskmenuextension/tictactoeplugin.h
+++ b/examples/designer/taskmenuextension/tictactoeplugin.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
//! [0]
#ifndef TICTACTOEPLUGIN_H
diff --git a/examples/designer/taskmenuextension/tictactoetaskmenu.cpp b/examples/designer/taskmenuextension/tictactoetaskmenu.cpp
index 75d1f625c..b91994924 100644
--- a/examples/designer/taskmenuextension/tictactoetaskmenu.cpp
+++ b/examples/designer/taskmenuextension/tictactoetaskmenu.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 "tictactoe.h"
#include "tictactoedialog.h"
@@ -102,7 +55,7 @@ QObject *TicTacToeTaskMenuFactory::createExtension(QObject *object,
if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
return nullptr;
- if (TicTacToe *tic = qobject_cast<TicTacToe*>(object))
+ if (auto *tic = qobject_cast<TicTacToe*>(object))
return new TicTacToeTaskMenu(tic, parent);
return nullptr;
diff --git a/examples/designer/taskmenuextension/tictactoetaskmenu.h b/examples/designer/taskmenuextension/tictactoetaskmenu.h
index a57ded625..ef857335a 100644
--- a/examples/designer/taskmenuextension/tictactoetaskmenu.h
+++ b/examples/designer/taskmenuextension/tictactoetaskmenu.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 TICTACTOETASKMENU_H
#define TICTACTOETASKMENU_H
diff --git a/examples/designer/worldtimeclockbuilder/CMakeLists.txt b/examples/designer/worldtimeclockbuilder/CMakeLists.txt
deleted file mode 100644
index b435dba0d..000000000
--- a/examples/designer/worldtimeclockbuilder/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Generated from worldtimeclockbuilder.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(worldtimeclockbuilder 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}/designer/worldtimeclockbuilder")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiTools)
-
-qt_add_executable(worldtimeclockbuilder
- main.cpp
-)
-set_target_properties(worldtimeclockbuilder PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(worldtimeclockbuilder PUBLIC
- Qt::Core
- Qt::Gui
- Qt::UiTools
- Qt::Widgets
-)
-
-
-# Resources:
-set(worldtimeclockbuilder_resource_files
- "form.ui"
-)
-
-qt6_add_resources(worldtimeclockbuilder "worldtimeclockbuilder"
- PREFIX
- "/forms"
- FILES
- ${worldtimeclockbuilder_resource_files}
-)
-
-install(TARGETS worldtimeclockbuilder
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/designer/worldtimeclockbuilder/form.ui b/examples/designer/worldtimeclockbuilder/form.ui
deleted file mode 100644
index e5be1d911..000000000
--- a/examples/designer/worldtimeclockbuilder/form.ui
+++ /dev/null
@@ -1,162 +0,0 @@
-<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
- <class>WorldTimeForm</class>
- <widget class="QWidget" name="WorldTimeForm" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>World Time Clock</string>
- </property>
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="WorldTimeClock" name="worldTimeClock" />
- </item>
- <item>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>1</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>1</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Current time:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTimeEdit" name="timeEdit" >
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>1</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Set time zone:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="spinBox" >
- <property name="maximum" >
- <number>12</number>
- </property>
- <property name="minimum" >
- <number>-12</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <pixmapfunction></pixmapfunction>
- <customwidgets>
- <customwidget>
- <class>WorldTimeClock</class>
- <extends></extends>
- <header>worldtimeclock.h</header>
- <container>0</container>
- <pixmap></pixmap>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>spinBox</sender>
- <signal>valueChanged(int)</signal>
- <receiver>worldTimeClock</receiver>
- <slot>setTimeZone(int)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>339</x>
- <y>166</y>
- </hint>
- <hint type="destinationlabel" >
- <x>157</x>
- <y>230</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>worldTimeClock</sender>
- <signal>updated(QTime)</signal>
- <receiver>timeEdit</receiver>
- <slot>setTime(QTime)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>141</x>
- <y>59</y>
- </hint>
- <hint type="destinationlabel" >
- <x>291</x>
- <y>133</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/designer/worldtimeclockbuilder/main.cpp b/examples/designer/worldtimeclockbuilder/main.cpp
deleted file mode 100644
index ad2728079..000000000
--- a/examples/designer/worldtimeclockbuilder/main.cpp
+++ /dev/null
@@ -1,80 +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$
-**
-****************************************************************************/
-
-//! [0]
-#include <QtUiTools>
-//! [0]
-#include <QApplication>
-#include <QWidget>
-#include <QFile>
-//! [1]
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(worldtimeclockbuilder);
-
- QApplication app(argc, argv);
-
- QUiLoader loader;
-//! [1]
-
-//! [2]
- QFile file(":/forms/form.ui");
- file.open(QFile::ReadOnly);
-
- QWidget *widget = loader.load(&file);
-
- file.close();
- widget->show();
-//! [2]
-
-//! [3]
- return app.exec();
-}
-//! [3]
diff --git a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro
deleted file mode 100644
index 1e420aa65..000000000
--- a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-#! [0]
-QT += widgets uitools
-SOURCES = main.cpp
-RESOURCES = worldtimeclockbuilder.qrc
-#! [0]
-
-target.path = $$[QT_INSTALL_EXAMPLES]/designer/worldtimeclockbuilder
-INSTALLS += target
diff --git a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.qrc b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.qrc
deleted file mode 100644
index 89d5ac3c2..000000000
--- a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/forms">
- <file>form.ui</file>
-</qresource>
-</RCC>
diff --git a/examples/designer/worldtimeclockplugin/.prev_CMakeLists.txt b/examples/designer/worldtimeclockplugin/.prev_CMakeLists.txt
deleted file mode 100644
index 1886b1ce6..000000000
--- a/examples/designer/worldtimeclockplugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from worldtimeclockplugin.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(worldtimeclockplugin 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}")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiPlugin)
-
-qt_add_executable(worldtimeclockplugin
- worldtimeclock.cpp worldtimeclock.h
- worldtimeclockplugin.cpp worldtimeclockplugin.h
-)
-set_target_properties(worldtimeclockplugin PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(worldtimeclockplugin PUBLIC
- Qt::Core
- Qt::Gui
- Qt::UiPlugin
- Qt::Widgets
-)
-
-install(TARGETS worldtimeclockplugin
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/designer/worldtimeclockplugin/CMakeLists.txt b/examples/designer/worldtimeclockplugin/CMakeLists.txt
deleted file mode 100644
index 3cecd4b6d..000000000
--- a/examples/designer/worldtimeclockplugin/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-# Generated from worldtimeclockplugin.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(worldtimeclockplugin 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}/plugins/designer") # special case
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS UiPlugin)
-
-# special case begin
-qt_add_plugin(worldtimeclockplugin)
-target_sources(worldtimeclockplugin PRIVATE
- worldtimeclock.cpp worldtimeclock.h
- worldtimeclockplugin.cpp worldtimeclockplugin.h
-)
-# special case end
-set_target_properties(worldtimeclockplugin PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(worldtimeclockplugin PUBLIC
- Qt::Core
- Qt::Gui
- Qt::UiPlugin
- Qt::Widgets
-)
-
-install(TARGETS worldtimeclockplugin
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclock.cpp b/examples/designer/worldtimeclockplugin/worldtimeclock.cpp
deleted file mode 100644
index 366394287..000000000
--- a/examples/designer/worldtimeclockplugin/worldtimeclock.cpp
+++ /dev/null
@@ -1,131 +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 "worldtimeclock.h"
-
-#include <QMouseEvent>
-#include <QPainter>
-#include <QTimer>
-
-WorldTimeClock::WorldTimeClock(QWidget *parent)
- : QWidget(parent)
-{
- QTimer *timer = new QTimer(this);
- connect(timer, &QTimer::timeout, this, QOverload<>::of(&QWidget::update));
- timer->start(1000);
-
- setWindowTitle(tr("World Time Clock"));
- resize(200, 200);
-}
-
-void WorldTimeClock::paintEvent(QPaintEvent *)
-{
- static const QPoint hourHand[3] = {
- QPoint(7, 8),
- QPoint(-7, 8),
- QPoint(0, -40)
- };
- static const QPoint minuteHand[3] = {
- QPoint(7, 8),
- QPoint(-7, 8),
- QPoint(0, -70)
- };
-
- QColor hourColor(127, 0, 127);
- QColor minuteColor(0, 127, 127, 191);
-
- int side = qMin(width(), height());
- QTime time = QTime::currentTime();
- time = time.addSecs(timeZoneOffset);
-
- QPainter painter(this);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.translate(width() / 2, height() / 2);
- painter.scale(side / 200.0, side / 200.0);
-
- painter.setPen(Qt::NoPen);
- painter.setBrush(hourColor);
-
- painter.save();
- painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0)));
- painter.drawConvexPolygon(hourHand, 3);
- painter.restore();
-
- painter.setPen(hourColor);
-
- for (int i = 0; i < 12; ++i) {
- painter.drawLine(88, 0, 96, 0);
- painter.rotate(30.0);
- }
-
- painter.setPen(Qt::NoPen);
- painter.setBrush(minuteColor);
-
- painter.save();
- painter.rotate(6.0 * (time.minute() + time.second() / 60.0));
- painter.drawConvexPolygon(minuteHand, 3);
- painter.restore();
-
- painter.setPen(minuteColor);
-
- for (int j = 0; j < 60; ++j) {
- if ((j % 5) != 0)
- painter.drawLine(92, 0, 96, 0);
- painter.rotate(6.0);
- }
-
- emit updated(time);
-}
-
-void WorldTimeClock::setTimeZone(int hourOffset)
-{
- timeZoneOffset = qMin(qMax(-12, hourOffset), 12) * 3600;
- update();
-}
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclock.h b/examples/designer/worldtimeclockplugin/worldtimeclock.h
deleted file mode 100644
index e2d54a7e4..000000000
--- a/examples/designer/worldtimeclockplugin/worldtimeclock.h
+++ /dev/null
@@ -1,82 +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 WORLDTIMECLOCK_H
-#define WORLDTIMECLOCK_H
-
-#include <QTime>
-#include <QWidget>
-#include <QtUiPlugin/QDesignerExportWidget>
-
-//! [0] //! [1]
-class QDESIGNER_WIDGET_EXPORT WorldTimeClock : public QWidget
-{
- Q_OBJECT
-//! [0]
-
-public:
- explicit WorldTimeClock(QWidget *parent = nullptr);
-
-public slots:
- void setTimeZone(int hourOffset);
-
-signals:
- void updated(QTime currentTime);
-
-protected:
- void paintEvent(QPaintEvent *event) override;
-
-private:
- int timeZoneOffset = 0;
-//! [2]
-};
-//! [1] //! [2]
-
-#endif
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
deleted file mode 100644
index 83223d59f..000000000
--- a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
+++ /dev/null
@@ -1,130 +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 "worldtimeclock.h"
-#include "worldtimeclockplugin.h"
-
-#include <QtPlugin>
-
-WorldTimeClockPlugin::WorldTimeClockPlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-void WorldTimeClockPlugin::initialize(QDesignerFormEditorInterface * /* core */)
-{
- if (initialized)
- return;
-
- initialized = true;
-}
-
-bool WorldTimeClockPlugin::isInitialized() const
-{
- return initialized;
-}
-
-QWidget *WorldTimeClockPlugin::createWidget(QWidget *parent)
-{
- return new WorldTimeClock(parent);
-}
-
-QString WorldTimeClockPlugin::name() const
-{
- return QStringLiteral("WorldTimeClock");
-}
-
-QString WorldTimeClockPlugin::group() const
-{
- return QStringLiteral("Display Widgets [Examples]");
-}
-
-QIcon WorldTimeClockPlugin::icon() const
-{
- return QIcon();
-}
-
-QString WorldTimeClockPlugin::toolTip() const
-{
- return QString();
-}
-
-QString WorldTimeClockPlugin::whatsThis() const
-{
- return QString();
-}
-
-bool WorldTimeClockPlugin::isContainer() const
-{
- return false;
-}
-
-QString WorldTimeClockPlugin::domXml() const
-{
- return QLatin1String(R"(
-<ui language="c++">
- <widget class="WorldTimeClock" name="worldTimeClock">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>100</width>
- <height>100</height>
- </rect>
- </property>
- </widget>
-</ui>
-)");
-}
-
-QString WorldTimeClockPlugin::includeFile() const
-{
- return QStringLiteral("worldtimeclock.h");
-}
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h
deleted file mode 100644
index 0af0b1dd0..000000000
--- a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h
+++ /dev/null
@@ -1,86 +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 WORLDTIMECLOCKPLUGIN_H
-#define WORLDTIMECLOCKPLUGIN_H
-
-#include <QtUiPlugin/QDesignerCustomWidgetInterface>
-
-//! [0]
-class WorldTimeClockPlugin : public QObject,
- public QDesignerCustomWidgetInterface
-{
- Q_OBJECT
-//! [1]
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface")
-//! [1]
- Q_INTERFACES(QDesignerCustomWidgetInterface)
-
-public:
- explicit WorldTimeClockPlugin(QObject *parent = nullptr);
-
- bool isContainer() const override;
- bool isInitialized() const override;
- QIcon icon() const override;
- QString domXml() const override;
- QString group() const override;
- QString includeFile() const override;
- QString name() const override;
- QString toolTip() const override;
- QString whatsThis() const override;
- QWidget *createWidget(QWidget *parent) override;
- void initialize(QDesignerFormEditorInterface *core) override;
-
-private:
- bool initialized = false;
-};
-//! [0]
-
-#endif
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro
deleted file mode 100644
index b6332ce46..000000000
--- a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro
+++ /dev/null
@@ -1,30 +0,0 @@
-#! [0]
-QT += widgets uiplugin
-#! [0]
-
-QTDIR_build {
-# This is only for the Qt build. Do not use externally. We mean it.
-PLUGIN_TYPE = designer
-PLUGIN_CLASS_NAME = WorldTimeClockPlugin
-load(qt_plugin)
-CONFIG += install_ok
-} else {
-# Public example:
-
-TARGET = $$qtLibraryTarget($$TARGET)
-#! [1]
-CONFIG += plugin
-TEMPLATE = lib
-#! [1]
-
-target.path = $$[QT_INSTALL_PLUGINS]/designer
-INSTALLS += target
-
-}
-
-#! [2]
-HEADERS = worldtimeclock.h \
- worldtimeclockplugin.h
-SOURCES = worldtimeclock.cpp \
- worldtimeclockplugin.cpp
-#! [2]