X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Firclistmodel.cpp;h=8091ca428eb3e0461c5bea1b1a1407c4fcba0666;hp=349ff72731a5f0ebab8f03f604d83407db1ecf97;hb=52209badc8e769e50aa3019b63689dda0e79e9d0;hpb=4a5065255e652dd0c301bac0db41b7afb777ef49 diff --git a/src/client/irclistmodel.cpp b/src/client/irclistmodel.cpp index 349ff727..8091ca42 100644 --- a/src/client/irclistmodel.cpp +++ b/src/client/irclistmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2019 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -22,13 +22,11 @@ #include -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(); @@ -47,8 +45,7 @@ QVariant IrcListModel::data(const QModelIndex &index, int role) const } } - -Qt::ItemFlags IrcListModel::flags(const QModelIndex &index) const +Qt::ItemFlags IrcListModel::flags(const QModelIndex& index) const { if (!index.isValid()) { return Qt::ItemIsDropEnabled; @@ -58,13 +55,10 @@ Qt::ItemFlags IrcListModel::flags(const QModelIndex &index) const } } - 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]; @@ -72,18 +66,16 @@ QVariant IrcListModel::headerData(int section, Qt::Orientation orientation, int 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 &channelList) +void IrcListModel::setChannelList(const QList& channelList) { if (rowCount() > 0) { beginRemoveRows(QModelIndex(), 0, _channelList.count() - 1);