mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-05 23:56:33 +00:00
Ensures ScanTargetWidget doesn't eat irrelevant keypresses.
This commit is contained in:
parent
cdda3f74ab
commit
366793498a
@ -715,6 +715,8 @@ void MainWindow::setUIPhase(UIPhase phase) {
|
|||||||
// widgets aren't still selectable after a machine starts.
|
// widgets aren't still selectable after a machine starts.
|
||||||
if(phase != UIPhase::SelectingMachine) {
|
if(phase != UIPhase::SelectingMachine) {
|
||||||
ui->openGLWidget->setFocus();
|
ui->openGLWidget->setFocus();
|
||||||
|
} else {
|
||||||
|
ui->startMachineButton->setDefault(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indicate whether to catch mouse input.
|
// Indicate whether to catch mouse input.
|
||||||
|
@ -143,13 +143,20 @@ void ScanTargetWidget::setMouseDelegate(MouseDelegate *delegate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScanTargetWidget::keyPressEvent(QKeyEvent *event) {
|
void ScanTargetWidget::keyPressEvent(QKeyEvent *event) {
|
||||||
|
// Use CTRL+Escape to end mouse captured mode, if currently captured; otherwise ignore the event.
|
||||||
|
// Empirical note: control actually appears to mean command on the Mac. I have no idea what the
|
||||||
|
// Mac's command key would actually be as a modifier. Fingers crossed control means control
|
||||||
|
// elsewhere (?).
|
||||||
if(mouseIsCaptured && event->key() == Qt::Key_Escape && event->modifiers()&Qt::ControlModifier) {
|
if(mouseIsCaptured && event->key() == Qt::Key_Escape && event->modifiers()&Qt::ControlModifier) {
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
|
|
||||||
QCursor cursor;
|
QCursor cursor;
|
||||||
cursor.setShape(Qt::ArrowCursor);
|
cursor.setShape(Qt::ArrowCursor);
|
||||||
setCursor(cursor);
|
setCursor(cursor);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScanTargetWidget::releaseMouse() {
|
void ScanTargetWidget::releaseMouse() {
|
||||||
|
Loading…
Reference in New Issue
Block a user