aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/locationinformation.cpp4
-rw-r--r--desktop-widgets/printer.cpp4
-rw-r--r--desktop-widgets/tab-widgets/TabDiveStatistics.cpp6
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp9
-rw-r--r--desktop-widgets/tagwidget.cpp3
-rw-r--r--desktop-widgets/templatelayout.cpp16
6 files changed, 22 insertions, 20 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index af3fa513f..24f45058a 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -75,11 +75,11 @@ void LocationInformationWidget::mergeSelectedDiveSites()
QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok)
return;
- QModelIndexList selection = ui.diveSiteListView->selectionModel()->selectedIndexes();
+ const QModelIndexList selection = ui.diveSiteListView->selectionModel()->selectedIndexes();
// std::vector guarantees contiguous storage and can therefore be passed to C-code
std::vector<struct dive_site *> selected_dive_sites;
selected_dive_sites.reserve(selection.count());
- Q_FOREACH (const QModelIndex &idx, selection) {
+ for (const QModelIndex &idx: selection) {
dive_site *ds = idx.data(LocationInformationModel::DIVESITE_ROLE).value<dive_site *>();
if (ds)
selected_dive_sites.push_back(ds);
diff --git a/desktop-widgets/printer.cpp b/desktop-widgets/printer.cpp
index fa0cd1010..4b7123adb 100644
--- a/desktop-widgets/printer.cpp
+++ b/desktop-widgets/printer.cpp
@@ -77,8 +77,8 @@ void Printer::flowRender()
// get all references to dontbreak divs
int start = 0, end = 0;
int fullPageResolution = webView->page()->mainFrame()->contentsSize().height();
- QWebElementCollection dontbreak = webView->page()->mainFrame()->findAllElements(".dontbreak");
- foreach (QWebElement dontbreakElement, dontbreak) {
+ const QWebElementCollection dontbreak = webView->page()->mainFrame()->findAllElements(".dontbreak");
+ for (QWebElement dontbreakElement: dontbreak) {
if ((dontbreakElement.geometry().y() + dontbreakElement.geometry().height()) - start < pageSize.height()) {
// One more element can be placed
end = dontbreakElement.geometry().y() + dontbreakElement.geometry().height();
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();
}
diff --git a/desktop-widgets/tagwidget.cpp b/desktop-widgets/tagwidget.cpp
index c8d017aad..6673b23ac 100644
--- a/desktop-widgets/tagwidget.cpp
+++ b/desktop-widgets/tagwidget.cpp
@@ -70,7 +70,8 @@ void TagWidget::highlight()
{
removeAllBlocks();
int lastPos = 0;
- Q_FOREACH (const QString& s, text().split(QChar(','), QString::SkipEmptyParts)) {
+ const auto l = text().split(QChar(','), QString::SkipEmptyParts);
+ for (const QString &s: l) {
QString trimmed = s.trimmed();
if (trimmed.isEmpty())
continue;
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp
index f451250d6..b28c78741 100644
--- a/desktop-widgets/templatelayout.cpp
+++ b/desktop-widgets/templatelayout.cpp
@@ -19,20 +19,20 @@ int getTotalWork(print_options *printOptions)
void find_all_templates()
{
- const QString ext(".html");
+ const QLatin1String ext(".html");
grantlee_templates.clear();
grantlee_statistics_templates.clear();
QDir dir(getPrintingTemplatePathUser());
- QStringList list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
- foreach (const QString& filename, list) {
+ const QStringList list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
+ for (const QString &filename: list) {
if (filename.at(filename.size() - 1) != '~' && filename.endsWith(ext))
grantlee_templates.append(filename);
}
// find statistics templates
dir.setPath(getPrintingTemplatePathUser() + QDir::separator() + "statistics");
- list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
- foreach (const QString& filename, list) {
+ const QStringList stat = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
+ for (const QString &filename: stat) {
if (filename.at(filename.size() - 1) != '~' && filename.endsWith(ext))
grantlee_statistics_templates.append(filename);
}
@@ -66,12 +66,14 @@ void copy_bundled_templates(QString src, QString dst, QStringList *templateBacku
QDir dir(src);
if (!dir.exists())
return;
- foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
+ const auto dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
+ for (const QString &d: dirs) {
QString dst_path = dst + QDir::separator() + d;
dir.mkpath(dst_path);
copy_bundled_templates(src + QDir::separator() + d, dst_path, templateBackupList);
}
- foreach (QString f, dir.entryList(QDir::Files)) {
+ const auto files = dir.entryList(QDir::Files);
+ for (const QString &f: files) {
QFile fileSrc(src + QDir::separator() + f);
QFile fileDest(dst + QDir::separator() + f);
if (fileDest.exists()) {