mirror of https://github.com/qt/qtgraphs.git
3DScatter: Don't do unnecessary scalearray resize
When the modelhandler resolves the model, it always resizes scalearray. This patch adds a check whether the itemmodel has scale roleindex. If the model has no scale, it skips the resizing of scalearray. Pick-to: 6.10 Fixes: QTBUG-141186 Change-Id: I2718987f15c751cd187f1a398a92e10c71c9fbc6 Reviewed-by: Sakaria Pouke <sakaria.pouke@qt.io> Reviewed-by: Kwanghyo Park <kwanghyo.park@qt.io>
This commit is contained in:
parent
aedafd8f4b
commit
77ac8a5a9a
|
|
@ -274,6 +274,7 @@ void ScatterItemModelHandler::resolveModel()
|
|||
if (m_proxyArray.data() != m_proxy->series()->dataArray().data()
|
||||
|| totalCount != m_proxyArray.size()) {
|
||||
m_proxyArray.resize(totalCount);
|
||||
if (m_scaleRole != noRoleIndex)
|
||||
m_scaleArray.resize(totalCount);
|
||||
}
|
||||
|
||||
|
|
@ -281,6 +282,7 @@ void ScatterItemModelHandler::resolveModel()
|
|||
for (int i = 0; i < rowCount; i++) {
|
||||
for (int j = 0; j < columnCount; j++) {
|
||||
modelPosToScatterItem(i, j, m_proxyArray[runningCount]);
|
||||
if (m_scaleRole != noRoleIndex)
|
||||
m_scaleArray[runningCount] = modelDataToScale(i, j);
|
||||
runningCount++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ void tst_proxy::initialProperties()
|
|||
QCOMPARE(m_proxy->zPosRoleReplace(), QString());
|
||||
|
||||
QCOMPARE(m_proxy->itemCount(), 0);
|
||||
QCOMPARE(m_proxy->series()->scaleArray().size(), 0);
|
||||
|
||||
QCOMPARE(m_proxy->type(), QAbstractDataProxy::DataType::Scatter);
|
||||
}
|
||||
|
|
@ -216,6 +217,7 @@ void tst_proxy::addModel()
|
|||
QCoreApplication::processEvents();
|
||||
|
||||
QCOMPARE(m_proxy->itemCount(), 2);
|
||||
QCOMPARE(m_proxy->series()->scaleArray().size(), 0);
|
||||
QVERIFY(m_proxy->series());
|
||||
QCOMPARE(m_proxy->series(), m_series);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue