From 579e24965ad850602891b6a50363582e126eb908 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Tue, 7 Dec 2010 21:13:40 +0000 Subject: [PATCH] Make single clicking on an item in a library view expand it. Fixes issue #1027 --- src/widgets/autoexpandingtreeview.cpp | 5 +++++ src/widgets/autoexpandingtreeview.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/widgets/autoexpandingtreeview.cpp b/src/widgets/autoexpandingtreeview.cpp index 44dc30ef9..14469d27c 100644 --- a/src/widgets/autoexpandingtreeview.cpp +++ b/src/widgets/autoexpandingtreeview.cpp @@ -27,6 +27,7 @@ AutoExpandingTreeView::AutoExpandingTreeView(QWidget *parent) expand_on_reset_(true) { connect(this, SIGNAL(expanded(QModelIndex)), SLOT(ItemExpanded(QModelIndex))); + connect(this, SIGNAL(clicked(QModelIndex)), SLOT(ItemClicked(QModelIndex))); } void AutoExpandingTreeView::reset() { @@ -69,3 +70,7 @@ void AutoExpandingTreeView::ItemExpanded(const QModelIndex& index) { if (model()->rowCount(index) == 1 && auto_open_) expand(model()->index(0, 0, index)); } + +void AutoExpandingTreeView::ItemClicked(const QModelIndex& index) { + expand(index); +} diff --git a/src/widgets/autoexpandingtreeview.h b/src/widgets/autoexpandingtreeview.h index 4dc03e411..259e19299 100644 --- a/src/widgets/autoexpandingtreeview.h +++ b/src/widgets/autoexpandingtreeview.h @@ -42,6 +42,7 @@ class AutoExpandingTreeView : public QTreeView { private slots: void ItemExpanded(const QModelIndex& index); + void ItemClicked(const QModelIndex& index); private: bool RecursivelyExpand(const QModelIndex& index, int* count);