Add missing includes
[quassel.git] / src / client / networkmodel.cpp
index 752eb1e..b398613 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2018 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  *
@@ -20,6 +20,7 @@
 
 #include "networkmodel.h"
 
+#include <algorithm>
 #include <utility>
 
 #include <QAbstractItemView>
@@ -405,7 +406,6 @@ bool BufferItem::setData(int column, const QVariant& value, int role)
     default:
         return PropertyMapItem::setData(column, value, role);
     }
-    return true;
 }
 
 void BufferItem::setBufferName(const QString& name)
@@ -1521,7 +1521,7 @@ void NetworkModel::checkForRemovedBuffers(const QModelIndex& parent, int start,
         return;
 
     for (int row = start; row <= end; row++) {
-        _bufferItemCache.remove(parent.child(row, 0).data(BufferIdRole).value<BufferId>());
+        _bufferItemCache.remove(index(row, 0, parent).data(BufferIdRole).value<BufferId>());
     }
 }
 
@@ -1531,7 +1531,7 @@ void NetworkModel::checkForNewBuffers(const QModelIndex& parent, int start, int
         return;
 
     for (int row = start; row <= end; row++) {
-        QModelIndex child = parent.child(row, 0);
+        QModelIndex child = parent.model()->index(row, 0, parent);
         _bufferItemCache[child.data(BufferIdRole).value<BufferId>()] = static_cast<BufferItem*>(child.internalPointer());
     }
 }
@@ -1606,7 +1606,7 @@ void NetworkModel::sortBufferIds(QList<BufferId>& bufferIds) const
             bufferItems << _bufferItemCache[bufferId];
     }
 
-    qSort(bufferItems.begin(), bufferItems.end(), bufferItemLessThan);
+    std::sort(bufferItems.begin(), bufferItems.end(), bufferItemLessThan);
 
     bufferIds.clear();
     foreach (BufferItem* bufferItem, bufferItems) {