Add shortcut key for ShowHiddenFiles

This commit is contained in:
reionwong 2021-10-22 22:25:16 +08:00
parent d091f6f9a2
commit 08e58c66b6
4 changed files with 9 additions and 0 deletions

View file

@ -68,6 +68,8 @@ bool ShortCut::eventFilter(QObject *obj, QEvent *e)
emit deleteFile(); emit deleteFile();
} else if (keyEvent->key() == Qt::Key_F5) { } else if (keyEvent->key() == Qt::Key_F5) {
emit refresh(); 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) { } else if (keyEvent->key() >= Qt::Key_A && keyEvent->key() <= Qt::Key_Z) {
// Handle select // Handle select
// KeyboardSearchManager::self()->addKeys(keyEvent->text()); // KeyboardSearchManager::self()->addKeys(keyEvent->text());

View file

@ -44,6 +44,7 @@ signals:
void selectAll(); void selectAll();
void backspace(); void backspace();
void deleteFile(); void deleteFile();
void showHidden();
void keyPressed(const QString &text); void keyPressed(const QString &text);
protected: protected:

View file

@ -137,6 +137,9 @@ Item {
onKeyPressed: { onKeyPressed: {
dirModel.keyboardSearch(text) dirModel.keyboardSearch(text)
} }
onShowHidden: {
dirModel.showHiddenFiles = !dirModel.showHiddenFiles
}
} }
Component { Component {

View file

@ -397,6 +397,9 @@ Item {
onKeyPressed: { onKeyPressed: {
dirModel.keyboardSearch(text) dirModel.keyboardSearch(text)
} }
onShowHidden: {
dirModel.showHiddenFiles = !dirModel.showHiddenFiles
}
} }
function openUrl(url) { function openUrl(url) {