diff --git a/examples/qml/plugins/README b/examples/qml/plugins/README deleted file mode 100644 index f4f9074059376ca4808d82fef3c0879712666b97..0000000000000000000000000000000000000000 --- a/examples/qml/plugins/README +++ /dev/null @@ -1,9 +0,0 @@ -This example shows a module "com.nokia.TimeExample" that is implemented -by a C++ plugin (providing the "Time" type), and by QML files (providing the -"Clock" type). - -To run: - - make install - QML_IMPORT_PATH=$PWD qmlscene plugins.qml - diff --git a/examples/qml/plugins/doc/images/qml-plugins-example.png b/examples/qml/plugins/doc/images/qml-plugins-example.png new file mode 100644 index 0000000000000000000000000000000000000000..c2d4886ea2bfea22133cc996df6837567a3d5429 Binary files /dev/null and b/examples/qml/plugins/doc/images/qml-plugins-example.png differ diff --git a/examples/qml/plugins/doc/src/qmlpluginex.qdoc b/examples/qml/plugins/doc/src/qmlpluginex.qdoc new file mode 100644 index 0000000000000000000000000000000000000000..464f42a34c4f2be37692b7378e47b4c17d45e5ed --- /dev/null +++ b/examples/qml/plugins/doc/src/qmlpluginex.qdoc @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title QML Plugin Example + \example plugins + + \brief This example creates a C++ plugin extension by subclassing QQmlExtensionPlugin. + + \image qml-plugins-example.png + + To run this example, use the following commands on the prompt: + \code + > qmake + > make + > qmlscene -I imports plugins.qml + \endcode +*/ diff --git a/examples/qml/plugins/com/nokia/TimeExample/Clock.qml b/examples/qml/plugins/imports/TimeExample/Clock.qml similarity index 100% rename from examples/qml/plugins/com/nokia/TimeExample/Clock.qml rename to examples/qml/plugins/imports/TimeExample/Clock.qml diff --git a/examples/qml/plugins/com/nokia/TimeExample/center.png b/examples/qml/plugins/imports/TimeExample/center.png similarity index 100% rename from examples/qml/plugins/com/nokia/TimeExample/center.png rename to examples/qml/plugins/imports/TimeExample/center.png diff --git a/examples/qml/plugins/com/nokia/TimeExample/clock.png b/examples/qml/plugins/imports/TimeExample/clock.png similarity index 100% rename from examples/qml/plugins/com/nokia/TimeExample/clock.png rename to examples/qml/plugins/imports/TimeExample/clock.png diff --git a/examples/qml/plugins/com/nokia/TimeExample/hour.png b/examples/qml/plugins/imports/TimeExample/hour.png similarity index 100% rename from examples/qml/plugins/com/nokia/TimeExample/hour.png rename to examples/qml/plugins/imports/TimeExample/hour.png diff --git a/examples/qml/plugins/com/nokia/TimeExample/minute.png b/examples/qml/plugins/imports/TimeExample/minute.png similarity index 100% rename from examples/qml/plugins/com/nokia/TimeExample/minute.png rename to examples/qml/plugins/imports/TimeExample/minute.png diff --git a/examples/qml/plugins/com/nokia/TimeExample/qmldir b/examples/qml/plugins/imports/TimeExample/qmldir similarity index 62% rename from examples/qml/plugins/com/nokia/TimeExample/qmldir rename to examples/qml/plugins/imports/TimeExample/qmldir index 9304d95435eb2414dd00b5be20c988ba68ee4191..252e662e12d248fdf12d154bbbcec74c76239cc2 100644 --- a/examples/qml/plugins/com/nokia/TimeExample/qmldir +++ b/examples/qml/plugins/imports/TimeExample/qmldir @@ -1,3 +1,3 @@ -module com.nokia.TimeExample +module TimeExample Clock 1.0 Clock.qml plugin qmlqtimeexampleplugin diff --git a/examples/qml/plugins/plugin.cpp b/examples/qml/plugins/plugin.cpp index 6fce23b62c7558d6279744a43f1ad3bd0d4dbfbe..d9bbded9964b8647d4964114b1701471739638c8 100644 --- a/examples/qml/plugins/plugin.cpp +++ b/examples/qml/plugins/plugin.cpp @@ -146,7 +146,7 @@ class QExampleQmlPlugin : public QQmlExtensionPlugin public: void registerTypes(const char *uri) { - Q_ASSERT(uri == QLatin1String("com.nokia.TimeExample")); + Q_ASSERT(uri == QLatin1String("TimeExample")); qmlRegisterType<TimeModel>(uri, 1, 0, "Time"); } }; diff --git a/examples/qml/plugins/plugins.pro b/examples/qml/plugins/plugins.pro index e127509c0d73e786b6359b1ccd118fe34f9fe02a..2c748f795213ebaa1e55dd5c12e5fdcc4a6b6614 100644 --- a/examples/qml/plugins/plugins.pro +++ b/examples/qml/plugins/plugins.pro @@ -2,24 +2,24 @@ TEMPLATE = lib CONFIG += qt plugin QT += qml -DESTDIR = com/nokia/TimeExample +DESTDIR = imports/TimeExample TARGET = qmlqtimeexampleplugin SOURCES += plugin.cpp qdeclarativesources.files += \ - com/nokia/TimeExample/qmldir \ - com/nokia/TimeExample/center.png \ - com/nokia/TimeExample/clock.png \ - com/nokia/TimeExample/Clock.qml \ - com/nokia/TimeExample/hour.png \ - com/nokia/TimeExample/minute.png + imports/TimeExample/qmldir \ + imports/TimeExample/center.png \ + imports/TimeExample/clock.png \ + imports/TimeExample/Clock.qml \ + imports/TimeExample/hour.png \ + imports/TimeExample/minute.png -qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/com/nokia/TimeExample +qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/imports/TimeExample -sources.files += plugins.pro plugin.cpp plugins.qml README +sources.files += plugins.pro plugin.cpp plugins.qml sources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins -target.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/com/nokia/TimeExample +target.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/imports/TimeExample INSTALLS += qdeclarativesources sources target diff --git a/examples/qml/plugins/plugins.qml b/examples/qml/plugins/plugins.qml index a184395c642a4aa7c9f20d663d0fa054473e4bf5..db570cf307155b84ca5f53112d498fa75c7ceff1 100644 --- a/examples/qml/plugins/plugins.qml +++ b/examples/qml/plugins/plugins.qml @@ -38,9 +38,9 @@ ** ****************************************************************************/ //![0] -import com.nokia.TimeExample 1.0 // import types from the plugin +import TimeExample 1.0 // import types from the plugin -Clock { // this class is defined in QML (com/nokia/TimeExample/Clock.qml) +Clock { // this class is defined in QML (imports/TimeExample/Clock.qml) Time { // this class is defined in C++ (plugin.cpp) id: time diff --git a/src/qml/doc/snippets/qml/imports/timeexample.qml b/src/qml/doc/snippets/qml/imports/timeexample.qml index f9c2411d029442cee8c59aed1d9ee7e6c6a6a668..97668452c023d6a026da18efc8cdfb12fc6ce5cf 100644 --- a/src/qml/doc/snippets/qml/imports/timeexample.qml +++ b/src/qml/doc/snippets/qml/imports/timeexample.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [import] -import com.nokia.TimeExample 1.0 +import TimeExample 1.0 //! [import] Item { diff --git a/src/qml/doc/src/modules/cppplugins.qdoc b/src/qml/doc/src/modules/cppplugins.qdoc index 31ff02c2f4ecd4dca3007aee3c770d2dae1b6a65..2a08d732c0581edb1b8cb576be0adba89397ce11 100644 --- a/src/qml/doc/src/modules/cppplugins.qdoc +++ b/src/qml/doc/src/modules/cppplugins.qdoc @@ -87,12 +87,12 @@ types into the runtime. For this example, the TimeExample source directory is in - \c{com/nokia/TimeExample}. The plugin's type namespace will mirror + \c{imports/TimeExample}. The plugin's type namespace will mirror this structure, so the types are registered into the namespace - "com.nokia.TimeExample". + "TimeExample". Additionally, the project file, in a \c .pro file, defines the project as a plugin library, - specifies it should be built into the \c com/nokia/TimeExample directory, and registers + specifies it should be built into the \c imports/TimeExample directory, and registers the plugin target name and various other details: \code @@ -100,21 +100,21 @@ CONFIG += qt plugin QT += qml - DESTDIR = com/nokia/TimeExample + DESTDIR = imports/TimeExample TARGET = qmlqtimeexampleplugin SOURCES += qexampleqmlplugin.cpp \endcode Finally, a \l{Module Definition qmldir Files}{qmldir file} is required - in the \c com/nokia/TimeExample directory to describe the plugin and the types that it + 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 (as shown above in the \c .pro file) so both of these need to be specified in the \c qmldir file: - \quotefile examples/qml/plugins/com/nokia/TimeExample/qmldir + \quotefile examples/qml/plugins/imports/TimeExample/qmldir Once the project is built and installed, the new \c Time component is - accessible by any QML component that imports the \c com.nokia.TimeExample + accessible by any QML component that imports the \c TimeExample module \snippet examples/qml/plugins/plugins.qml 0 diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index 36abc3a9e41dba1b3b18fe1040d07bd6f7dd4f0e..2f0e804019c9222bc0fd7224413f189e2355ecaf 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE To make this class available as a QML type, create a plugin that registers this type with a specific \l {QML Modules}{module} using qmlRegisterType(). For this example the plugin - module will be named \c com.nokia.TimeExample (as defined in the project + module will be named \c TimeExample (as defined in the project file further below). \snippet examples/qml/plugins/plugin.cpp plugin @@ -93,27 +93,27 @@ QT_BEGIN_NAMESPACE ensures the module is imported correctly by any QML components that use this plugin. The project file defines the project as a plugin library and specifies - it should be built into the \c com/nokia/TimeExample directory: + it should be built into the \c imports/TimeExample directory: \code TEMPLATE = lib CONFIG += qt plugin QT += qml - DESTDIR = com/nokia/TimeExample + DESTDIR = imports/TimeExample TARGET = qmlqtimeexampleplugin ... \endcode - Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c com/nokia/TimeExample directory + Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c imports/TimeExample directory that describes the plugin. This directory includes a \c Clock.qml file that should be bundled with the plugin, so it needs to be specified in the \c qmldir file: - \quotefile examples/qml/plugins/com/nokia/TimeExample/qmldir + \quotefile examples/qml/plugins/imports/TimeExample/qmldir Once the project is built and installed, the new \c Time element can be - used by any QML component that imports the \c com.nokia.TimeExample module: + used by any QML component that imports the \c TimeExample module: \snippet examples/qml/plugins/plugins.qml 0