diff options
Diffstat (limited to 'src/charts/xychart/qxymodelmapper.cpp')
-rw-r--r-- | src/charts/xychart/qxymodelmapper.cpp | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/charts/xychart/qxymodelmapper.cpp b/src/charts/xychart/qxymodelmapper.cpp index cd2e7a7e..553b67a6 100644 --- a/src/charts/xychart/qxymodelmapper.cpp +++ b/src/charts/xychart/qxymodelmapper.cpp @@ -1,12 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Charts module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:COMM$ -** +** $QT_BEGIN_LICENSE:GPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the @@ -15,15 +14,16 @@ ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** -** $QT_END_LICENSE$ -** -** -** -** -** -** -** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** +** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -367,31 +367,32 @@ void QXYModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottom blockSeriesSignals(); QModelIndex index; - QPointF oldPoint; QPointF newPoint; + int indexColumn = 0; + int indexRow = 0; for (int row = topLeft.row(); row <= bottomRight.row(); row++) { for (int column = topLeft.column(); column <= bottomRight.column(); column++) { index = topLeft.sibling(row, column); - if (m_orientation == Qt::Vertical && (index.column() == m_xSection || index.column() == m_ySection)) { - if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) { - QModelIndex xIndex = xModelIndex(index.row() - m_first); - QModelIndex yIndex = yModelIndex(index.row() - m_first); + indexColumn = index.column(); + indexRow = index.row(); + if (m_orientation == Qt::Vertical && (indexColumn == m_xSection || indexColumn == m_ySection)) { + if (indexRow >= m_first && (m_count == - 1 || indexRow < m_first + m_count)) { + QModelIndex xIndex = xModelIndex(indexRow - m_first); + QModelIndex yIndex = yModelIndex(indexRow - m_first); if (xIndex.isValid() && yIndex.isValid()) { - oldPoint = m_series->points().at(index.row() - m_first); newPoint.setX(valueFromModel(xIndex)); newPoint.setY(valueFromModel(yIndex)); - m_series->replace(index.row() - m_first, newPoint); + m_series->replace(indexRow - m_first, newPoint); } } - } else if (m_orientation == Qt::Horizontal && (index.row() == m_xSection || index.row() == m_ySection)) { - if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) { - QModelIndex xIndex = xModelIndex(index.column() - m_first); - QModelIndex yIndex = yModelIndex(index.column() - m_first); + } else if (m_orientation == Qt::Horizontal && (indexRow == m_xSection || indexRow == m_ySection)) { + if (indexColumn >= m_first && (m_count == - 1 || indexColumn < m_first + m_count)) { + QModelIndex xIndex = xModelIndex(indexColumn - m_first); + QModelIndex yIndex = yModelIndex(indexColumn - m_first); if (xIndex.isValid() && yIndex.isValid()) { - oldPoint = m_series->points().at(index.column() - m_first); newPoint.setX(valueFromModel(xIndex)); newPoint.setY(valueFromModel(yIndex)); - m_series->replace(index.column() - m_first, newPoint); + m_series->replace(indexColumn - m_first, newPoint); } } } |