diff options
Diffstat (limited to 'sigmodr/tree/TreeModel.cpp')
-rw-r--r-- | sigmodr/tree/TreeModel.cpp | 9 |
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 |