summaryrefslogtreecommitdiffstats
path: root/sigmodr/tree
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-05-03 01:29:46 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-05-03 01:29:46 -0400
commit6ce966fbb12f4f3934aa14c78489671d6fd186fb (patch)
tree135924ffac757f8e604380d37f7bb3a0d3047277 /sigmodr/tree
parenta3b770c599ea414fadf28bffd1aef76a2367cc9d (diff)
downloadsigen-6ce966fbb12f4f3934aa14c78489671d6fd186fb.tar.gz
sigen-6ce966fbb12f4f3934aa14c78489671d6fd186fb.tar.xz
sigen-6ce966fbb12f4f3934aa14c78489671d6fd186fb.zip
Make a root item if asked for
Diffstat (limited to 'sigmodr/tree')
-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();