diff options
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveStatistics.cpp | 6 | ||||
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 9 |
2 files changed, 7 insertions, 8 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp index 1b3fe9522..dacb01721 100644 --- a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp @@ -21,9 +21,9 @@ TabDiveStatistics::TabDiveStatistics(QWidget *parent) : TabBase(parent), ui(new ui->timeLimits->overrideMinToolTipText(tr("Shortest dive")); ui->timeLimits->overrideAvgToolTipText(tr("Average length of all selected dives")); - Q_FOREACH (QObject *obj, children()) { - if (QLabel *label = qobject_cast<QLabel *>(obj)) - label->setAlignment(Qt::AlignHCenter); + const auto l = findChildren<QLabel *>(QString(), Qt::FindDirectChildrenOnly); + for (QLabel *label: l) { + label->setAlignment(Qt::AlignHCenter); } } diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 98b8904c2..c934cdb16 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -1271,14 +1271,13 @@ void MainTab::saveTaggedStrings(const QVector<dive *> &selectedDives) int MainTab::diffTaggedStrings(QString currentString, QString displayedString, QStringList &addedList, QStringList &removedList) { - QStringList displayedList, currentList; - currentList = currentString.split(',', QString::SkipEmptyParts); - displayedList = displayedString.split(',', QString::SkipEmptyParts); - Q_FOREACH ( const QString tag, currentList) { + const QStringList currentList = currentString.split(',', QString::SkipEmptyParts); + const QStringList displayedList = displayedString.split(',', QString::SkipEmptyParts); + for (const QString &tag: currentList) { if (!displayedList.contains(tag, Qt::CaseInsensitive)) removedList << tag.trimmed(); } - Q_FOREACH (const QString tag, displayedList) { + for (const QString &tag: displayedList) { if (!currentList.contains(tag, Qt::CaseInsensitive)) addedList << tag.trimmed(); } |