Don't recursively expand (and connect) devices in the device view. Fixes issue #610
This commit is contained in:
parent
44f0934fed
commit
3f926f0cca
|
@ -354,3 +354,8 @@ void LibraryView::FilterReturnPressed() {
|
|||
|
||||
emit doubleClicked(currentIndex());
|
||||
}
|
||||
|
||||
bool LibraryView::CanRecursivelyExpand(const QModelIndex& index) const {
|
||||
// Never expand devices
|
||||
return index.parent().isValid();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue