projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
modernize: Pass arguments by value and move in constructors
[quassel.git]
/
src
/
client
/
treemodel.cpp
diff --git
a/src/client/treemodel.cpp
b/src/client/treemodel.cpp
index
a8cd86b
..
e456f6f
100644
(file)
--- a/
src/client/treemodel.cpp
+++ b/
src/client/treemodel.cpp
@@
-22,6
+22,7
@@
#include <QCoreApplication>
#include <QDebug>
#include <QCoreApplication>
#include <QDebug>
+#include <utility>
#include "quassel.h"
#include "quassel.h"
@@
-41,7
+42,7
@@
private:
AbstractTreeItem::AbstractTreeItem(AbstractTreeItem *parent)
: QObject(parent),
_flags(Qt::ItemIsSelectable | Qt::ItemIsEnabled),
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;
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;
}
child->removeAllChilds();
++childIter;
}
@@
-182,7
+183,7
@@
bool AbstractTreeItem::reParent(AbstractTreeItem *newParent)
AbstractTreeItem *AbstractTreeItem::child(int row) const
{
if (childCount() <= row)
AbstractTreeItem *AbstractTreeItem::child(int row) const
{
if (childCount() <= row)
- return
0
;
+ return
nullptr
;
else
return _childItems[row];
}
else
return _childItems[row];
}
@@
-230,9
+231,9
@@
void AbstractTreeItem::dumpChildList()
/*****************************************
* SimpleTreeItem
*****************************************/
/*****************************************
* SimpleTreeItem
*****************************************/
-SimpleTreeItem::SimpleTreeItem(
const QList<QVariant> &
data, AbstractTreeItem *parent)
+SimpleTreeItem::SimpleTreeItem(
QList<QVariant>
data, AbstractTreeItem *parent)
: AbstractTreeItem(parent),
: AbstractTreeItem(parent),
- _itemData(
data
)
+ _itemData(
std::move(data)
)
{
}
{
}
@@
-323,7
+324,7
@@
TreeModel::TreeModel(const QList<QVariant> &data, QObject *parent)
_childStatus(QModelIndex(), 0, 0, 0),
_aboutToRemoveOrInsert(false)
{
_childStatus(QModelIndex(), 0, 0, 0),
_aboutToRemoveOrInsert(false)
{
- rootItem = new SimpleTreeItem(data,
0
);
+ rootItem = new SimpleTreeItem(data,
nullptr
);
connectItem(rootItem);
if (Quassel::isOptionSet("debugmodel")) {
connectItem(rootItem);
if (Quassel::isOptionSet("debugmodel")) {
@@
-347,6
+348,12
@@
TreeModel::~TreeModel()
}
}
+AbstractTreeItem *TreeModel::root() const
+{
+ return rootItem;
+}
+
+
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const
{
if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent))
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const
{
if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent))
@@
-370,7
+377,7
@@
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) con
QModelIndex TreeModel::indexByItem(AbstractTreeItem *item) const
{
QModelIndex TreeModel::indexByItem(AbstractTreeItem *item) const
{
- if (item ==
0
) {
+ if (item ==
nullptr
) {
qWarning() << "TreeModel::indexByItem(AbstractTreeItem *item) received NULL-Pointer";
return QModelIndex();
}
qWarning() << "TreeModel::indexByItem(AbstractTreeItem *item) received NULL-Pointer";
return QModelIndex();
}
@@
-558,7
+565,7
@@
void TreeModel::beginRemoveChilds(int firstRow, int lastRow)
}
for (int i = firstRow; i <= lastRow; i++) {
}
for (int i = firstRow; i <= lastRow; i++) {
- disconnect(parentItem->child(i),
0, this, 0
);
+ disconnect(parentItem->child(i),
nullptr, this, nullptr
);
}
// consitency checks
}
// consitency checks