mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Definitively resolve the bug with ESC
This commit is contained in:
@@ -140,3 +140,18 @@ void DestinationGLCanvas::resizeGL(int width, int height)
|
||||
// TODO: _brush_test_signal(_svg_test_signal)
|
||||
}
|
||||
|
||||
bool DestinationGLCanvas::eventFilter(QObject *target, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
MapperGLCanvas::keyPressEvent(keyEvent);
|
||||
qDebug() << "Test:" << keyEvent << endl;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return QObject::eventFilter(target, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ private:
|
||||
protected:
|
||||
// overriden from QGlWidget:
|
||||
virtual void resizeGL(int width, int height);
|
||||
bool eventFilter(QObject *target, QEvent *event);
|
||||
};
|
||||
|
||||
#endif /* DESTINATIONGLCANVAS_H_ */
|
||||
|
||||
@@ -323,6 +323,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (keyEvent->key() == Qt::Key_Escape) outputWindow->setFullScreen(false);
|
||||
eventKey = false;
|
||||
|
||||
return eventKey;
|
||||
@@ -1051,6 +1052,7 @@ void MainWindow::createLayout()
|
||||
|
||||
outputWindow = new OutputGLWindow(this, this, sourceCanvas);
|
||||
outputWindow->setVisible(true);
|
||||
outputWindow->installEventFilter(destinationCanvas);
|
||||
outputWindow->installEventFilter(this);
|
||||
|
||||
// Source changed -> change destination
|
||||
|
||||
+1
-18
@@ -65,27 +65,10 @@ void OutputGLWindow::closeEvent(QCloseEvent *event)
|
||||
this->parentWidget()->setFocus();
|
||||
}
|
||||
|
||||
void OutputGLWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
// Escape from full screen mode.
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
{
|
||||
if (isFullScreen())
|
||||
{
|
||||
setFullScreen(false);
|
||||
emit fullScreenToggled(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QDialog::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OutputGLWindow::setFullScreen(bool fullscreen)
|
||||
{
|
||||
setCursorVisible(!fullscreen);
|
||||
emit fullScreenToggled(fullscreen);
|
||||
// Activate crosshair in fullscreen mode.
|
||||
// should be only drawn if the controls should be shown
|
||||
canvas->setDisplayCrosshair(fullscreen && this->canvas->displayControls());
|
||||
|
||||
@@ -41,7 +41,6 @@ public slots:
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
signals:
|
||||
void closed();
|
||||
|
||||
Reference in New Issue
Block a user