/***************************************************************************
- * Copyright (C) 2005-2016 by the Quassel Project *
+ * Copyright (C) 2005-2020 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include <QStringList>
-IrcListModel::IrcListModel(QObject *parent)
+IrcListModel::IrcListModel(QObject* parent)
: QAbstractItemModel(parent)
-{
-}
+{}
-
-QVariant IrcListModel::data(const QModelIndex &index, int role) const
+QVariant IrcListModel::data(const QModelIndex& index, int role) const
{
if (!index.isValid() || index.row() >= rowCount() || index.column() >= columnCount() || role != Qt::DisplayRole)
return QVariant();
}
}
-
-Qt::ItemFlags IrcListModel::flags(const QModelIndex &index) const
+Qt::ItemFlags IrcListModel::flags(const QModelIndex& index) const
{
if (!index.isValid()) {
return Qt::ItemIsDropEnabled;
}
}
-
QVariant IrcListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
QStringList header;
- header << tr("Channel")
- << tr("Users")
- << tr("Topic");
+ header << tr("Channel") << tr("Users") << tr("Topic");
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return header[section];
return QVariant();
}
-
-QModelIndex IrcListModel::index(int row, int column, const QModelIndex &parent) const
+QModelIndex IrcListModel::index(int row, int column, const QModelIndex& parent) const
{
Q_UNUSED(parent);
if (row >= rowCount() || column >= columnCount())
- return QModelIndex();
+ return {};
return createIndex(row, column);
}
-
-void IrcListModel::setChannelList(const QList<IrcListHelper::ChannelDescription> &channelList)
+void IrcListModel::setChannelList(const QList<IrcListHelper::ChannelDescription>& channelList)
{
if (rowCount() > 0) {
beginRemoveRows(QModelIndex(), 0, _channelList.count() - 1);