summaryrefslogtreecommitdiffstats
path: root/searchdialog.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-02-03 04:42:48 +0100
committerArno <arno@disconnect.de>2018-02-03 04:42:48 +0100
commitcbb1974ae94858b101ba1bf92047236dcfa2e5fa (patch)
tree89f2a4646e5eace7b6a56f64af6bda2104765b0f /searchdialog.cpp
parent65c61cf5ef74ef4be386e0e6a9bc056f34bc6adc (diff)
downloadShemovCleaner-cbb1974ae94858b101ba1bf92047236dcfa2e5fa.tar.gz
ShemovCleaner-cbb1974ae94858b101ba1bf92047236dcfa2e5fa.tar.bz2
ShemovCleaner-cbb1974ae94858b101ba1bf92047236dcfa2e5fa.zip
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.
Diffstat (limited to 'searchdialog.cpp')
-rw-r--r--searchdialog.cpp14
1 files 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(){