summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/examples/declarative/cppextensions/plugins/plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/codesnippets/examples/declarative/cppextensions/plugins/plugin.cpp')
-rw-r--r--doc/codesnippets/examples/declarative/cppextensions/plugins/plugin.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/codesnippets/examples/declarative/cppextensions/plugins/plugin.cpp b/doc/codesnippets/examples/declarative/cppextensions/plugins/plugin.cpp
new file mode 100644
index 0000000..eef2ad7
--- /dev/null
+++ b/doc/codesnippets/examples/declarative/cppextensions/plugins/plugin.cpp
@@ -0,0 +1,19 @@
+
+//![0]
+class TimeModel (QObject):
+ hour = Property(int, getHour, notify = timeChanged)
+ minute = Property(int, getMinute, notify = timeChanged)
+//![0]
+
+//![plugin]
+class QExampleQmlPlugin (QDeclarativeExtensionPlugin):
+
+ def registerTypes(self, uri):
+ assert(uri == "com.nokia.TimeExample")
+ qmlRegisterType(TimeModel, uri, 1, 0, "Time")
+//![plugin]
+
+//![export]
+# This isn't supported by PySide yet.
+# Q_EXPORT_PLUGIN2(qmlqtimeexampleplugin, QExampleQmlPlugin);
+//![export]