From b0e48a5e8f8b558ed7377d941ddfb96c02387a1f Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Mon, 21 May 2018 17:53:42 +0200 Subject: [PATCH] qt-models: Change Q_UNUSED to no parameter name C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen --- qt-models/cleanertablemodel.cpp | 3 +-- qt-models/cylindermodel.cpp | 3 +-- qt-models/divecomputerextradatamodel.cpp | 3 +-- qt-models/divecomputermodel.cpp | 6 ++---- qt-models/diveimportedmodel.cpp | 6 ++---- qt-models/divelocationmodel.cpp | 10 +++------- qt-models/divepicturemodel.cpp | 6 ++---- qt-models/diveplannermodel.cpp | 6 ++---- qt-models/diveplotdatamodel.cpp | 6 ++---- qt-models/filtermodels.cpp | 20 ++++---------------- qt-models/gpslistmodel.cpp | 3 +-- qt-models/maplocationmodel.cpp | 3 +-- qt-models/messagehandlermodel.cpp | 9 +++------ qt-models/models.cpp | 9 +++------ qt-models/tankinfomodel.cpp | 9 +++------ qt-models/treemodel.cpp | 15 ++++----------- qt-models/weightmodel.cpp | 3 +-- qt-models/weightsysteminfomodel.cpp | 9 +++------ 18 files changed, 39 insertions(+), 90 deletions(-) diff --git a/qt-models/cleanertablemodel.cpp b/qt-models/cleanertablemodel.cpp index 624ca4765..6a542ef27 100644 --- a/qt-models/cleanertablemodel.cpp +++ b/qt-models/cleanertablemodel.cpp @@ -6,9 +6,8 @@ CleanerTableModel::CleanerTableModel(QObject *parent) : QAbstractTableModel(pare { } -int CleanerTableModel::columnCount(const QModelIndex &parent) const +int CleanerTableModel::columnCount(const QModelIndex&) const { - Q_UNUSED(parent); return headers.count(); } diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index 3a7fb62e3..0892d58eb 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -427,9 +427,8 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in return true; } -int CylindersModel::rowCount(const QModelIndex &parent) const +int CylindersModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return rows; } diff --git a/qt-models/divecomputerextradatamodel.cpp b/qt-models/divecomputerextradatamodel.cpp index d2d43ce2e..815c6cd81 100644 --- a/qt-models/divecomputerextradatamodel.cpp +++ b/qt-models/divecomputerextradatamodel.cpp @@ -50,9 +50,8 @@ QVariant ExtraDataModel::data(const QModelIndex &index, int role) const return ret; } -int ExtraDataModel::rowCount(const QModelIndex &parent) const +int ExtraDataModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return rows; } diff --git a/qt-models/divecomputermodel.cpp b/qt-models/divecomputermodel.cpp index 51766bb0e..8488b5666 100644 --- a/qt-models/divecomputermodel.cpp +++ b/qt-models/divecomputermodel.cpp @@ -46,9 +46,8 @@ QVariant DiveComputerModel::data(const QModelIndex &index, int role) const return ret; } -int DiveComputerModel::rowCount(const QModelIndex &parent) const +int DiveComputerModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return numRows; } @@ -78,10 +77,9 @@ Qt::ItemFlags DiveComputerModel::flags(const QModelIndex &index) const return flags; } -bool DiveComputerModel::setData(const QModelIndex &index, const QVariant &value, int role) +bool DiveComputerModel::setData(const QModelIndex &index, const QVariant &value, int) { // We should test if the role == Qt::EditRole - Q_UNUSED(role); // WARN: This seems wrong - The values don't are ordered - we need a map from the Key to Index, or something. QList values = dcWorkingMap.values(); diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp index ea70ece39..8a0f4f7c7 100644 --- a/qt-models/diveimportedmodel.cpp +++ b/qt-models/diveimportedmodel.cpp @@ -11,15 +11,13 @@ DiveImportedModel::DiveImportedModel(QObject *o) : QAbstractTableModel(o), diveTable = &downloadTable; } -int DiveImportedModel::columnCount(const QModelIndex &model) const +int DiveImportedModel::columnCount(const QModelIndex&) const { - Q_UNUSED(model) return 3; } -int DiveImportedModel::rowCount(const QModelIndex &model) const +int DiveImportedModel::rowCount(const QModelIndex&) const { - Q_UNUSED(model) return lastIndex - firstIndex + 1; } diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index 3de2c1159..c706744a3 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -24,15 +24,13 @@ LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractTabl { } -int LocationInformationModel::columnCount(const QModelIndex &parent) const +int LocationInformationModel::columnCount(const QModelIndex&) const { - Q_UNUSED(parent); return COLUMNS; } -int LocationInformationModel::rowCount(const QModelIndex &parent) const +int LocationInformationModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return internalRowCount + 2; } @@ -154,10 +152,8 @@ bool LocationInformationModel::setData(const QModelIndex &index, const QVariant return true; } -bool LocationInformationModel::removeRows(int row, int count, const QModelIndex & parent) +bool LocationInformationModel::removeRows(int row, int, const QModelIndex&) { - Q_UNUSED(count); - Q_UNUSED(parent); if(row >= rowCount()) return false; diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp index 48fa652c9..8c66f5974 100644 --- a/qt-models/divepicturemodel.cpp +++ b/qt-models/divepicturemodel.cpp @@ -85,9 +85,8 @@ void DivePictureModel::updateDivePictures() endResetModel(); } -int DivePictureModel::columnCount(const QModelIndex &parent) const +int DivePictureModel::columnCount(const QModelIndex&) const { - Q_UNUSED(parent); return 2; } @@ -167,9 +166,8 @@ void DivePictureModel::removePictures(const QVector &fileUrls) } } -int DivePictureModel::rowCount(const QModelIndex &parent) const +int DivePictureModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return pictures.count(); } diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 7a21ef6ce..26a9ff175 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -231,9 +231,8 @@ bool DivePlannerPointsModel::recalcQ() return recalc; } -int DivePlannerPointsModel::columnCount(const QModelIndex &parent) const +int DivePlannerPointsModel::columnCount(const QModelIndex&) const { - Q_UNUSED(parent); return COLUMNS; // to disable CCSETPOINT subtract one } @@ -393,9 +392,8 @@ Qt::ItemFlags DivePlannerPointsModel::flags(const QModelIndex &index) const return QAbstractItemModel::flags(index); } -int DivePlannerPointsModel::rowCount(const QModelIndex &parent) const +int DivePlannerPointsModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return divepoints.count(); } diff --git a/qt-models/diveplotdatamodel.cpp b/qt-models/diveplotdatamodel.cpp index 203ac3bd2..35490a0a3 100644 --- a/qt-models/diveplotdatamodel.cpp +++ b/qt-models/diveplotdatamodel.cpp @@ -14,9 +14,8 @@ DivePlotDataModel::DivePlotDataModel(QObject *parent) : memset(&plot_deco_state, 0, sizeof(struct deco_state)); } -int DivePlotDataModel::columnCount(const QModelIndex &parent) const +int DivePlotDataModel::columnCount(const QModelIndex&) const { - Q_UNUSED(parent); return COLUMNS; } @@ -97,9 +96,8 @@ const plot_info &DivePlotDataModel::data() const return pInfo; } -int DivePlotDataModel::rowCount(const QModelIndex &parent) const +int DivePlotDataModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return pInfo.nr; } diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index ad6ce783d..34345f381 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -132,11 +132,8 @@ int SuitsFilterModel::countDives(const char *s) const return count_dives_with_suit(s); } -bool SuitsFilterModel::doFilter(dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const +bool SuitsFilterModel::doFilter(dive *d, QModelIndex&, QAbstractItemModel*) const { - Q_UNUSED(index0); - Q_UNUSED(sourceModel); - // rowCount() == 0 should never happen, because we have the "no suits" row // let's handle it gracefully anyway. if (!anyChecked || rowCount() == 0) @@ -199,11 +196,8 @@ void TagFilterModel::repopulate() updateList(list); } -bool TagFilterModel::doFilter(dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const +bool TagFilterModel::doFilter(dive *d, QModelIndex&, QAbstractItemModel*) const { - Q_UNUSED(index0); - Q_UNUSED(sourceModel); - // If there's nothing checked, this should show everything // rowCount() == 0 should never happen, because we have the "no tags" row // let's handle it gracefully anyway. @@ -240,11 +234,8 @@ int BuddyFilterModel::countDives(const char *s) const return count_dives_with_person(s); } -bool BuddyFilterModel::doFilter(dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const +bool BuddyFilterModel::doFilter(dive *d, QModelIndex&, QAbstractItemModel*) const { - Q_UNUSED(index0); - Q_UNUSED(sourceModel); - // If there's nothing checked, this should show everything // rowCount() == 0 should never happen, because we have the "no tags" row // let's handle it gracefully anyway. @@ -298,11 +289,8 @@ int LocationFilterModel::countDives(const char *s) const return count_dives_with_location(s); } -bool LocationFilterModel::doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const +bool LocationFilterModel::doFilter(struct dive *d, QModelIndex&, QAbstractItemModel*) const { - Q_UNUSED(index0); - Q_UNUSED(sourceModel); - // rowCount() == 0 should never happen, because we have the "no location" row // let's handle it gracefully anyway. if (!anyChecked || rowCount() == 0) diff --git a/qt-models/gpslistmodel.cpp b/qt-models/gpslistmodel.cpp index ee7867314..231ec04f7 100644 --- a/qt-models/gpslistmodel.cpp +++ b/qt-models/gpslistmodel.cpp @@ -27,9 +27,8 @@ void GpsListModel::clear() } } -int GpsListModel::rowCount(const QModelIndex &parent) const +int GpsListModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return m_gpsFixes.count(); } diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp index a4afe76e2..45759a57f 100644 --- a/qt-models/maplocationmodel.cpp +++ b/qt-models/maplocationmodel.cpp @@ -77,9 +77,8 @@ QHash MapLocationModel::roleNames() const return m_roles; } -int MapLocationModel::rowCount(const QModelIndex &parent) const +int MapLocationModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return m_mapLocations.size(); } diff --git a/qt-models/messagehandlermodel.cpp b/qt-models/messagehandlermodel.cpp index 78497f5bc..c2ba80d37 100644 --- a/qt-models/messagehandlermodel.cpp +++ b/qt-models/messagehandlermodel.cpp @@ -13,9 +13,8 @@ extern void writeToAppLogFile(QString logText); #endif -void logMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) +void logMessageHandler(QtMsgType type, const QMessageLogContext&, const QString &msg) { - Q_UNUSED(context) MessageHandlerModel::self()->addLog(type, msg); } @@ -25,16 +24,14 @@ MessageHandlerModel * MessageHandlerModel::self() return self; } -MessageHandlerModel::MessageHandlerModel(QObject *parent) +MessageHandlerModel::MessageHandlerModel(QObject*) { - Q_UNUSED(parent) // no more than one message handler. qInstallMessageHandler(logMessageHandler); } -int MessageHandlerModel::rowCount(const QModelIndex& parent) const +int MessageHandlerModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent) return m_data.size(); } diff --git a/qt-models/models.cpp b/qt-models/models.cpp index f15073111..a0f059165 100644 --- a/qt-models/models.cpp +++ b/qt-models/models.cpp @@ -24,9 +24,8 @@ const QPixmap &trashForbiddenIcon() return trash; } -Qt::ItemFlags GasSelectionModel::flags(const QModelIndex &index) const +Qt::ItemFlags GasSelectionModel::flags(const QModelIndex&) const { - Q_UNUSED(index); return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -69,9 +68,8 @@ QVariant GasSelectionModel::data(const QModelIndex &index, int role) const } // Dive Type Model for the divetype combo box -Qt::ItemFlags DiveTypeSelectionModel::flags(const QModelIndex &index) const +Qt::ItemFlags DiveTypeSelectionModel::flags(const QModelIndex&) const { - Q_UNUSED(index); return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -134,8 +132,7 @@ QVariant LanguageModel::data(const QModelIndex &index, int role) const return QVariant(); } -int LanguageModel::rowCount(const QModelIndex &parent) const +int LanguageModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return languages.count(); } diff --git a/qt-models/tankinfomodel.cpp b/qt-models/tankinfomodel.cpp index d2644a16b..ee970e638 100644 --- a/qt-models/tankinfomodel.cpp +++ b/qt-models/tankinfomodel.cpp @@ -15,19 +15,17 @@ const QString &TankInfoModel::biggerString() const return biggerEntry; } -bool TankInfoModel::insertRows(int row, int count, const QModelIndex &parent) +bool TankInfoModel::insertRows(int, int count, const QModelIndex &parent) { - Q_UNUSED(row); beginInsertRows(parent, rowCount(), rowCount()); rows += count; endInsertRows(); return true; } -bool TankInfoModel::setData(const QModelIndex &index, const QVariant &value, int role) +bool TankInfoModel::setData(const QModelIndex &index, const QVariant &value, int) { //WARN Seems wrong, we need to check for role == Qt::EditRole - Q_UNUSED(role); if (index.row() < 0 || index.row() > MAX_TANK_INFO - 1) return false; @@ -84,9 +82,8 @@ QVariant TankInfoModel::data(const QModelIndex &index, int role) const return ret; } -int TankInfoModel::rowCount(const QModelIndex &parent) const +int TankInfoModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return rows + 1; } diff --git a/qt-models/treemodel.cpp b/qt-models/treemodel.cpp index 4439ec54f..5ddd2d3a2 100644 --- a/qt-models/treemodel.cpp +++ b/qt-models/treemodel.cpp @@ -12,9 +12,8 @@ TreeItem::~TreeItem() qDeleteAll(children); } -Qt::ItemFlags TreeItem::flags(const QModelIndex &index) const +Qt::ItemFlags TreeItem::flags(const QModelIndex&) const { - Q_UNUSED(index); return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -25,10 +24,8 @@ int TreeItem::row() const return 0; } -QVariant TreeItem::data(int column, int role) const +QVariant TreeItem::data(int, int) const { - Q_UNUSED(column); - Q_UNUSED(role); return QVariant(); } @@ -57,11 +54,8 @@ QVariant TreeModel::data(const QModelIndex &index, int role) const return val; } -bool TreeItem::setData(const QModelIndex &index, const QVariant &value, int role) +bool TreeItem::setData(const QModelIndex&, const QVariant&, int) { - Q_UNUSED(index); - Q_UNUSED(value); - Q_UNUSED(role); return false; } @@ -104,8 +98,7 @@ int TreeModel::rowCount(const QModelIndex &parent) const return amount; } -int TreeModel::columnCount(const QModelIndex &parent) const +int TreeModel::columnCount(const QModelIndex&) const { - Q_UNUSED(parent); return columns; } diff --git a/qt-models/weightmodel.cpp b/qt-models/weightmodel.cpp index 20eb644f3..7a2f721dd 100644 --- a/qt-models/weightmodel.cpp +++ b/qt-models/weightmodel.cpp @@ -142,9 +142,8 @@ Qt::ItemFlags WeightModel::flags(const QModelIndex &index) const return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; } -int WeightModel::rowCount(const QModelIndex &parent) const +int WeightModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return rows; } diff --git a/qt-models/weightsysteminfomodel.cpp b/qt-models/weightsysteminfomodel.cpp index 08fecec5d..14d268bcb 100644 --- a/qt-models/weightsysteminfomodel.cpp +++ b/qt-models/weightsysteminfomodel.cpp @@ -10,19 +10,17 @@ WSInfoModel *WSInfoModel::instance() return &self; } -bool WSInfoModel::insertRows(int row, int count, const QModelIndex &parent) +bool WSInfoModel::insertRows(int, int count, const QModelIndex &parent) { - Q_UNUSED(row); beginInsertRows(parent, rowCount(), rowCount()); rows += count; endInsertRows(); return true; } -bool WSInfoModel::setData(const QModelIndex &index, const QVariant &value, int role) +bool WSInfoModel::setData(const QModelIndex &index, const QVariant &value, int) { //WARN: check for Qt::EditRole - Q_UNUSED(role); struct ws_info_t *info = &ws_info[index.row()]; switch (index.column()) { case DESCRIPTION: @@ -68,9 +66,8 @@ QVariant WSInfoModel::data(const QModelIndex &index, int role) const return ret; } -int WSInfoModel::rowCount(const QModelIndex &parent) const +int WSInfoModel::rowCount(const QModelIndex&) const { - Q_UNUSED(parent); return rows + 1; }