August 10, 2012

scubakid scubakid
Lab Rat
7 posts

Q_REVISION(x) macro & Q_INVOKABLE in qt5 plugin

 

Having problems getting the QML Type Versioning in cpp Plugins to work in QT5, the new Q_REVISION Macro only seems to work for signals (slots haven’t tested yet).

The Documentation does not explicitly say how to use the macro with Q_INVOKABLE’s. I see it implemented in code like qdeclarativetextinput_p.h :

“Q_INVOKABLE Q_REVISION(1) int positionAt(int x, CursorPosition position) const;”

….. My Implementation test….

MyItem Class Header
——————————

public:
Q_INVOKABLE Q_REVISION(2) QVariant getFunction() const;

signals: Q_REVISION(1) void aSignal();

qml plugin registerTypes() func
——————————————

// Class MyItem Revision 2 is available in V1.1 of module qmlRegisterType<MyItem,2>(uri, 1, 1, “MyItem”); // Class MyItem Revision 1 is available in V1.0 of module qmlRegisterType<MyItem,1>(uri, 1, 0, “MyItem”);

When I import the module v1.0 in QML it contains the Function supposed to be ONLY in Revision 2 (i.e. module v1.1) . This versioning works for the Signal and Properties.

any bright ideas? have I made a goof or is this a bug?

cheers.

1 reply

August 10, 2012

scubakid scubakid
Lab Rat
7 posts

// Class MyItem Revision 2 is available in V1.1 of module
qmlRegisterType<MyItem,2>(uri, 1, 1, “MyItem”);

// Class MyItem Revision 1 is available in V1.0 of module
qmlRegisterType<MyItem,1>(uri, 1, 0, “MyItem”);

sorry lost some formating there!

 
  ‹‹ how to add newline to a QString?      Qt and Posix timers ››

You must log in to post a reply. Not a member yet? Register here!