diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-04-29 14:17:08 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-04-29 14:17:09 +0200 |
commit | 85e3c53e5c5e2de993c90ece324a68d0ff62f417 (patch) | |
tree | 6f078576f01f18afcdae773e48664640ce795abe /examples/opengl/hellowindow/hellowindow.h | |
parent | 2e749c089f6fd93909e7cd4cc8129f2969b35185 (diff) | |
parent | 7f943968ade6a65321d4a00822f5b3a034a19e0c (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I2a54058b64ac69c78b4120fdaf09b96e025a4c6c
Diffstat (limited to 'examples/opengl/hellowindow/hellowindow.h')
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h index 3d6ac80cfe..6d66f0204a 100644 --- a/examples/opengl/hellowindow/hellowindow.h +++ b/examples/opengl/hellowindow/hellowindow.h @@ -41,10 +41,13 @@ #include <QWindow> #include <QColor> +#include <QMutex> #include <QOpenGLShaderProgram> #include <QSharedPointer> #include <QTimer> +class HelloWindow; + class Renderer : public QObject { Q_OBJECT @@ -54,8 +57,10 @@ public: QSurfaceFormat format() const { return m_format; } -public slots: - void render(QSurface *surface, const QColor &color, const QSize &viewSize); + void setAnimating(HelloWindow *window, bool animating); + +private slots: + void render(); private: void initialize(); @@ -78,30 +83,28 @@ private: QSurfaceFormat m_format; QOpenGLContext *m_context; QOpenGLShaderProgram *m_program; + + QList<HelloWindow *> m_windows; + int m_currentWindow; + + QMutex m_windowLock; }; class HelloWindow : public QWindow { - Q_OBJECT - public: explicit HelloWindow(const QSharedPointer<Renderer> &renderer); + QColor color() const; void updateColor(); void exposeEvent(QExposeEvent *event); -signals: - void needRender(QSurface *surface, const QColor &color, const QSize &viewSize); - -private slots: - void render(); - private: void mousePressEvent(QMouseEvent *); int m_colorIndex; QColor m_color; const QSharedPointer<Renderer> m_renderer; - QTimer *m_timer; + mutable QMutex m_colorLock; }; |