[Qt-qml] using revison X of QDeclarativeItem
Pekka.E.Jokela at nokia.com
Pekka.E.Jokela at nokia.com
Mon Jun 20 11:28:49 CEST 2011
Hi,
We are creating our own QML module and inside the module we derive from QDeclarativeItem in cpp.
If I just derive like
class MyClass : public QDeclarativeItem
{
...
};
And register that as
qmlRegisterType<MyClass>("my.module", 1, 0, "MyClass");
in the plug-in's virtual registerTypes() function, the QML:
import my.module 1.0
import QtQuick 1.1
MyClass {
Component.onCompleted: console.log(hasOwnProperty("implicitHeight"))
}
Prints out "false" even though I'm using Qt 4.7.4 i.e. the revision "none" is used of QDeclarativeItem. I would like to use revision 1 of the QDeclarativeItem so that the implicitHeight would be available as well.
I found a function qmlRegisterRevision, which I used in my registerTypes() function as
qmlRegisterRevision<QDeclarativeItem,1>("my.module",1,0);
which fixed my problem i.e. revision 1 of the QDeclarativeItem is used and the script above prints "true".
#1 can someone explain what the qmlRegisterRevision does (there is no documentation available)?
#2 is this the correct way to fix my problem?
#3 is there way to control base class revision by object level instead of module level?
Thanks a lot,
Pekka
Qt Components for Symbian
Ps. in QML this is easy, just have MyClass.qml as
import QtQuick 1.0 // for revision "none" or 1.1 for revision 1
Item {}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110620/cc09898e/attachment.html
More information about the Qt-qml
mailing list