[Qt-qml] Calling a base item's overridden function?

aaron.kennedy at nokia.com aaron.kennedy at nokia.com
Tue Mar 8 04:03:35 CET 2011


Hi,

There is no way to call and overridden function in QML (we support overloaded functions, though).

Cheers,

Aaron

On 08/03/2011, at 12:49 PM, ext Gregory Schlomoff wrote:

It may work if you give an id to your Item in Item A:

<ItemA.qml>
Item {
  id: itemA
  ...
}

<ItemB.qml>

ItemA {
  functionc foo() {
    itemA.foo()
  }
}

Not tested, though...

On Mon, Mar 7, 2011 at 7:23 PM, Pelle Johnsen <pelle.johnsen at gmail.com<mailto:pelle.johnsen at gmail.com>> wrote:
Hi,

Is there a way to call a base item's overridden function?

<ItemA.qml>

Item {
    function foo() {
        console.log("ItemA.foo");
    }
}

<ItemB.qml>

ItemA {
    function foo() {
        console.log("ItemB.foo");
        // how to call ItemA.foo from here?
        ItemA.foo(); // gives error: unknown var ItemA
    }
}

Thanks in advance,

 -Pelle

_______________________________________________
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


_______________________________________________
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/20110308/81e701a4/attachment.html 


More information about the Qt-qml mailing list