summaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative')
-rw-r--r--examples/declarative/cppextensions/plugins/plugin.cpp6
-rw-r--r--examples/declarative/cppextensions/plugins/plugins.qml3
2 files changed, 8 insertions, 1 deletions
diff --git a/examples/declarative/cppextensions/plugins/plugin.cpp b/examples/declarative/cppextensions/plugins/plugin.cpp
index 355ca3f..01d5361 100644
--- a/examples/declarative/cppextensions/plugins/plugin.cpp
+++ b/examples/declarative/cppextensions/plugins/plugin.cpp
@@ -96,11 +96,13 @@ private:
QBasicTimer timer;
};
+//![0]
class TimeModel : public QObject
{
Q_OBJECT
Q_PROPERTY(int hour READ hour NOTIFY timeChanged)
Q_PROPERTY(int minute READ minute NOTIFY timeChanged)
+//![0]
public:
TimeModel(QObject *parent=0) : QObject(parent)
@@ -135,6 +137,7 @@ private:
int TimeModel::instances=0;
MinuteTimer *TimeModel::timer=0;
+//![plugin]
class QExampleQmlPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
@@ -145,7 +148,10 @@ public:
qmlRegisterType<TimeModel>(uri, 1, 0, "Time");
}
};
+//![plugin]
#include "plugin.moc"
+//![export]
Q_EXPORT_PLUGIN2(qmlqtimeexampleplugin, QExampleQmlPlugin);
+//![export]
diff --git a/examples/declarative/cppextensions/plugins/plugins.qml b/examples/declarative/cppextensions/plugins/plugins.qml
index 1832017..8d1085c 100644
--- a/examples/declarative/cppextensions/plugins/plugins.qml
+++ b/examples/declarative/cppextensions/plugins/plugins.qml
@@ -37,7 +37,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
+//![0]
import com.nokia.TimeExample 1.0 // import types from the plugin
Clock { // this class is defined in QML (com/nokia/TimeExample/Clock.qml)
@@ -49,3 +49,4 @@ Clock { // this class is defined in QML (com/nokia/TimeExample/Clock.qml)
hours: time.hour
minutes: time.minute
}
+//![0]