[Interest] Qt3D QAbstractItemModel to watch QEntity's

Philip Schuchardt vpicaver at gmail.com
Tue Nov 13 15:48:18 CET 2018


Yea, it would be really useful to have more add/remove signals. I think
having a way to see if QNode are added/removed to another QNode. There's
currently no way to see if the QNode tree has been modified structurally at
the moment. Aspects can see these changes, via QSceneChanges, but other
that that, it's all private.

I file a bug for converting QNodeId to QNode*: QTBUG-71767

On Tue, Nov 13, 2018 at 5:19 AM Paul Lemire <paul.lemire at kdab.com> wrote:

> Hi,
>
> Have you looked into using the signals:
>
> void QComponent::addedToEntity(QEntity *entity);
>
> void QComponent::removedFromEntity(QEntity *entity);
>
> That would be up to you to write a table you would update based on these
> signals to keep track of which entities reference which components.
>
> There's no public way of knowing when a component is added or removed
> from a QEntity though that would be something trivial to add for 5.13 if
> that can make your life easier.
>
> There's no public API to get a QNode* form a QNodeId. Using the private
> API QScene::lookupNode would indeed be an option but keep in mind it
> could be removed, renamed ... in future versions (though unlikely). That
> might be the quickest option to get you started.
>
> Aspects don't get access to the frontend QNode, they only communicate
> with QSceneChanges with ids. Usually aspect create a backend
> representation of the QNode with only the data they care about and with
> the changes and ids, these backend representations are kept in sync with
> the frontend.
>
> You could indeed have an aspect but would have to create backend
> representations for QEntity and your custom QComponent I suppose, which
> sounds like quite a bit of work for what you want to do.
>
> Hopefully this may be of some help,
>
> Paul
>
> --
> Paul Lemire | paul.lemire at kdab.com | Senior Software Engineer
> KDAB (France) S.A.S., a KDAB Group company
> Tel: France +33 (0)4 90 84 08 53, http://www.kdab.fr
> KDAB - The Qt, C++ and OpenGL Experts
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181113/e177fe2d/attachment.html>


More information about the Interest mailing list