[Interest] Qt3D QAbstractItemModel to watch QEntity's

Paul Lemire paul.lemire at kdab.com
Tue Nov 13 11:19:12 CET 2018


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 --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4282 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181113/20d102b8/attachment.bin>


More information about the Interest mailing list