diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 16:06:06 +0200 |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 16:06:06 +0200 |
commit | f15b8a83e2e51955776a3f07cb85ebfc342dd8ef (patch) | |
tree | c5dc684986051654898db11ce73e03b9fec8db99 /examples/animation/stickman/graphicsview.cpp |
Initial import of statemachine branch from the old kinetic repository
Diffstat (limited to 'examples/animation/stickman/graphicsview.cpp')
-rw-r--r-- | examples/animation/stickman/graphicsview.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/animation/stickman/graphicsview.cpp b/examples/animation/stickman/graphicsview.cpp new file mode 100644 index 0000000000..d4f0e3a991 --- /dev/null +++ b/examples/animation/stickman/graphicsview.cpp @@ -0,0 +1,40 @@ +#include "graphicsview.h" +#include "editor/mainwindow.h" +#include "stickman.h" + +#include <QtGui/QKeyEvent> +#include <QtGui/QGraphicsScene> +#include <QtGui/QGraphicsView> + +GraphicsView::GraphicsView(QWidget *parent) : QGraphicsView(parent), m_editor(0) {} + +void GraphicsView::keyPressEvent(QKeyEvent *e) +{ + if (e->key() == Qt::Key_Escape) + close(); + +#if 0 + if (e->key() == Qt::Key_F1) { + if (m_editor == 0) { + QGraphicsScene *scene = new QGraphicsScene; + StickMan *stickMan = new StickMan; + stickMan->setDrawSticks(true); + scene->addItem(stickMan); + + QGraphicsView *view = new QGraphicsView; + view->setBackgroundBrush(Qt::black); + view->setRenderHints(QPainter::Antialiasing); + view->setScene(scene); + + m_editor = new MainWindow(stickMan); + m_editor->setCentralWidget(view); + } + + m_editor->showMaximized(); + } +#endif + + emit keyPressed(Qt::Key(e->key())); +} + + |