1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00

Ensures newly-hidden widgets aren't still in focus.

This commit is contained in:
Thomas Harte 2020-06-19 22:01:53 -04:00
parent 4e83e80962
commit 222c16c5b8

View File

@ -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