From 308f8ae11f08b811318373183e12b53d27deb631 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 22 Nov 2020 04:07:32 +0100 Subject: Select and expand in SearchDialog When searching for actors, select the first item in the list and expand everything. For some strange reason QTreeView::expand or QTreeView::setExpanded does not work, so I grab the big hammer and expand all. --- searchdialog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'searchdialog.cpp') diff --git a/searchdialog.cpp b/searchdialog.cpp index 086be9f..5c155b9 100644 --- a/searchdialog.cpp +++ b/searchdialog.cpp @@ -265,8 +265,14 @@ void ActorsAndMore::searchActor(const QString &actor){ getGenresForActor(cur); root->appendRow(cur); } + mResultView->setSortingEnabled(true); mResultView->sortByColumn(0, Qt::AscendingOrder); + QModelIndex first = mResultModel->index(0,0); + if(first.isValid()){ + mResultView->selectionModel()->setCurrentIndex(first, QItemSelectionModel::ClearAndSelect); + mResultView->expandAll(); + } } void ActorsAndMore::searchSubtitle(const QString &subtitle){ -- cgit v1.2.3-70-g09d2