summaryrefslogtreecommitdiffstats
path: root/sigmodr/tree/TreeModel.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-05-03 01:29:19 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-05-03 01:29:19 -0400
commita3b770c599ea414fadf28bffd1aef76a2367cc9d (patch)
tree78a1f4720fe3841879494ad796f3f2015917ea5e /sigmodr/tree/TreeModel.cpp
parentcc5cf6f073d6f2f4502f7b4b19f8d9ac84233111 (diff)
downloadsigen-a3b770c599ea414fadf28bffd1aef76a2367cc9d.tar.gz
sigen-a3b770c599ea414fadf28bffd1aef76a2367cc9d.tar.xz
sigen-a3b770c599ea414fadf28bffd1aef76a2367cc9d.zip
Add data fetching for the text of the item
Diffstat (limited to 'sigmodr/tree/TreeModel.cpp')
-rw-r--r--sigmodr/tree/TreeModel.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/sigmodr/tree/TreeModel.cpp b/sigmodr/tree/TreeModel.cpp
index defaa218..15f8dae2 100644
--- a/sigmodr/tree/TreeModel.cpp
+++ b/sigmodr/tree/TreeModel.cpp
@@ -36,6 +36,15 @@ TreeModel::~TreeModel()
QVariant TreeModel::data(const QModelIndex& index, const int role) const
{
+ if (!index.isValid())
+ return QVariant();
+ TreeItem* item = static_cast<TreeItem*>(index.internalPointer());
+ if (role == Qt::DisplayRole)
+ {
+ if (!index.column())
+ return item->text();
+ }
+ return QVariant();
}
QModelIndex TreeModel::index(const int row, const int column, const QModelIndex& parent) const