X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Ftreemodel.cpp;h=e456f6fda126fa3081e589b3e7910d41d2625741;hp=892ad5c8fcd0b84109ff7cf8e84036f897c8eb00;hb=3a3e844f9fcfd12235a0086af75ecd503b621ef4;hpb=91e27ef1628b352e1f905b5811cb036442e68242 diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index 892ad5c8..e456f6fd 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "quassel.h" @@ -41,7 +42,7 @@ private: AbstractTreeItem::AbstractTreeItem(AbstractTreeItem *parent) : QObject(parent), _flags(Qt::ItemIsSelectable | Qt::ItemIsEnabled), - _treeItemFlags(0) + _treeItemFlags(nullptr) { } @@ -103,7 +104,7 @@ void AbstractTreeItem::removeAllChilds() childIter = _childItems.begin(); while (childIter != _childItems.end()) { child = *childIter; - child->setTreeItemFlags(0); // disable self deletion, as this would only fuck up consitency and the child gets deleted anyways + child->setTreeItemFlags(nullptr); // disable self deletion, as this would only fuck up consitency and the child gets deleted anyways child->removeAllChilds(); ++childIter; } @@ -182,7 +183,7 @@ bool AbstractTreeItem::reParent(AbstractTreeItem *newParent) AbstractTreeItem *AbstractTreeItem::child(int row) const { if (childCount() <= row) - return 0; + return nullptr; else return _childItems[row]; } @@ -230,9 +231,9 @@ void AbstractTreeItem::dumpChildList() /***************************************** * SimpleTreeItem *****************************************/ -SimpleTreeItem::SimpleTreeItem(const QList &data, AbstractTreeItem *parent) +SimpleTreeItem::SimpleTreeItem(QList data, AbstractTreeItem *parent) : AbstractTreeItem(parent), - _itemData(data) + _itemData(std::move(data)) { } @@ -323,7 +324,7 @@ TreeModel::TreeModel(const QList &data, QObject *parent) _childStatus(QModelIndex(), 0, 0, 0), _aboutToRemoveOrInsert(false) { - rootItem = new SimpleTreeItem(data, 0); + rootItem = new SimpleTreeItem(data, nullptr); connectItem(rootItem); if (Quassel::isOptionSet("debugmodel")) { @@ -376,7 +377,7 @@ QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) con QModelIndex TreeModel::indexByItem(AbstractTreeItem *item) const { - if (item == 0) { + if (item == nullptr) { qWarning() << "TreeModel::indexByItem(AbstractTreeItem *item) received NULL-Pointer"; return QModelIndex(); } @@ -564,7 +565,7 @@ void TreeModel::beginRemoveChilds(int firstRow, int lastRow) } for (int i = firstRow; i <= lastRow; i++) { - disconnect(parentItem->child(i), 0, this, 0); + disconnect(parentItem->child(i), nullptr, this, nullptr); } // consitency checks