qt-models: Change Q_UNUSED to no parameter name

C++ permits use of parameters without name, which signals unused

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-05-21 17:53:42 +02:00 committed by Dirk Hohndel
parent 52031f0aba
commit b0e48a5e8f
18 changed files with 39 additions and 90 deletions

View file

@ -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();
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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<DiveComputerNode> values = dcWorkingMap.values();

View file

@ -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;
}

View file

@ -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;

View file

@ -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<QString> &fileUrls)
}
}
int DivePictureModel::rowCount(const QModelIndex &parent) const
int DivePictureModel::rowCount(const QModelIndex&) const
{
Q_UNUSED(parent);
return pictures.count();
}

View file

@ -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();
}

View file

@ -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;
}

View file

@ -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)

View file

@ -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();
}

View file

@ -77,9 +77,8 @@ QHash<int, QByteArray> 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();
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}