diff options
author | Arno <arno@disconnect.de> | 2016-09-05 04:08:07 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2016-09-05 04:08:07 +0200 |
commit | 3a6e43400ff1c36269d6b7cb822b3ffe6ff58fb7 (patch) | |
tree | 15b7a57f575db18fabec9d06d4bc4f9c65b1f12e | |
parent | dc9c309f0409a71865315f901b1900f36af79050 (diff) | |
download | ShemovCleaner-3a6e43400ff1c36269d6b7cb822b3ffe6ff58fb7.tar.gz ShemovCleaner-3a6e43400ff1c36269d6b7cb822b3ffe6ff58fb7.tar.bz2 ShemovCleaner-3a6e43400ff1c36269d6b7cb822b3ffe6ff58fb7.zip |
Fix keyboard naviagtion for TorrentWidget too
For an explanation see commit eaaa0c165b83aba1227304eb1074098ac0028ae8
-rw-r--r-- | torrentwidget.cpp | 28 | ||||
-rw-r--r-- | torrentwidget.h | 2 |
2 files changed, 29 insertions, 1 deletions
diff --git a/torrentwidget.cpp b/torrentwidget.cpp index f4619f1..cf866df 100644 --- a/torrentwidget.cpp +++ b/torrentwidget.cpp @@ -99,7 +99,7 @@ void TorrentWidget::createActions(){ mMoveA->setShortcut(tr("CTRL+M")); connect(mMoveA, SIGNAL(triggered()), this, SLOT(moveFiles())); mTorrentInfoA = new QAction(QIcon(":/huge_bra.png"), tr("Torrent Info..."), this); - mTorrentInfoA->setShortcut(Qt::Key_Return); + mTorrentInfoA->setShortcut(Qt::CTRL + Qt::Key_Return); connect(mTorrentInfoA, SIGNAL(triggered()), this, SLOT(torrentInfo())); mSelDirA = new QAction(QIcon(":/folder.png"), tr("Select folder..."), this); mSelDirA->setShortcut(tr("CTRL+O")); @@ -271,6 +271,32 @@ void TorrentWidget::searchFile(){ emit statusMessage(QString(tr("Found %1 file(s)").arg(QString::number(success)))); } +void TorrentWidget::keyPressEvent(QKeyEvent *e){ + if(e->key() == Qt::Key_S && (e->modifiers() & Qt::ControlModifier)){ + mSearchTorrents->setFocus(); + mSearchTorrents->selectAll(); + goto exit; + } + if(e->key() == Qt::Key_D && (e->modifiers() & Qt::ControlModifier)){ + mDir->setFocus(); + mDir->selectAll(); + goto exit; + } + if(e->key() == Qt::Key_F && (e->modifiers() & Qt::ControlModifier)){ + mFileView->setFocus(); + goto exit; + } + if(mFileView->hasFocus()){ + if(e->key() == Qt::Key_Return){ + } + } + + return QWidget::keyPressEvent(e); + + exit: + e->accept(); +} + void TorrentWidget::contextMenuEvent(QContextMenuEvent *e){ QMenu contextMenu(this); contextMenu.addActions(actions()); diff --git a/torrentwidget.h b/torrentwidget.h index 051a281..4a354ce 100644 --- a/torrentwidget.h +++ b/torrentwidget.h @@ -13,6 +13,7 @@ class QStandardItemModel; class QLabel; class QToolBar; class QMenuBar; +class QKeyEvent; class FileSorter; class TorrentDisplay; @@ -41,6 +42,7 @@ class TorrentWidget : public QWidget { void fileSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); protected: + virtual void keyPressEvent(QKeyEvent *e); virtual void contextMenuEvent(QContextMenuEvent *e); private: |