src/declarative/qml/qdeclarativeextensionplugin.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    58     
    58     
    59     \list
    59     \list
    60     \o Subclass QDeclarativeExtensionPlugin, implement registerTypes() method
    60     \o Subclass QDeclarativeExtensionPlugin, implement registerTypes() method
    61     to register types using qmlRegisterType(), and export the class using the Q_EXPORT_PLUGIN2() macro
    61     to register types using qmlRegisterType(), and export the class using the Q_EXPORT_PLUGIN2() macro
    62     \o Write an appropriate project file for the plugin
    62     \o Write an appropriate project file for the plugin
    63     \o Create a \l{The qmldir file}{qmldir file} to describe the plugin
    63     \o Create a \l{Writing a qmldir file}{qmldir file} to describe the plugin
    64     \endlist
    64     \endlist
    65 
    65 
    66     QML extension plugins can be used to provide either application-specific or
    66     QML extension plugins can be used to provide either application-specific or
    67     library-like plugins. Library plugins should limit themselves to registering types,
    67     library-like plugins. Library plugins should limit themselves to registering types,
    68     as any manipulation of the engine's root context may cause conflicts
    68     as any manipulation of the engine's root context may cause conflicts
    77 
    77 
    78     \snippet examples/declarative/cppextensions/plugins/plugin.cpp 0
    78     \snippet examples/declarative/cppextensions/plugins/plugin.cpp 0
    79     \dots
    79     \dots
    80 
    80 
    81     To make this class available as a QML type, create a plugin that registers
    81     To make this class available as a QML type, create a plugin that registers
    82     this type using qmlRegisterType(). For this example the plugin
    82     this type with a specific \l {QML Modules}{module} using qmlRegisterType(). For this example the plugin
    83     module will be named \c com.nokia.TimeExample (as defined in the project
    83     module will be named \c com.nokia.TimeExample (as defined in the project
    84     file further below).
    84     file further below).
    85 
    85 
    86     \snippet examples/declarative/cppextensions/plugins/plugin.cpp plugin
    86     \snippet examples/declarative/cppextensions/plugins/plugin.cpp plugin
    87     \codeline
    87     \codeline
   102     DESTDIR = com/nokia/TimeExample
   102     DESTDIR = com/nokia/TimeExample
   103     TARGET = qmlqtimeexampleplugin
   103     TARGET = qmlqtimeexampleplugin
   104     ...
   104     ...
   105     \endcode    
   105     \endcode    
   106 
   106 
   107     Finally, a \l{The qmldir file}{qmldir file} is required in the \c com/nokia/TimeExample directory
   107     Finally, a \l{Writing a qmldir file}{qmldir file} is required in the \c com/nokia/TimeExample directory
   108     that describes the plugin. This directory includes a \c Clock.qml file that
   108     that describes the plugin. This directory includes a \c Clock.qml file that
   109     should be bundled with the plugin, so it needs to be specified in the \c qmldir
   109     should be bundled with the plugin, so it needs to be specified in the \c qmldir
   110     file:
   110     file:
   111 
   111 
   112     \quotefile examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir
   112     \quotefile examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir