diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-11-23 09:36:51 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-01 10:51:10 +0100 |
commit | c7ba279815f9bd35a78ede33f516583cf8b022ca (patch) | |
tree | c3ac4b1fe93ab49e1f58dc7ff56bb0339181658a /examples/opengl/paintedwindow/paintedwindow.h | |
parent | f1a67c65312e62c30698c07ab382db64998b8d56 (diff) |
Added rotation animation to paintedwindow example.
This serves as a useful test case for the QScreen orientation API.
Change-Id: I009ebd8b6d345453620420d84f3ff9d2d2e2663e
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'examples/opengl/paintedwindow/paintedwindow.h')
-rw-r--r-- | examples/opengl/paintedwindow/paintedwindow.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/opengl/paintedwindow/paintedwindow.h b/examples/opengl/paintedwindow/paintedwindow.h index dcf8110e24..28e06ec4df 100644 --- a/examples/opengl/paintedwindow/paintedwindow.h +++ b/examples/opengl/paintedwindow/paintedwindow.h @@ -44,7 +44,10 @@ #include <QtGui/qopenglshaderprogram.h> #include <QtGui/qopenglframebufferobject.h> +#include <QPropertyAnimation> + #include <QColor> +#include <QImage> #include <QTime> QT_BEGIN_NAMESPACE @@ -54,16 +57,39 @@ QT_END_NAMESPACE class PaintedWindow : public QWindow { Q_OBJECT + Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) + public: PaintedWindow(); + qreal rotation() const { return m_rotation; } + +signals: + void rotationChanged(qreal rotation); + private slots: void paint(); + void setRotation(qreal r); + void orientationChanged(Qt::ScreenOrientation newOrientation); + void rotationDone(); private: void resizeEvent(QResizeEvent *); void exposeEvent(QExposeEvent *); void mousePressEvent(QMouseEvent *); + void paint(QPainter *painter, const QRect &rect); + QOpenGLContext *m_context; + qreal m_rotation; + + QImage m_prevImage; + QImage m_nextImage; + qreal m_deltaRotation; + + Qt::ScreenOrientation m_targetOrientation; + Qt::ScreenOrientation m_nextTargetOrientation; + + QPropertyAnimation *m_animation; + QTimer *m_paintTimer; }; |