[Interest] Tired of QML

Jean-Michaël Celerier jeanmichael.celerier at gmail.com
Tue Apr 18 21:01:23 CEST 2017


On Tue, Apr 18, 2017 at 7:08 PM, Gunnar Roth <gunnar.roth at gmx.de> wrote:

> Is it really the case that QQuickItem::parent is a different function
> than QObject::parent and if
> "QQuickItem::parent is about placement in the scene." what
> is QQuickItem::parentItem then?
>

No.
In Qml :

Item { id: obj1 }
Item {
  id: obj2
  parent: obj1
}

is more or less akin to :
QQuickItem* obj1 = new QQuickItem;
QQuickItem* obj2 = new QQuickItem;
obj2->setParentItem(obj1);

As you can see in QML's QtObject (== C++'s QObject), there is no direct way
to call QObject::setParent : http://doc.qt.io/qt-5/qml-qtqml-qtobject.html

Basically, QQuickItem::parent == QObject::parent ; this function is not
accessible from QML.


Best
-------
Jean-Michaël Celerier
http://www.jcelerier.name
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170418/fba99bf6/attachment.html>


More information about the Interest mailing list