UI: OptionsWindow: Use Ctrl+S to apply changes.

This commit is contained in:
Nodir Temirkhodjaev 2020-01-23 19:48:03 +05:00
parent db8b7c5c2f
commit 95786495c6
2 changed files with 23 additions and 8 deletions

View File

@ -36,10 +36,20 @@ void OptionsWindow::closeEvent(QCloseEvent *event)
void OptionsWindow::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape
&& event->modifiers() == Qt::NoModifier
&& !event->isAutoRepeat()) {
ctrl()->closeWindow();
if (event->isAutoRepeat())
return;
switch (event->key()) {
case Qt::Key_Escape: // Esc
if (event->modifiers() == Qt::NoModifier) {
ctrl()->closeWindow();
}
break;
case Qt::Key_S: // Ctrl+S
if (event->modifiers() == Qt::ControlModifier) {
ctrl()->applyChanges();
}
break;
}
}

View File

@ -74,10 +74,15 @@ void ProgramsWindow::closeEvent(QCloseEvent *event)
void ProgramsWindow::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape
&& event->modifiers() == Qt::NoModifier
&& !event->isAutoRepeat()) {
ctrl()->closeWindow();
if (event->isAutoRepeat())
return;
switch (event->key()) {
case Qt::Key_Escape: // Esc
if (event->modifiers() == Qt::NoModifier) {
ctrl()->closeWindow();
}
break;
}
}