You Are Here:

Community: Wiki

This page was last modified on 3 September 2009, at 07:14.

CS001390 - Defining a Qt plug-in interface

From Forum Nokia Wiki


ID CS001390 Creation date June 16, 2009
Platform S60 3rd Edition, FP1, FP2
S60 5th Edition
Tested on devices Nokia 5800 XpressMusic
Category Qt for Symbian Subcategory Base/System


Keywords (APIs, classes, methods, functions): QPluginLoader, Q_DECLARE_INTERFACE, Q_INTERFACES, Q_EXPORT_PLUGIN2

Overview

Qt applications can be extended with Qt plug-ins, which means that some of the application functionality is implemented as common plug-in libraries loaded into the application memory at runtime. To be extendable, the application has to define a common plug-in interface (exampleplugininterface.h). Note that the application does not see the plug-ins directly but only methods and data that are defined into the interface. The detection and loading of plug-ins is handled using QPluginLoader.

This code snippet demonstrates how to define the lower-level Qt plug-in interface. Implementing the interface and using the plug-in are described in additional snippet articles.

Note: In order to use this code, you need to have Qt for S60 installed on your platform.


Preconditions


Header (exampleplugininterface.h)

The plug-in interface for all "example plug-ins". The plug-in must implement the virtual sayHello() method and the virtual someSlot() slot.

#include <QObject>
#include <QString>
 
class ExamplePluginInterface : public QObject
{
public:
virtual ~ExamplePluginInterface() {}
virtual QString sayHello() = 0;
 
public slots:
virtual void someSlot(QString value) = 0;
 
protected: // Common data for the plugins
QString data;
};
 
// This Qt macro associates the given Identifier
// "Forum.Nokia.wiki.pluginsnippet.ExamplePluginInterface/1.0"
// to the interface class called ExamplePluginInterface.
// The Identifier must be unique.
Q_DECLARE_INTERFACE(ExamplePluginInterface,
"Forum.Nokia.wiki.pluginsnippet.ExamplePluginInterface/1.0");

See also


Postconditions

The Qt plug-in interface is defined.

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fCS001424E5fE2dE5fUsingE5ftheE5fE44E45PE4cOYME45NTE5fkeywordE5finE5faE5fE51tE5fpackageE5ffileX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZE71tQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxE71tX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ