Philip Schuchardt
2018-11-12 21:09:09 UTC
I want to create a QAbstractItemModel to watches Entity that have a custom
component. The custom component would have information (a list key value
pairs) for the QAbstractItemModel to change visibility of Entity's via a
QLayer. The QAbstractItemModel would be attached to a ListView to allow
users to enable and disable visibility. I'm having trouble figuring out how
to access signals and slots for add/remove entity and component events. I'm
think about writing a custom aspect since it get's add/remove/property
updates. The custom aspect probably won't do any real work, ie no jobs, and
just produce scene updates to another component that manages
QAbstractItemModel in the frontend. I think it's possible, but Qt3D uses
QNode::id() for scene events. I would then need to covert the QNode:id() to
a QNode. It looks like there's no public API to ask the private QScene to
convert QNode::id() to a QNode*. I would have to linear search from the
root entry to all the leaf nodes to find QNode::id() for QNode*. This seems
a bit silly.
How bad is it to use private API on Q3DCore::QScene::lookupNode() function
and QNode's private data to get QScene through Q_D()?
or
Is there a public version to convert id to QNode?
or
Is this monitoring approach a bad idea? I just need a list of QEntrity's
and corresponding QComponent's and signals and slots for when they're being
added, removed, or updated for QAbstractItemModel implementation.
Thanks
Philip
component. The custom component would have information (a list key value
pairs) for the QAbstractItemModel to change visibility of Entity's via a
QLayer. The QAbstractItemModel would be attached to a ListView to allow
users to enable and disable visibility. I'm having trouble figuring out how
to access signals and slots for add/remove entity and component events. I'm
think about writing a custom aspect since it get's add/remove/property
updates. The custom aspect probably won't do any real work, ie no jobs, and
just produce scene updates to another component that manages
QAbstractItemModel in the frontend. I think it's possible, but Qt3D uses
QNode::id() for scene events. I would then need to covert the QNode:id() to
a QNode. It looks like there's no public API to ask the private QScene to
convert QNode::id() to a QNode*. I would have to linear search from the
root entry to all the leaf nodes to find QNode::id() for QNode*. This seems
a bit silly.
How bad is it to use private API on Q3DCore::QScene::lookupNode() function
and QNode's private data to get QScene through Q_D()?
or
Is there a public version to convert id to QNode?
or
Is this monitoring approach a bad idea? I just need a list of QEntrity's
and corresponding QComponent's and signals and slots for when they're being
added, removed, or updated for QAbstractItemModel implementation.
Thanks
Philip