[Development] [Interest] [Qt3D] Mixing C++ and QML
sean.harmer at kdab.com
Fri Oct 20 12:35:17 CEST 2017
On 20/10/2017 09:06, Pierre-Yves Siret wrote:
> 2017-10-19 20:44 GMT+02:00 Shawn Rutledge <Shawn.Rutledge at qt.io
> <mailto:Shawn.Rutledge at qt.io>>:
> (thread started on the interest list, but I don’t think my comments
> belong there)
> On Oct 19, 2017, at 18:06, Sean Harmer <sean.harmer at kdab.com
> <mailto:sean.harmer at kdab.com>> wrote:
> > Hi,
> > you've hit one of the issues we did with exposing C++ and QML APIs. Namely, QQmlListProperty. This thing should ideally never have existed and instead support for properties of collections should have been added to QObject and the metaobject system.
> What exactly do you think should be done there, in case we can fix
> it some day?
> QObjects are normally managed as a tree for memory management
> purposes, so I’ve also long disliked the fact that it doesn’t quite
> match the nesting of the Item declarations in QML, because of the
> separate QList<QQuickItem *> childItems. It’s confusing and wastes
> QQmlListProperty is flexible about storage, since you get to write
> all the accessors, so you can maybe use it just for QML and also
> have normal C++ API?
> I have some gripes about QQmlListProperty too, maybe not the same ones.
> I agree that having a QQmlListProperty in a class supposed to be used
> from c++ looks alien.
Even worse, it pulls in a dependency on the QtQml module.
> Having it supported in the meta object sure looks enticing at a first
> view. Maybe with something like Q_LIST_PROPERTY(ElementType list GET
> getFunction COUNT countFunction ...).
> That ends up being quite like a simplified QAIM without the roles and
> the signals.
Exactly, where to draw the line between simple properties of collections
and full-blown models?
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts
More information about the Development