summaryrefslogtreecommitdiffstats
path: root/smtreemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'smtreemodel.cpp')
-rw-r--r--smtreemodel.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/smtreemodel.cpp b/smtreemodel.cpp
index 1386179..98490fc 100644
--- a/smtreemodel.cpp
+++ b/smtreemodel.cpp
@@ -13,7 +13,7 @@
#include "smtreeitem.h"
#include "smglobals.h"
-SmTreeModel::SmTreeModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent), mRootItem(0){
+SmTreeModel::SmTreeModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent), mRootItem(nullptr){
mHeaders = headers;
for(int i = 0; i < mHeaders.size(); ++i){
mHeaderData.insert(mHeaders.at(i), i);
@@ -72,7 +72,7 @@ QModelIndex SmTreeModel::parent(const QModelIndex &child) const{
Qt::ItemFlags SmTreeModel::flags(const QModelIndex &index) const{
if(!index.isValid()){
- return 0;
+ return Qt::NoItemFlags;
}
return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
@@ -127,7 +127,7 @@ bool SmTreeModel::setData(const QModelIndex &index, const QVariant &value, int r
}
QModelIndex SmTreeModel::find(const QVariant &value, int column, const QModelIndex &pIdx) const{
- SmTreeItem *parentItem = 0;
+ SmTreeItem *parentItem = nullptr;
if(!pIdx.isValid()){
parentItem = root();
}else{
@@ -248,10 +248,10 @@ void SmTreeModel::reparent(const QModelIndex &idx, const QModelIndex &newParent,
bool SmTreeModel::insertRows(int row, int count, const QModelIndex &pIdx){
SmTreeItem *parentItem = itemAt(pIdx);
- bool retval;
+ bool retval = false;
if(row > parentItem->childCount()){
- return false;
+ return retval;
}
beginInsertRows(pIdx, row, row + count - 1);
@@ -265,10 +265,10 @@ bool SmTreeModel::insertRows(int row, int count, const QModelIndex &pIdx){
bool SmTreeModel::removeRows(int row, int count, const QModelIndex &pIdx){
SmTreeItem *parentItem = itemAt(pIdx);
- bool retval;
+ bool retval = false;
if(row > parentItem->childCount()){
- return false;
+ return retval;
}
beginRemoveRows(pIdx, row, row + count - 1);