From 567881f1304e1bc5020c84ee6eec7352ae833f53 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 6 Jun 2017 17:51:06 +0200 Subject: [PATCH] Fix warnings when building with GCC 7 --- src/lib/bookmarks/bookmarksmodel.cpp | 5 +++-- src/lib/downloads/downloadoptionsdialog.cpp | 1 + src/lib/history/historymodel.cpp | 5 +++-- tests/modeltest/modeltest.cpp | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/bookmarks/bookmarksmodel.cpp b/src/lib/bookmarks/bookmarksmodel.cpp index 953145e73..1c4604d7e 100644 --- a/src/lib/bookmarks/bookmarksmodel.cpp +++ b/src/lib/bookmarks/bookmarksmodel.cpp @@ -1,6 +1,6 @@ /* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2014 David Rosca +* QupZilla - Qt web browser +* Copyright (C) 2014-2017 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -120,6 +120,7 @@ QVariant BookmarksModel::data(const QModelIndex &index, int role) const if (index.column() == 0 && itm->isUrl()) { return QString("%1\n%2").arg(itm->title(), QString::fromUtf8(itm->url().toEncoded())); } + // fallthrough case Qt::DisplayRole: switch (index.column()) { case 0: diff --git a/src/lib/downloads/downloadoptionsdialog.cpp b/src/lib/downloads/downloadoptionsdialog.cpp index 76e6990ff..69d327358 100644 --- a/src/lib/downloads/downloadoptionsdialog.cpp +++ b/src/lib/downloads/downloadoptionsdialog.cpp @@ -72,6 +72,7 @@ void DownloadOptionsDialog::setLastDownloadOption(const DownloadManager::Downloa ui->radioExternal->setChecked(true); break; } + // fallthrough case DownloadManager::OpenFile: ui->radioOpen->setChecked(true); diff --git a/src/lib/history/historymodel.cpp b/src/lib/history/historymodel.cpp index d3b329958..5739bd79e 100644 --- a/src/lib/history/historymodel.cpp +++ b/src/lib/history/historymodel.cpp @@ -1,6 +1,6 @@ /* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* QupZilla - Qt web browser +* Copyright (C) 2010-2017 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,6 +115,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const if (index.column() == 0) { return QString("%1\n%2").arg(entry.title, entry.urlString); } + // fallthrough case Qt::DisplayRole: case Qt::EditRole: switch (index.column()) { diff --git a/tests/modeltest/modeltest.cpp b/tests/modeltest/modeltest.cpp index ac4dd8983..1c67acd6b 100644 --- a/tests/modeltest/modeltest.cpp +++ b/tests/modeltest/modeltest.cpp @@ -455,7 +455,7 @@ void ModelTest::data() QVariant textAlignmentVariant = model->data(model->index(0, 0), Qt::TextAlignmentRole); if (textAlignmentVariant.isValid()) { int alignment = textAlignmentVariant.toInt(); - Q_ASSERT(alignment == (alignment & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask))); + Q_ASSERT(alignment == int(alignment & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask))); } // General Purpose roles that should return a QColor