summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/examples/declarative/cppextensions/plugins/plugin.cpp
blob: eef2ad7e4d99fd877c972418a5a6ba4896e76102 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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]