diff options
author | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-04-28 11:08:02 +0200 |
---|---|---|
committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-05-12 15:06:42 +0200 |
commit | d88b52b541a0482b69639dbea8976287db9ca52b (patch) | |
tree | 459b4e3e373a23a7e0578aece4dc4b5cccaf9ba4 | |
parent | 13fc038d8d4baa9e199fbd5a7e4c08650a88172e (diff) | |
download | qtdeclarative-d88b52b541a0482b69639dbea8976287db9ca52b.tar.gz |
Examples: Move Qml plugin example to manual tests
Outdated documention has been removed.
Task-number: QTBUG-111036
Change-Id: I8db138ff71615a6ed6ac4cebdb365c27252fa5ee
Pick-to: 6.5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | examples/qml/CMakeLists.txt | 1 | ||||
-rw-r--r-- | examples/qml/qml.pro | 5 | ||||
-rw-r--r-- | src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc | 82 | ||||
-rw-r--r-- | tests/auto/quick/examples/tst_examples.cpp | 1 | ||||
-rw-r--r-- | tests/manual/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/CMakeLists.txt (renamed from examples/qml/qmlextensionplugins/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/doc/images/qml-plugins-example.png (renamed from examples/qml/qmlextensionplugins/doc/images/qml-plugins-example.png) | bin | 15773 -> 15773 bytes | |||
-rw-r--r-- | tests/manual/qmlextensionplugins/doc/src/qmlpluginex.qdoc (renamed from examples/qml/qmlextensionplugins/doc/src/qmlpluginex.qdoc) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/imports/TimeExample/Clock.qml (renamed from examples/qml/qmlextensionplugins/imports/TimeExample/Clock.qml) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/imports/TimeExample/center.png (renamed from examples/qml/qmlextensionplugins/imports/TimeExample/center.png) | bin | 765 -> 765 bytes | |||
-rw-r--r-- | tests/manual/qmlextensionplugins/imports/TimeExample/clock.png (renamed from examples/qml/qmlextensionplugins/imports/TimeExample/clock.png) | bin | 20653 -> 20653 bytes | |||
-rw-r--r-- | tests/manual/qmlextensionplugins/imports/TimeExample/hour.png (renamed from examples/qml/qmlextensionplugins/imports/TimeExample/hour.png) | bin | 518 -> 518 bytes | |||
-rw-r--r-- | tests/manual/qmlextensionplugins/imports/TimeExample/minute.png (renamed from examples/qml/qmlextensionplugins/imports/TimeExample/minute.png) | bin | 528 -> 528 bytes | |||
-rw-r--r-- | tests/manual/qmlextensionplugins/imports/TimeExample/qmldir (renamed from examples/qml/qmlextensionplugins/imports/TimeExample/qmldir) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/plugin.cpp (renamed from examples/qml/qmlextensionplugins/plugin.cpp) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/plugins.qml (renamed from examples/qml/qmlextensionplugins/plugins.qml) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/plugins.qmlproject (renamed from examples/qml/qmlextensionplugins/plugins.qmlproject) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/qmlextensionplugins.pro (renamed from examples/qml/qmlextensionplugins/qmlextensionplugins.pro) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/timemodel.cpp (renamed from examples/qml/qmlextensionplugins/timemodel.cpp) | 0 | ||||
-rw-r--r-- | tests/manual/qmlextensionplugins/timemodel.h (renamed from examples/qml/qmlextensionplugins/timemodel.h) | 0 |
20 files changed, 1 insertions, 89 deletions
diff --git a/examples/qml/CMakeLists.txt b/examples/qml/CMakeLists.txt index 331a4dcda4..b4abeb8a52 100644 --- a/examples/qml/CMakeLists.txt +++ b/examples/qml/CMakeLists.txt @@ -3,7 +3,6 @@ add_subdirectory(tutorials) if(TARGET Qt6::Quick) - qt_internal_add_example(qmlextensionplugins) if (TARGET Qt6::lupdate) qt_internal_add_example(qml-i18n) endif() diff --git a/examples/qml/qml.pro b/examples/qml/qml.pro index b59620cb81..e2da016924 100644 --- a/examples/qml/qml.pro +++ b/examples/qml/qml.pro @@ -1,11 +1,6 @@ TEMPLATE = subdirs QT_FOR_CONFIG += qml -qtHaveModule(quick) { - SUBDIRS += \ - qmlextensionplugins -} - SUBDIRS += \ tutorials diff --git a/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc b/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc index fca702a278..771d520f8a 100644 --- a/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc +++ b/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc @@ -62,85 +62,3 @@ that's part of the same binary as the registration: volatile auto registration = &qml_register_types_my_module; Q_UNUSED(registration); \endcode - -\section1 TimeExample QML Extension Plugin - -Suppose there is a new \c TimeModel C++ class that should be made available -as a new QML type. It provides the current time through \c hour and \c minute -properties. It declares a QML type called \c Time via \l QML_NAMED_ELEMENT(). - -\snippet qmlextensionplugins/timemodel.h 0 -\dots - -To make this type available, create a plugin class named \c QExampleQmlPlugin, -which is a subclass of \l QQmlEngineExtensionPlugin. It uses the -Q_PLUGIN_METADATA() macro in the class definition to register the plugin with -the Qt meta object system using a unique identifier for the plugin. - -\snippet qmlextensionplugins/plugin.cpp plugin - -\section1 Build Settings for the Plugin - -The build file defines the project as a plugin library, specifies it should be -built into the \c imports/TimeExample directory, and registers the plugin -target name. - -\section2 Using CMake: - -\snippet qmlextensionplugins/CMakeLists.txt 0 - -\snippet qmlextensionplugins/CMakeLists.txt 1 - -\section2 Using qmake: - -\code -TEMPLATE = lib -CONFIG += qt plugin qmltypes -QT += qml - -QML_IMPORT_NAME = TimeExample -QML_IMPORT_MAJOR_VERSION = 1 - -DESTDIR = imports/$$QML_IMPORT_NAME -TARGET = qmlqtimeexampleplugin - -SOURCES += qexampleqmlplugin.cpp -\endcode - -This registers the \c TimeModel class, with the import \c{TimeExample 1.0}, as -a QML type called \c Time. The \l{Defining QML Types from C++} article has more -information about registering C++ types for usage in QML. - -\section1 Plugin Definition in the qmldir - -Finally, a \l {Module Definition qmldir Files} {qmldir file} is required -in the \c imports/TimeExample directory to describe the plugin and the types -that it exports. The plugin includes a \c Clock.qml file along with the -\c qmlqtimeexampleplugin that is built by the project. - -CMake will, by default, automatically generate this file. For more -information, see \l {Auto-generating qmldir and typeinfo files}. - -When using qmake, specify the following in the \c qmldir file: - -\quotefile qmlextensionplugins/imports/TimeExample/qmldir - -To make things easier for this example, the TimeExample source directory is in -\c{imports/TimeExample}, and we build -\l{Source, Build, and Install Directories}{in-source}. However, the structure -of the source directory is not important, as the \c qmldir file can specify -paths to installed QML files. - -What is important is the name of the directory that the qmldir is installed -into. When the user imports our module, the QML engine uses the -\l{Contents of a Module Definition qmldir File}{module identifier} -(\c TimeExample) to find the plugin, so the directory in which it is -installed must match the module identifier. - -Once the project is built and installed, the new \c Time component is -accessible by any QML component that imports the \c TimeExample -module. - -\snippet qmlextensionplugins/plugins.qml 0 - -The full source code is available in the \l {qmlextensionplugins}{plugins example}. diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index de27fe92cb..76b67f9a04 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -54,7 +54,6 @@ tst_examples::tst_examples() // Add directories you want excluded here excludedDirs << "shared"; //Not an example excludedDirs << "snippets/qml/path"; //No root QQuickItem - excludedDirs << "examples/qml/qmlextensionplugins"; //Requires special import search path // These snippets are not expected to run on their own. excludedDirs << "snippets/qml/visualdatamodel_rootindex"; diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt index 0d45a56c4e..48d0adae75 100644 --- a/tests/manual/CMakeLists.txt +++ b/tests/manual/CMakeLists.txt @@ -20,3 +20,4 @@ add_subdirectory(frameanimation) if(QT_FEATURE_qml_network AND TARGET Qt::Quick) add_subdirectory(networkaccessmanagerfactory) endif() +add_subdirectory(qmlextensionplugins) diff --git a/examples/qml/qmlextensionplugins/CMakeLists.txt b/tests/manual/qmlextensionplugins/CMakeLists.txt index 26e454b0b4..26e454b0b4 100644 --- a/examples/qml/qmlextensionplugins/CMakeLists.txt +++ b/tests/manual/qmlextensionplugins/CMakeLists.txt diff --git a/examples/qml/qmlextensionplugins/doc/images/qml-plugins-example.png b/tests/manual/qmlextensionplugins/doc/images/qml-plugins-example.png Binary files differindex c2d4886ea2..c2d4886ea2 100644 --- a/examples/qml/qmlextensionplugins/doc/images/qml-plugins-example.png +++ b/tests/manual/qmlextensionplugins/doc/images/qml-plugins-example.png diff --git a/examples/qml/qmlextensionplugins/doc/src/qmlpluginex.qdoc b/tests/manual/qmlextensionplugins/doc/src/qmlpluginex.qdoc index 80f39e36ce..80f39e36ce 100644 --- a/examples/qml/qmlextensionplugins/doc/src/qmlpluginex.qdoc +++ b/tests/manual/qmlextensionplugins/doc/src/qmlpluginex.qdoc diff --git a/examples/qml/qmlextensionplugins/imports/TimeExample/Clock.qml b/tests/manual/qmlextensionplugins/imports/TimeExample/Clock.qml index b071e2e031..b071e2e031 100644 --- a/examples/qml/qmlextensionplugins/imports/TimeExample/Clock.qml +++ b/tests/manual/qmlextensionplugins/imports/TimeExample/Clock.qml diff --git a/examples/qml/qmlextensionplugins/imports/TimeExample/center.png b/tests/manual/qmlextensionplugins/imports/TimeExample/center.png Binary files differindex 7fbd802a44..7fbd802a44 100644 --- a/examples/qml/qmlextensionplugins/imports/TimeExample/center.png +++ b/tests/manual/qmlextensionplugins/imports/TimeExample/center.png diff --git a/examples/qml/qmlextensionplugins/imports/TimeExample/clock.png b/tests/manual/qmlextensionplugins/imports/TimeExample/clock.png Binary files differindex 462edacc0e..462edacc0e 100644 --- a/examples/qml/qmlextensionplugins/imports/TimeExample/clock.png +++ b/tests/manual/qmlextensionplugins/imports/TimeExample/clock.png diff --git a/examples/qml/qmlextensionplugins/imports/TimeExample/hour.png b/tests/manual/qmlextensionplugins/imports/TimeExample/hour.png Binary files differindex 9f33fc5d48..9f33fc5d48 100644 --- a/examples/qml/qmlextensionplugins/imports/TimeExample/hour.png +++ b/tests/manual/qmlextensionplugins/imports/TimeExample/hour.png diff --git a/examples/qml/qmlextensionplugins/imports/TimeExample/minute.png b/tests/manual/qmlextensionplugins/imports/TimeExample/minute.png Binary files differindex e2f216c897..e2f216c897 100644 --- a/examples/qml/qmlextensionplugins/imports/TimeExample/minute.png +++ b/tests/manual/qmlextensionplugins/imports/TimeExample/minute.png diff --git a/examples/qml/qmlextensionplugins/imports/TimeExample/qmldir b/tests/manual/qmlextensionplugins/imports/TimeExample/qmldir index 252e662e12..252e662e12 100644 --- a/examples/qml/qmlextensionplugins/imports/TimeExample/qmldir +++ b/tests/manual/qmlextensionplugins/imports/TimeExample/qmldir diff --git a/examples/qml/qmlextensionplugins/plugin.cpp b/tests/manual/qmlextensionplugins/plugin.cpp index 066d284a5e..066d284a5e 100644 --- a/examples/qml/qmlextensionplugins/plugin.cpp +++ b/tests/manual/qmlextensionplugins/plugin.cpp diff --git a/examples/qml/qmlextensionplugins/plugins.qml b/tests/manual/qmlextensionplugins/plugins.qml index 55e8903400..55e8903400 100644 --- a/examples/qml/qmlextensionplugins/plugins.qml +++ b/tests/manual/qmlextensionplugins/plugins.qml diff --git a/examples/qml/qmlextensionplugins/plugins.qmlproject b/tests/manual/qmlextensionplugins/plugins.qmlproject index c2de5f5703..c2de5f5703 100644 --- a/examples/qml/qmlextensionplugins/plugins.qmlproject +++ b/tests/manual/qmlextensionplugins/plugins.qmlproject diff --git a/examples/qml/qmlextensionplugins/qmlextensionplugins.pro b/tests/manual/qmlextensionplugins/qmlextensionplugins.pro index c074b8d671..c074b8d671 100644 --- a/examples/qml/qmlextensionplugins/qmlextensionplugins.pro +++ b/tests/manual/qmlextensionplugins/qmlextensionplugins.pro diff --git a/examples/qml/qmlextensionplugins/timemodel.cpp b/tests/manual/qmlextensionplugins/timemodel.cpp index a94a7e773d..a94a7e773d 100644 --- a/examples/qml/qmlextensionplugins/timemodel.cpp +++ b/tests/manual/qmlextensionplugins/timemodel.cpp diff --git a/examples/qml/qmlextensionplugins/timemodel.h b/tests/manual/qmlextensionplugins/timemodel.h index 2c27a6dada..2c27a6dada 100644 --- a/examples/qml/qmlextensionplugins/timemodel.h +++ b/tests/manual/qmlextensionplugins/timemodel.h |