Replace deprecated QModelIndex::child with QAbstractItemModel::index
[quassel.git] / src / uisupport / nickviewfilter.cpp
index edf776b..5058de7 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-09 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  *
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
 #include "nickviewfilter.h"
 
 #include "buffersettings.h"
 #include "graphicalui.h"
-#include "iconloader.h"
 #include "networkmodel.h"
 #include "uistyle.h"
 
 /******************************************************************************************
  * NickViewFilter
  ******************************************************************************************/
-NickViewFilter::NickViewFilter(const BufferId &bufferId, NetworkModel *parent)
-    : QSortFilterProxyModel(parent),
-    _bufferId(bufferId)
+NickViewFilter::NickViewFilter(const BufferId& bufferId, NetworkModel* parent)
+    : QSortFilterProxyModel(parent)
+    _bufferId(bufferId)
 {
     setSourceModel(parent);
     setDynamicSortFilter(true);
@@ -39,19 +38,17 @@ NickViewFilter::NickViewFilter(const BufferId &bufferId, NetworkModel *parent)
     setSortRole(TreeModel::SortRole);
 }
 
-
-bool NickViewFilter::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+bool NickViewFilter::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
 {
     // root node, networkindexes, the bufferindex of the buffer this filter is active for and it's children are accepted
     if (!source_parent.isValid())
         return true;
 
-    QModelIndex source_child = source_parent.child(source_row, 0);
+    QModelIndex source_child = source_parent.model()->index(source_row, 0, source_parent);
     return (sourceModel()->data(source_child, NetworkModel::BufferIdRole).value<BufferId>() == _bufferId);
 }
 
-
-QVariant NickViewFilter::data(const QModelIndex &index, int role) const
+QVariant NickViewFilter::data(const QModelIndex& index, int role) const
 {
     switch (role) {
     case Qt::FontRole: