Details
-
Technical task
-
Resolution: Done
-
Not Evaluated
-
None
-
-
333cf897359eab1eb37e1f60dd681b00e6a5d135 (qt/qtdatavis3d/dev)
Description
In Bars3D interface, there is Q_INVOKABLE methods to add / insert / remove QBar3DSeries, but nothing to actually check if a series is already registered.
Current workaround code (without private header inclusion and wild casts) is very inefficient with a lot of virtual and Q_INVOKE calls (while internally it could be a simple and fast container.contains() call):
bool XXX::bars3DHasSeries(QBar3DSeries* series) { bool hasSeries{false}; if ( series != nullptr && getBars3D() != nullptr ) { QQmlProperty seriesListQmlProperty(getBars3D(), "seriesList"); if ( seriesListQmlProperty.isValid() ) { QQmlListReference seriesList = qvariant_cast<QQmlListReference>( seriesListQmlProperty.read() ); if (seriesList.isValid()) for ( int s = 0; s < seriesList.count(); s++ ) if ( seriesList.at(s) == series ) { hasSeries = true; break; } } } return hasSeries; }
Sink behavior for QBar3DSeries argument of add/insert methods also is not clear in the documentation