From cbb1974ae94858b101ba1bf92047236dcfa2e5fa Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 3 Feb 2018 04:42:48 +0100 Subject: Select first result in SearchDialog Select the first item if we have a result. Also check if we have already set the override cursor to prevent a constant busy cursor. --- searchdialog.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/searchdialog.cpp b/searchdialog.cpp index 04fbf18..e30ead6 100644 --- a/searchdialog.cpp +++ b/searchdialog.cpp @@ -93,19 +93,29 @@ void SearchDialog::doSearch(){ }else if(type == Actors){ doSearchActor(); } + QModelIndex first = mResV->selectionModel()->model()->index(0, 0); + if(first.isValid()){ + mResV->selectionModel()->setCurrentIndex(first, QItemSelectionModel::ClearAndSelect); + } qApp->restoreOverrideCursor(); } void SearchDialog::doResult(const QModelIndex &cur, const QModelIndex &prev){ Q_UNUSED(prev) int type = mTypeSel->currentData().toInt(); - qApp->setOverrideCursor(Qt::BusyCursor); + bool restoreCursor = false; + if(!qApp->overrideCursor()){ + qApp->setOverrideCursor(Qt::BusyCursor); + restoreCursor = true; + } if(type == Title || type == Filename){ doResultName(cur, type); }else if(type == Actors){ doResultActor(cur); } - qApp->restoreOverrideCursor(); + if(restoreCursor){ + qApp->restoreOverrideCursor(); + } } void SearchDialog::doSearchTitle(){ -- cgit v1.2.3-70-g09d2