diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-10-11 17:49:09 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-10-13 11:50:40 +0200 |
commit | 8321f6f0b358f23649169a84293ce3c4c6e3c9cc (patch) | |
tree | 63a28f6c25a3f4a1d1a3bb87125b2742f09ee423 /src | |
parent | 08f0ba6a5a94ae4b4c70a2d8d726b8dc9c36b5cf (diff) |
Tidy up, modernise and simplify some minor details
A switch doesn't need a semicolon on its close-brace.
A qWarning() can take a string parameter instead of <<ing it; and we
can format a qint64 just fine using %lld.
A list can be constructed with an element instead of <<ing it.
Use ranged-for loops in preference to foreach.
Change-Id: Iceec379ddeb2c7e0c5ce24fc3b6b57f5f32d53ee
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/charts/axis/qabstractaxis.cpp | 6 | ||||
-rw-r--r-- | src/charts/chartdataset.cpp | 3 | ||||
-rw-r--r-- | src/charts/layout/cartesianchartlayout.cpp | 11 | ||||
-rw-r--r-- | src/charts/qabstractseries.cpp | 21 |
4 files changed, 18 insertions, 23 deletions
diff --git a/src/charts/axis/qabstractaxis.cpp b/src/charts/axis/qabstractaxis.cpp index dfbe02e1..74ee23d6 100644 --- a/src/charts/axis/qabstractaxis.cpp +++ b/src/charts/axis/qabstractaxis.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Charts module of the Qt Toolkit. @@ -1090,9 +1090,9 @@ void QAbstractAxisPrivate::setAlignment(Qt::Alignment alignment) m_orientation = Qt::Vertical; break; default: - qWarning()<<"No alignment specified !"; + qWarning("No alignment specified !"); break; - }; + } m_alignment = alignment; } diff --git a/src/charts/chartdataset.cpp b/src/charts/chartdataset.cpp index f382b87d..86f97ee4 100644 --- a/src/charts/chartdataset.cpp +++ b/src/charts/chartdataset.cpp @@ -254,9 +254,8 @@ bool ChartDataSet::attachAxis(QAbstractSeries *series,QAbstractAxis *axis) if (!domain->attachAxis(axis)) return false; - QList<AbstractDomain *> blockedDomains; domain->blockRangeSignals(true); - blockedDomains << domain; + QList<AbstractDomain *> blockedDomains { domain }; if (domain != series->d_ptr->domain()) { foreach (QAbstractAxis *axis, series->d_ptr->m_axes) { diff --git a/src/charts/layout/cartesianchartlayout.cpp b/src/charts/layout/cartesianchartlayout.cpp index e46b3f15..aef7748c 100644 --- a/src/charts/layout/cartesianchartlayout.cpp +++ b/src/charts/layout/cartesianchartlayout.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Charts module of the Qt Toolkit. @@ -64,8 +64,7 @@ QRectF CartesianChartLayout::calculateAxisGeometry(const QRectF &geometry, int topCount = 0; int bottomCount = 0; - foreach (ChartAxisElement *axis , axes) { - + for (ChartAxisElement *axis : axes) { if (!axis->isVisible()) continue; @@ -108,7 +107,7 @@ QRectF CartesianChartLayout::calculateAxisGeometry(const QRectF &geometry, bottomCount++; break; default: - qWarning()<<"Axis is without alignment !"; + qWarning("Axis is without alignment !"); break; } } @@ -180,7 +179,7 @@ QRectF CartesianChartLayout::calculateAxisGeometry(const QRectF &geometry, if (m_presenter->isFixedGeometry()) chartRect = m_presenter->geometry(); - foreach (ChartAxisElement *axis , axes) { + for (ChartAxisElement *axis : axes) { if (!axis->isVisible()) continue; @@ -232,7 +231,7 @@ QRectF CartesianChartLayout::calculateAxisMinimum(const QRectF &minimum, const Q QSizeF bottom; QSizeF top; - foreach (ChartAxisElement *axis, axes) { + for (ChartAxisElement *axis : axes) { QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize); if (!axis->isVisible()) diff --git a/src/charts/qabstractseries.cpp b/src/charts/qabstractseries.cpp index c3d5cd7d..063db982 100644 --- a/src/charts/qabstractseries.cpp +++ b/src/charts/qabstractseries.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Charts module of the Qt Toolkit. @@ -376,12 +376,11 @@ void QAbstractSeries::hide() */ bool QAbstractSeries::attachAxis(QAbstractAxis* axis) { - if(d_ptr->m_chart) { + if (d_ptr->m_chart) return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis); - } else { - qWarning()<<"Series not in the chart. Please addSeries to chart first."; - return false; - } + + qWarning("Series not in the chart. Please addSeries to chart first."); + return false; } /*! @@ -393,13 +392,11 @@ bool QAbstractSeries::attachAxis(QAbstractAxis* axis) */ bool QAbstractSeries::detachAxis(QAbstractAxis* axis) { - if(d_ptr->m_chart) { + if (d_ptr->m_chart) return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis); - } - else { - qWarning()<<"Series not in the chart. Please addSeries to chart first."; - return false; - } + + qWarning("Series not in the chart. Please addSeries to chart first."); + return false; } /*! |