diff options
Diffstat (limited to 'smtreemodel.cpp')
-rw-r--r-- | smtreemodel.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/smtreemodel.cpp b/smtreemodel.cpp index 743e8be..50a55d0 100644 --- a/smtreemodel.cpp +++ b/smtreemodel.cpp @@ -139,7 +139,8 @@ QModelIndex SmTreeModel::find(const QVariant &value, int column, const QModelInd QModelIndex SmTreeModel::findRecursive(const QVariant &value, int column, const QModelIndex &parent) const{ SmTreeItem *parentItem = 0; if(!parent.isValid()){ - return QModelIndex(); + //return QModelIndex(); + parentItem = mRootItem; }else{ parentItem = static_cast<SmTreeItem*>(parent.internalPointer()); } @@ -153,6 +154,9 @@ QModelIndex SmTreeModel::findRecursive(const QVariant &value, int column, const } } QModelIndex next = index(parent.row() + 1, column, parent.parent()); + if(!next.isValid()){ + return QModelIndex(); + } return findRecursive(value, column, next); } |