From 4dcef4be656aedb7c6c9e222f291a1a508641007 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 12 May 2014 11:10:46 +0300 Subject: Enable mapping single role to multiple properties for surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-3074 Change-Id: If40de067526b6f24b3e55bf64ed804a79d473e5f Reviewed-by: Tomi Korpipää Reviewed-by: Titta Heikkala --- src/datavisualization/data/baritemmodelhandler.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/datavisualization/data/baritemmodelhandler.cpp') diff --git a/src/datavisualization/data/baritemmodelhandler.cpp b/src/datavisualization/data/baritemmodelhandler.cpp index e8941c4b..4685be44 100644 --- a/src/datavisualization/data/baritemmodelhandler.cpp +++ b/src/datavisualization/data/baritemmodelhandler.cpp @@ -55,8 +55,9 @@ void BarItemModelHandler::handleDataChanged(const QModelIndex &topLeft, for (int i = startRow; i <= endRow; i++) { for (int j = startCol; j <= endCol; j++) { + QModelIndex index = m_itemModel->index(i, j); QBarDataItem item; - QVariant valueVar = m_itemModel->index(i, j).data(m_valueRole); + QVariant valueVar = index.data(m_valueRole); float value; if (m_haveValuePattern) value = valueVar.toString().replace(m_valuePattern, m_valueReplace).toFloat(); @@ -64,7 +65,7 @@ void BarItemModelHandler::handleDataChanged(const QModelIndex &topLeft, value = valueVar.toFloat(); item.setValue(value); if (m_rotationRole != noRoleIndex) { - QVariant rotationVar = m_itemModel->index(i, j).data(m_rotationRole); + QVariant rotationVar = index.data(m_rotationRole); float rotation; if (m_haveRotationPattern) { rotation = rotationVar.toString().replace(m_rotationPattern, @@ -133,7 +134,8 @@ void BarItemModelHandler::resolveModel() for (int i = 0; i < rowCount; i++) { QBarDataRow &newProxyRow = *m_proxyArray->at(i); for (int j = 0; j < columnCount; j++) { - QVariant valueVar = m_itemModel->index(i, j).data(m_valueRole); + QModelIndex index = m_itemModel->index(i, j); + QVariant valueVar = index.data(m_valueRole); float value; if (m_haveValuePattern) value = valueVar.toString().replace(m_valuePattern, m_valueReplace).toFloat(); @@ -141,7 +143,7 @@ void BarItemModelHandler::resolveModel() value = valueVar.toFloat(); newProxyRow[j].setValue(value); if (m_rotationRole != noRoleIndex) { - QVariant rotationVar = m_itemModel->index(i, j).data(m_rotationRole); + QVariant rotationVar = index.data(m_rotationRole); float rotation; if (m_haveRotationPattern) { rotation = rotationVar.toString().replace(m_rotationPattern, -- cgit v1.2.3