summaryrefslogtreecommitdiffstats
path: root/examples/animation/stickman/graphicsview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/animation/stickman/graphicsview.cpp')
-rw-r--r--examples/animation/stickman/graphicsview.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/animation/stickman/graphicsview.cpp b/examples/animation/stickman/graphicsview.cpp
new file mode 100644
index 0000000..1b6afa9
--- /dev/null
+++ b/examples/animation/stickman/graphicsview.cpp
@@ -0,0 +1,15 @@
+#include "graphicsview.h"
+
+#include <QtGui/QKeyEvent>
+
+GraphicsView::GraphicsView(QWidget *parent) : QGraphicsView(parent) {}
+
+void GraphicsView::keyPressEvent(QKeyEvent *e)
+{
+ if (e->key() == Qt::Key_Escape)
+ close();
+
+ emit keyPressed(Qt::Key(e->key()));
+}
+
+