From 1f47b1a7ae58702dccc57a9ccbaa905441f4fecb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 2 Aug 2017 16:50:03 +0300 Subject: Use range-for instead of foreach in examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-60662 Change-Id: Ief9264e2b6670466bd74278dbd194a7be81d614f Reviewed-by: André Hartmann Reviewed-by: Tomi Korpipää Reviewed-by: Miikka Heikkinen --- examples/charts/barmodelmapper/customtablemodel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/charts/barmodelmapper/customtablemodel.cpp') diff --git a/examples/charts/barmodelmapper/customtablemodel.cpp b/examples/charts/barmodelmapper/customtablemodel.cpp index 23b5271c..a1446386 100644 --- a/examples/charts/barmodelmapper/customtablemodel.cpp +++ b/examples/charts/barmodelmapper/customtablemodel.cpp @@ -89,10 +89,10 @@ QVariant CustomTableModel::data(const QModelIndex &index, int role) const } else if (role == Qt::EditRole) { return m_data[index.row()]->at(index.column()); } else if (role == Qt::BackgroundRole) { - QRect rect; - foreach (rect, m_mapping) - if (rect.contains(index.column(), index.row())) - return QColor(m_mapping.key(rect)); + for (const QRect &rect : m_mapping) { + if (rect.contains(index.column(), index.row())) + return QColor(m_mapping.key(rect)); + } // cell not mapped return white color return QColor(Qt::white); -- cgit v1.2.3