diff options
author | Arno <arno@disconnect.de> | 2018-02-02 07:51:09 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-02-02 07:51:09 +0100 |
commit | aeb21594c540ecab7bbd2c7a37d9e2fcec13b286 (patch) | |
tree | d4f691d9fe8a8c9db0f3c25ebf85a9e09fcea90a /searchdialog.cpp | |
parent | 873aea1fc7a23bf6e764012b3422c4d9b0c39026 (diff) | |
download | ShemovCleaner-aeb21594c540ecab7bbd2c7a37d9e2fcec13b286.tar.gz ShemovCleaner-aeb21594c540ecab7bbd2c7a37d9e2fcec13b286.tar.bz2 ShemovCleaner-aeb21594c540ecab7bbd2c7a37d9e2fcec13b286.zip |
Add CTRL+S shortcut for SearchDialog
If in FileWidget, show and raise SearchDialog on CTRL+s, hide it on CTRL
+x. Show busy cursor while searching.
Diffstat (limited to 'searchdialog.cpp')
-rw-r--r-- | searchdialog.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/searchdialog.cpp b/searchdialog.cpp index ff469ee..79beb0f 100644 --- a/searchdialog.cpp +++ b/searchdialog.cpp @@ -11,6 +11,8 @@ #include <QSqlDatabase> #include <QSqlQuery> #include <QSettings> +#include <QKeyEvent> +#include <QApplication> #include "searchdialog.h" #include "helper.h" @@ -81,6 +83,7 @@ SearchDialog::~SearchDialog(){ void SearchDialog::doSearch(){ int type = mTypeSel->currentData().toInt(); + qApp->setOverrideCursor(Qt::BusyCursor); if(type == Title){ doSearchTitle(); }else if(type == Filename){ @@ -88,16 +91,19 @@ void SearchDialog::doSearch(){ }else if(type == Actors){ doSearchActor(); } + qApp->restoreOverrideCursor(); } void SearchDialog::doResult(const QModelIndex &cur, const QModelIndex &prev){ Q_UNUSED(prev) int type = mTypeSel->currentData().toInt(); + qApp->setOverrideCursor(Qt::BusyCursor); if(type == Title || type == Filename){ doResultName(cur, type); }else if(type == Actors){ doResultActor(cur); } + qApp->restoreOverrideCursor(); } void SearchDialog::doSearchTitle(){ @@ -293,6 +299,17 @@ void SearchDialog::readSettings(){ } } +void SearchDialog::keyPressEvent(QKeyEvent *e){ + if(e->key() == Qt::Key_X && (e->modifiers() & Qt::ControlModifier)){ + hide(); + goto exit; + } + return QDialog::keyPressEvent(e); + + exit: + e->accept(); +} + void SearchDialog::doChild(QStandardItem *item, int childMode){ QStringList res; QIcon aIcon; |