fix a bug where view continues to pan when window lost focus while panning
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <QCursor>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFocusEvent>
|
||||
#include <QFont>
|
||||
#include <QKeyEvent>
|
||||
#include <QLinearGradient>
|
||||
@@ -2361,10 +2362,22 @@ void GameWorldView::keyReleaseEvent(QKeyEvent* event)
|
||||
}
|
||||
if (m_inputMapper.handleKeyRelease(event)) { return; }
|
||||
// Releasing Shift discards the copied building settings (REQ-BLD-COPY-CONFIG).
|
||||
// Stays here rather than moving to the input mapper: Shift is the modifier of a
|
||||
// mouse gesture, not a keyboard action of its own.
|
||||
if (event->key() == Qt::Key_Shift) { m_copiedConfig.reset(); }
|
||||
QOpenGLWidget::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
void GameWorldView::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
// Without this, holding A while a modal opens (the escape menu, a schematic
|
||||
// choice, game over) leaves the pan key held: the key-up goes to the dialog,
|
||||
// never here, and the view pans on its own once the dialog closes. Panning runs
|
||||
// on wall-clock time, so pausing does not mask it either.
|
||||
m_inputMapper.releaseAll();
|
||||
QOpenGLWidget::focusOutEvent(event);
|
||||
}
|
||||
|
||||
void GameWorldView::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
const WorldCoordinates coordinates = getCoordinates();
|
||||
|
||||
Reference in New Issue
Block a user