From eee50e22f49170671ccce7f4ce5e7e4925cd9288 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 3 May 2009 12:21:32 -0400 Subject: Fix handling of extra columns --- sigmodr/tree/TreeModel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sigmodr/tree/TreeModel.cpp') diff --git a/sigmodr/tree/TreeModel.cpp b/sigmodr/tree/TreeModel.cpp index 0ec202fc..cfccbcea 100644 --- a/sigmodr/tree/TreeModel.cpp +++ b/sigmodr/tree/TreeModel.cpp @@ -76,7 +76,7 @@ QModelIndex TreeModel::index(const int row, const int column, const QModelIndex& return QModelIndex(); } TreeItem* item = static_cast(parent.internalPointer()); - if (column || (row < 0) || (item->childCount() <= row)) + if ((row < 0) || (item->childCount() <= row) || (column < 0) || (4 <= column)) return QModelIndex(); return createIndex(row, column, item->childAt(row)); } @@ -108,6 +108,8 @@ int TreeModel::rowCount(const QModelIndex& parent) const int TreeModel::columnCount(const QModelIndex& parent) const { + if (!parent.isValid()) + return 0; return 4; } -- cgit