diff options
Diffstat (limited to 'smtreemodel.cpp')
-rw-r--r-- | smtreemodel.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/smtreemodel.cpp b/smtreemodel.cpp index c762802..292ed20 100644 --- a/smtreemodel.cpp +++ b/smtreemodel.cpp @@ -118,6 +118,14 @@ bool SmTreeModel::setRoot(SmTreeItem *rootItem){ return false; } +SmTreeItem *SmTreeModel::parentItem(const QModelIndex &child) const{ + QModelIndex parent = child.parent(); + if(parent == QModelIndex()){ + return mRootItem; + } + return static_cast<SmTreeItem*>(child.parent().internalPointer()); +} + bool SmTreeModel::insertRows(int row, int count, const QModelIndex &parent){ SmTreeItem *parentItem = itemAt(parent); bool retval; |