How To Install and Use QT Quick Extension Plug-In in Symbian
How To Install and Use QT Quick Extension Plug-In in Symbian
Contents
1 Introduction 2 How create Qt Quick plug-in 3 Plug-in .pro file 4 Creating a Qt Quick application 5 Testing in device 6 Example plug-in
Introduction
This article shows how to create a DLL (Qt Quick plug-in) with Qt SDK/Creator and then use it in a Qt Quick (QML) test application. Existing Qt example code (\declarative\cppextensions\plugins) has been used for this purpose.
Where qtqmltplugins is the plug-in name, corresponding to TARGET specified in plug-in .pro file and QExampleQmlPlugin is the class that is being exported. There should be exactly one occurrence of this macro in the source code for a Qt plug-in, and it should be used where the implementation is written rather than in a header file. A qmldir file, containing meta-data for the new module:
#<TypeName> [<InitialVersion>] <File> Clock 1.0 Clock.qml #plugin <Name> [<Path>] plugin qtqmltplugins
Contents
How_to_install_and_use_Qt_Quick_extension_plug-in_in_Symbian
How_to_install_and_use_Qt_Quick_extension_plug-in_in_Symbian
Clock { // this class is defined in QML (com/nokia/TimeExample/Clock.qml) width: 360 height: 360 Time { // this class is defined in C++ (plugin.cpp) id: time } hours: time.hour minutes: time.minute MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } }
Testing in device
These application can be tested easily with real devices by using AppTRK with a USB cable. Compile and deploy the qtqmltplugin by selecting "Deploy Project" and see that DLL has been really installed in the device. Next, compile and run qtqmltpluginstest to see a new QML UI element (Clock, defined in the plug-in) displayed on screen. If we touch anywhere in the UI, the application is closed.
Example plug-in
These examples are tested with Nokia N8 and Qt 4.7 File:Qtqmltplugins.zip File:Qtqmltpluginstest.zip