summaryrefslogtreecommitdiff
path: root/src/modlistview.cpp
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-12-31 22:30:19 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2021-01-02 15:38:18 +0100
commitb5ce6eb8e7ba67f15dcffe0639d7012088c53ebe (patch)
tree20fdde00677a8f41b59205860ca38ae17ad69a8b /src/modlistview.cpp
parentbd34b532230d92bd6232ceb1ab2b0092cac79d22 (diff)
Move open-explorer key combination to views.
Diffstat (limited to 'src/modlistview.cpp')
-rw-r--r--src/modlistview.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp
index 082d947e..22a673d1 100644
--- a/src/modlistview.cpp
+++ b/src/modlistview.cpp
@@ -964,20 +964,28 @@ void ModListView::timerEvent(QTimerEvent* event)
bool ModListView::event(QEvent* event)
{
- Profile* profile = m_core->currentProfile();
- if (event->type() == QEvent::KeyPress && profile) {
+ if (event->type() == QEvent::KeyPress) {
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->modifiers() == Qt::ControlModifier
- && sortColumn() == ModList::COL_PRIORITY
- && (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down)) {
- return moveSelection(keyEvent->key());
- }
- else if (keyEvent->key() == Qt::Key_Delete) {
- return removeSelection();
+ && (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter)) {
+ if (selectionModel()->hasSelection() && selectionModel()->selectedRows().count() == 1) {
+ m_actions->openExplorer({ indexViewToModel(selectionModel()->currentIndex()) });
+ return true;
+ }
}
- else if (keyEvent->key() == Qt::Key_Space) {
- return toggleSelectionState();
+ else if (m_core->currentProfile()) {
+ if (keyEvent->modifiers() == Qt::ControlModifier
+ && sortColumn() == ModList::COL_PRIORITY
+ && (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down)) {
+ return moveSelection(keyEvent->key());
+ }
+ else if (keyEvent->key() == Qt::Key_Delete) {
+ return removeSelection();
+ }
+ else if (keyEvent->key() == Qt::Key_Space) {
+ return toggleSelectionState();
+ }
}
return QTreeView::event(event);
}