mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-26 09:29:45 +00:00
Merge branch 'master' into 65816
This commit is contained in:
commit
da78dea98f
@ -812,7 +812,7 @@ void MainWindow::setWindowTitle() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mouseIsCaptured) title += " (press control+escape to release mouse)";
|
if(mouseIsCaptured) title += " (press control+escape or F8+F12 to release mouse)";
|
||||||
|
|
||||||
QMainWindow::setWindowTitle(title);
|
QMainWindow::setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
@ -142,12 +142,25 @@ void ScanTargetWidget::setMouseDelegate(MouseDelegate *delegate) {
|
|||||||
setMouseTracking(delegate);
|
setMouseTracking(delegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScanTargetWidget::keyReleaseEvent(QKeyEvent *event) {
|
||||||
|
// Releasing F8 or F12 needs to be tracked but doesn't actively do anything,
|
||||||
|
// so I'm counting that as a Qt ignore.
|
||||||
|
if(event->key() == Qt::Key_F8) f8State = false;
|
||||||
|
if(event->key() == Qt::Key_F12) f12State = false;
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
|
||||||
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.
|
// Use either CTRL+Escape or F8+F12 to end mouse captured mode, if currently captured;
|
||||||
// Empirical note: control actually appears to mean command on the Mac. I have no idea what the
|
// otherwise ignore the event.
|
||||||
// Mac's command key would actually be as a modifier. Fingers crossed control means control
|
|
||||||
// elsewhere (?).
|
if(event->key() == Qt::Key_F8) f8State = true;
|
||||||
if(mouseIsCaptured && event->key() == Qt::Key_Escape && event->modifiers()&Qt::ControlModifier) {
|
if(event->key() == Qt::Key_F12) f12State = true;
|
||||||
|
|
||||||
|
if(mouseIsCaptured && (
|
||||||
|
(event->key() == Qt::Key_Escape && event->modifiers()&Qt::ControlModifier) ||
|
||||||
|
(f8State && f12State)
|
||||||
|
)) {
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
|
|
||||||
QCursor cursor;
|
QCursor cursor;
|
||||||
|
@ -42,6 +42,7 @@ class ScanTargetWidget : public QOpenGLWidget {
|
|||||||
void mouseReleaseEvent(QMouseEvent *) override;
|
void mouseReleaseEvent(QMouseEvent *) override;
|
||||||
void mouseMoveEvent(QMouseEvent *) override;
|
void mouseMoveEvent(QMouseEvent *) override;
|
||||||
void keyPressEvent(QKeyEvent *) override;
|
void keyPressEvent(QKeyEvent *) override;
|
||||||
|
void keyReleaseEvent(QKeyEvent *) override;
|
||||||
|
|
||||||
void releaseMouse();
|
void releaseMouse();
|
||||||
void setMouseButtonPressed(Qt::MouseButton, bool);
|
void setMouseButtonPressed(Qt::MouseButton, bool);
|
||||||
@ -66,6 +67,7 @@ class ScanTargetWidget : public QOpenGLWidget {
|
|||||||
|
|
||||||
MouseDelegate *mouseDelegate = nullptr;
|
MouseDelegate *mouseDelegate = nullptr;
|
||||||
bool mouseIsCaptured = false;
|
bool mouseIsCaptured = false;
|
||||||
|
bool f8State = false, f12State = false; // To support F8+F12 as a mouse release combination.
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void vsync();
|
void vsync();
|
||||||
|
Loading…
Reference in New Issue
Block a user