From 8821536419a281a0e3b395253de8d513ddf72e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 29 Mar 2018 00:29:08 +0200 Subject: [PATCH] Fixed most clazy warnings --- src/GUI/app.cpp | 6 +++--- src/GUI/graphview.cpp | 4 ++-- src/GUI/infoitem.cpp | 6 +++--- src/common/coordinates.h | 1 - src/map/ellipsoid.cpp | 4 ++-- src/map/tar.cpp | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/GUI/app.cpp b/src/GUI/app.cpp index 7f95a2fc..23c91f74 100644 --- a/src/GUI/app.cpp +++ b/src/GUI/app.cpp @@ -24,12 +24,12 @@ App::App(int &argc, char **argv) : QApplication(argc, argv), installTranslator(gpxsee); QTranslator *qt = new QTranslator(this); -#if defined(Q_OS_WINDOWS) || defined(Q_OS_MAC) +#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) qt->load(QLocale::system(), "qt", "_", TRANSLATIONS_DIR); -#else // Q_OS_WINDOWS || Q_OS_MAC +#else // Q_OS_WIN32 || Q_OS_MAC qt->load(QLocale::system(), "qt", "_", QLibraryInfo::location( QLibraryInfo::TranslationsPath)); -#endif // Q_OS_WINDOWS || Q_OS_MAC +#endif // Q_OS_WIN32 || Q_OS_MAC installTranslator(qt); #ifdef Q_OS_MAC diff --git a/src/GUI/graphview.cpp b/src/GUI/graphview.cpp index d2ea4ea9..8fd5e73c 100644 --- a/src/GUI/graphview.cpp +++ b/src/GUI/graphview.cpp @@ -81,12 +81,12 @@ GraphView::~GraphView() void GraphView::createXLabel() { - _xAxis->setLabel(QString("%1 [%2]").arg(_xLabel).arg(_xUnits)); + _xAxis->setLabel(QString("%1 [%2]").arg(_xLabel, _xUnits)); } void GraphView::createYLabel() { - _yAxis->setLabel(QString("%1 [%2]").arg(_yLabel).arg(_yUnits)); + _yAxis->setLabel(QString("%1 [%2]").arg(_yLabel, _yUnits)); } void GraphView::setYLabel(const QString &label) diff --git a/src/GUI/infoitem.cpp b/src/GUI/infoitem.cpp index cd10df3a..45a3410c 100644 --- a/src/GUI/infoitem.cpp +++ b/src/GUI/infoitem.cpp @@ -23,7 +23,7 @@ void InfoItem::updateBoundingRect() for (i = _list.constBegin(); i != _list.constEnd(); i++) { width += fm.width(i->key + ": "); - width += fm.width(i->value) + ((i == _list.end() - 1) ? 0 : PADDING); + width += fm.width(i->value) + ((i == _list.constEnd() - 1) ? 0 : PADDING); } _boundingRect = QRectF(0, 0, width, _list.isEmpty() ? 0 : fm.height()); @@ -49,8 +49,8 @@ void InfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, painter->drawText(width, fm.height() - fm.descent(), i->key + ": "); width += fm.width(i->key + ": "); painter->drawText(width, fm.height() - fm.descent(), i->value); - width += fm.width(i->value) + ((i == _list.end() - 1) ? 0 : PADDING); - if (i != _list.end() - 1) { + width += fm.width(i->value) + ((i == _list.constEnd() - 1) ? 0 : PADDING); + if (i != _list.constEnd() - 1) { painter->save(); painter->setPen(Qt::gray); painter->drawLine(width - PADDING/2, fm.descent(), diff --git a/src/common/coordinates.h b/src/common/coordinates.h index 516d228d..fed0390f 100644 --- a/src/common/coordinates.h +++ b/src/common/coordinates.h @@ -15,7 +15,6 @@ class Coordinates { public: Coordinates() {_lon = NAN; _lat = NAN;} - Coordinates(const Coordinates &c) {_lon = c._lon; _lat = c._lat;} Coordinates(qreal lon, qreal lat) {_lon = lon; _lat = lat;} qreal &rlon() {return _lon;} diff --git a/src/map/ellipsoid.cpp b/src/map/ellipsoid.cpp index 37a188d1..41ee0da7 100644 --- a/src/map/ellipsoid.cpp +++ b/src/map/ellipsoid.cpp @@ -14,9 +14,9 @@ QMap Ellipsoid::WGS84() const Ellipsoid *Ellipsoid::ellipsoid(int id) { - QMap::const_iterator it = _ellipsoids.find(id); + QMap::const_iterator it(_ellipsoids.find(id)); - if (it == _ellipsoids.end()) + if (it == _ellipsoids.constEnd()) return 0; else return &(it.value()); diff --git a/src/map/tar.cpp b/src/map/tar.cpp index 6cc240d2..5f45d957 100644 --- a/src/map/tar.cpp +++ b/src/map/tar.cpp @@ -116,8 +116,8 @@ QByteArray Tar::file(const QString &name) struct Header *hdr = (struct Header*)&buffer; quint64 size; - QMap::const_iterator it = _index.find(name); - if (it == _index.end()) + QMap::const_iterator it(_index.find(name)); + if (it == _index.constEnd()) return QByteArray(); Q_ASSERT(_file.isOpen());