Make single clicking on an item in a library view expand it. Fixes issue #1027

This commit is contained in:
David Sansome 2010-12-07 21:13:40 +00:00
parent d761a5e91f
commit 579e24965a
2 changed files with 6 additions and 0 deletions

View File

@ -27,6 +27,7 @@ AutoExpandingTreeView::AutoExpandingTreeView(QWidget *parent)
expand_on_reset_(true) expand_on_reset_(true)
{ {
connect(this, SIGNAL(expanded(QModelIndex)), SLOT(ItemExpanded(QModelIndex))); connect(this, SIGNAL(expanded(QModelIndex)), SLOT(ItemExpanded(QModelIndex)));
connect(this, SIGNAL(clicked(QModelIndex)), SLOT(ItemClicked(QModelIndex)));
} }
void AutoExpandingTreeView::reset() { void AutoExpandingTreeView::reset() {
@ -69,3 +70,7 @@ void AutoExpandingTreeView::ItemExpanded(const QModelIndex& index) {
if (model()->rowCount(index) == 1 && auto_open_) if (model()->rowCount(index) == 1 && auto_open_)
expand(model()->index(0, 0, index)); expand(model()->index(0, 0, index));
} }
void AutoExpandingTreeView::ItemClicked(const QModelIndex& index) {
expand(index);
}

View File

@ -42,6 +42,7 @@ class AutoExpandingTreeView : public QTreeView {
private slots: private slots:
void ItemExpanded(const QModelIndex& index); void ItemExpanded(const QModelIndex& index);
void ItemClicked(const QModelIndex& index);
private: private:
bool RecursivelyExpand(const QModelIndex& index, int* count); bool RecursivelyExpand(const QModelIndex& index, int* count);