[Qt-qml] using revison X of QDeclarativeItem
aaron.kennedy at nokia.com
aaron.kennedy at nokia.com
Tue Jun 21 03:10:02 CEST 2011
Hi,
On 20/06/2011, at 7:28 PM, ext Pekka.E.Jokela at nokia.com<mailto:Pekka.E.Jokela at nokia.com> wrote:
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)?
It does basically what you've discovered - any element in "my.module" 1.0 that inherits QDeclarativeItem will get revision 1. As property revisions are specified separately for each class in an inheritance chain, we needed a simple way to specify what the revision of base classes should be when you register a revisioned element.
You are right that the documentation is missing - we'll look into writing some :)
#2 is this the correct way to fix my problem?
Yes
#3 is there way to control base class revision by object level instead of module level?
I don't understand what you mean by this. Can you clarify?
Cheers,
Aaron
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 {}
_______________________________________________
Qt-qml mailing list
Qt-qml at qt.nokia.com<mailto:Qt-qml at qt.nokia.com>
http://lists.qt.nokia.com/mailman/listinfo/qt-qml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110621/594887af/attachment.html
More information about the Qt-qml
mailing list