QML Extension Objects: Registering extended type for default QML Items through qmlRegisterExtendedType
-
Hello!
I would like to extend all default elements available in QML with a new property. How to do this for custom types is explained in "QML Extension Objects":http://doc.qt.nokia.com/4.7-snapshot/qml-extending.html#extension-objects
This works as expected when I try it like this
@qmlRegisterExtendedType<QDeclarativeItem, SomeObject>("QtQuick", 1, 1, "SomeItem");@
but it does exactly nothing when I try the following
@qmlRegisterExtendedType<QDeclarativeItem, SomeObject>("QtQuick", 1, 1, "Item");@What exactly is the reason for this behaviour? Is it somehow possible to change all QDeclarativeItem derived Components (e.g. Rectangle, Text, etc.) at once, without having to modify QDeclarativeItem's source code?
Greets,
Bernhard -
Just a hunch : item is a reserved keyword?
-
Yes, this might be the reason. But I thought of it as an easy way to add some properties to all Items available. Especially I expected this to work since the doc I mentioned above states, that the extension object is just a child of the extended object.
-
Guys, I ran into the same problem. I was trying to extend QDeclarativeItem with some properties, but then I cannot access anymore the "implicitWidth" and "implicitHeight" properties. More, state change seems not to be signaled either... Any idea? This is using Qt 4.8.1 on Linux.
Thx!