Ctrl+W and Esc close the visualisation window

This commit is contained in:
David Sansome 2010-06-06 22:39:01 +00:00
parent 2a77a1070d
commit 93cb686f08
2 changed files with 14 additions and 0 deletions

View File

@ -192,6 +192,19 @@ void VisualisationContainer::contextMenuEvent(QContextMenuEvent *event) {
ShowPopupMenu(event->pos());
}
void VisualisationContainer::keyReleaseEvent(QKeyEvent *event) {
if (event->matches(QKeySequence::Close) ||
event->key() == Qt::Key_Escape) {
if (isFullScreen())
ToggleFullscreen();
else
hide();
event->accept();
}
QGraphicsView::keyReleaseEvent(event);
}
void VisualisationContainer::ToggleFullscreen() {
setWindowState(windowState() ^ Qt::WindowFullScreen);
}

View File

@ -60,6 +60,7 @@ protected:
void leaveEvent(QEvent* e);
void mouseDoubleClickEvent(QMouseEvent* e);
void contextMenuEvent(QContextMenuEvent *event);
void keyReleaseEvent(QKeyEvent *event);
private:
void SizeChanged();