summaryrefslogtreecommitdiffstats
path: root/sigmodr/tree/TreeModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/tree/TreeModel.cpp')
-rw-r--r--sigmodr/tree/TreeModel.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/sigmodr/tree/TreeModel.cpp b/sigmodr/tree/TreeModel.cpp
index 15f8dae2..82dd7ec8 100644
--- a/sigmodr/tree/TreeModel.cpp
+++ b/sigmodr/tree/TreeModel.cpp
@@ -50,7 +50,11 @@ QVariant TreeModel::data(const QModelIndex& index, const int role) const
QModelIndex TreeModel::index(const int row, const int column, const QModelIndex& parent) const
{
if (!parent.isValid())
+ {
+ if ((row == -1) || (column == -1))
+ return createIndex(0, 0, m_root);
return QModelIndex();
+ }
TreeItem* item = static_cast<TreeItem*>(parent.internalPointer());
if (column || (row < 0) || (item->childCount() <= row))
return QModelIndex();