From 222c16c5b837b4779244478bca0934ce57731d87 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 19 Jun 2020 22:01:53 -0400 Subject: [PATCH] Ensures newly-hidden widgets aren't still in focus. --- OSBindings/Qt/mainwindow.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index 9062b3099..235aed418 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -329,6 +329,12 @@ void MainWindow::setVisibleWidgetSet(WidgetSet set) { ui->machineSelectionTabs->setVisible(set == WidgetSet::MachinePicker); ui->startMachineButton->setVisible(set == WidgetSet::MachinePicker); ui->topTipLabel->setVisible(set == WidgetSet::MachinePicker); + + // Set appropriate focus if necessary; e.g. this ensures that machine-picker + // widgets aren't still selectable after a machine starts. + if(set != WidgetSet::MachinePicker) { + ui->openGLWidget->setFocus(); + } } // MARK: - Event Processing @@ -397,7 +403,7 @@ bool MainWindow::processEvent(QKeyEvent *event) { std::unique_lock lock(machineMutex); keyboardMachine->get_keyboard().set_key_pressed(key, event->text()[0].toLatin1(), event->type() == QEvent::KeyPress); - return true; + return false; } // MARK: - New Machine Creation