Tools

Namespaces

Variants

Views

Actions

Search

Contents

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Contents

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.

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.

// 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");