AdaptableExtensionPlugin

Since: instead.

#include <bb/cascades/AdaptableExtensionPlugin>

A base class for asset-selection aware QML extension plugins.

AdaptableExtensionPlugin is an addition to the QDeclarativeExtensionPlugin interface that lets you create dynamically-loaded QML extensions. The QML extensions support asset selection and custom QML types.

To create a QML extension plugin:

1. Subclass AdaptableExtensionPlugin. 2. Implement registerExtensionTypes and register the types using qmlRegisterType(). 3. Export the class using the Q_EXPORT_PLUGIN2() macro. 4. Create a qmldir file to export the plugin. For example:
 plugin exampleplugin
5. Create QML assets inside a sub-folder called assets. 6. Create a qml-api.manifest file in the assets folder.
Note:

Don't export QML components in the qmldir file.

In QML, you can reference a QML type by either importing it from a registered namespace or referencing it through an asset URI. For example, if the ExampleType extension is registered at com.example.extensions.example, the import statement is:
 import com.example.extensions.example.ExampleType 1.0

In C++, if ExampleType is defined in ExampleType.qml, this is referenced as:

 QmlDocument *qml = QmlDocument::create
                       ("asset://com.example.extensions.example/ExampleType.qml");


Overview

Public Functions Index

AdaptableExtensionPlugin (QObject *parent=0)
virtual ~AdaptableExtensionPlugin ()
voidregisterExtensionTypes (const char *uri)=0
virtual voidregisterTypes (const char *uri)

Public Functions

AdaptableExtensionPlugin (

virtual~AdaptableExtensionPlugin ()

Destructor.

void registerExtensionTypes (
  • const char *uri)

Registers QML types in the given uri.

Subclasses should implement this to call qmlRegisterType() for all types which are provided by the extension plugin.

Parameters
uri

An identifier generated by the QML engine using the name and path of the extension's plugin library.

virtual void registerTypes (
  • const char *uri)

Registers QML types so they are asset-selection aware.

Warning!

If this method is overridden, it must be called. Alternatively, use registerExtensionTypes instead.

Parameters
uri

An identifier generated by the QML engine using the name and path of the extension's plugin library.

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus