Don't recursively expand (and connect) devices in the device view. Fixes issue #610

This commit is contained in:
David Sansome 2010-09-18 13:55:04 +00:00
parent 44f0934fed
commit 3f926f0cca
4 changed files with 15 additions and 0 deletions

View File

@ -354,3 +354,8 @@ void LibraryView::FilterReturnPressed() {
emit doubleClicked(currentIndex());
}
bool LibraryView::CanRecursivelyExpand(const QModelIndex& index) const {
// Never expand devices
return index.parent().isValid();
}

View File

@ -72,6 +72,9 @@ class LibraryView : public AutoExpandingTreeView {
void contextMenuEvent(QContextMenuEvent* e);
void keyReleaseEvent(QKeyEvent* e);
// AutoExpandingTreeView
bool CanRecursivelyExpand(const QModelIndex& index) const;
private slots:
void Load();
void AddToPlaylist();

View File

@ -16,6 +16,8 @@
#include "autoexpandingtreeview.h"
#include <QtDebug>
const int AutoExpandingTreeView::kRowsToShow = 50;
AutoExpandingTreeView::AutoExpandingTreeView(QWidget *parent)
@ -41,6 +43,9 @@ void AutoExpandingTreeView::RecursivelyExpand(const QModelIndex &index) {
}
bool AutoExpandingTreeView::RecursivelyExpand(const QModelIndex& index, int* count) {
if (!CanRecursivelyExpand(index))
return true;
if (model()->canFetchMore(index))
model()->fetchMore(index);

View File

@ -37,6 +37,8 @@ class AutoExpandingTreeView : public QTreeView {
// QAbstractItemView
void reset();
virtual bool CanRecursivelyExpand(const QModelIndex& index) const { return true; }
private slots:
void ItemExpanded(const QModelIndex& index);