From 08e58c66b65b1f13763c9f61f5d349fa9e0b80b3 Mon Sep 17 00:00:00 2001 From: reionwong Date: Fri, 22 Oct 2021 22:25:16 +0800 Subject: [PATCH] Add shortcut key for ShowHiddenFiles --- helper/shortcut.cpp | 2 ++ helper/shortcut.h | 1 + qml/Desktop/Main.qml | 3 +++ qml/FolderPage.qml | 3 +++ 4 files changed, 9 insertions(+) diff --git a/helper/shortcut.cpp b/helper/shortcut.cpp index 764957d..0e62b65 100644 --- a/helper/shortcut.cpp +++ b/helper/shortcut.cpp @@ -68,6 +68,8 @@ bool ShortCut::eventFilter(QObject *obj, QEvent *e) emit deleteFile(); } else if (keyEvent->key() == Qt::Key_F5) { emit refresh(); + } else if (keyEvent->key() == Qt::Key_H && keyEvent->modifiers() & Qt::ControlModifier) { + emit showHidden(); } else if (keyEvent->key() >= Qt::Key_A && keyEvent->key() <= Qt::Key_Z) { // Handle select // KeyboardSearchManager::self()->addKeys(keyEvent->text()); diff --git a/helper/shortcut.h b/helper/shortcut.h index 25b2713..6a24b96 100644 --- a/helper/shortcut.h +++ b/helper/shortcut.h @@ -44,6 +44,7 @@ signals: void selectAll(); void backspace(); void deleteFile(); + void showHidden(); void keyPressed(const QString &text); protected: diff --git a/qml/Desktop/Main.qml b/qml/Desktop/Main.qml index b5ad0e2..870d9ce 100644 --- a/qml/Desktop/Main.qml +++ b/qml/Desktop/Main.qml @@ -137,6 +137,9 @@ Item { onKeyPressed: { dirModel.keyboardSearch(text) } + onShowHidden: { + dirModel.showHiddenFiles = !dirModel.showHiddenFiles + } } Component { diff --git a/qml/FolderPage.qml b/qml/FolderPage.qml index 279fc2c..4adb789 100644 --- a/qml/FolderPage.qml +++ b/qml/FolderPage.qml @@ -397,6 +397,9 @@ Item { onKeyPressed: { dirModel.keyboardSearch(text) } + onShowHidden: { + dirModel.showHiddenFiles = !dirModel.showHiddenFiles + } } function openUrl(url) {