aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/models/proto_tree_model.cpp9
-rw-r--r--ui/qt/models/proto_tree_model.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/ui/qt/models/proto_tree_model.cpp b/ui/qt/models/proto_tree_model.cpp
index 45e1d6b056..b782c7a449 100644
--- a/ui/qt/models/proto_tree_model.cpp
+++ b/ui/qt/models/proto_tree_model.cpp
@@ -25,6 +25,15 @@ ProtoTreeModel::ProtoTreeModel(QObject * parent) :
root_node_(0)
{}
+Qt::ItemFlags ProtoTreeModel::flags(const QModelIndex &index) const
+{
+ Qt::ItemFlags item_flags = QAbstractItemModel::flags(index);
+ if (rowCount(index) < 1) {
+ item_flags |= Qt::ItemNeverHasChildren;
+ }
+ return item_flags;
+}
+
QModelIndex ProtoTreeModel::index(int row, int, const QModelIndex &parent) const
{
ProtoNode parent_node(root_node_);
diff --git a/ui/qt/models/proto_tree_model.h b/ui/qt/models/proto_tree_model.h
index e0e815cf4b..dce8060b9d 100644
--- a/ui/qt/models/proto_tree_model.h
+++ b/ui/qt/models/proto_tree_model.h
@@ -22,6 +22,7 @@ class ProtoTreeModel : public QAbstractItemModel
public:
explicit ProtoTreeModel(QObject * parent = 0);
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
QModelIndex index(int row, int, const QModelIndex &parent = QModelIndex()) const;
virtual QModelIndex parent(const QModelIndex &index) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;