summaryrefslogtreecommitdiffstats
path: root/examples/opengl/hellowindow/hellowindow.h
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-29 14:17:08 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-29 14:17:09 +0200
commit85e3c53e5c5e2de993c90ece324a68d0ff62f417 (patch)
tree6f078576f01f18afcdae773e48664640ce795abe /examples/opengl/hellowindow/hellowindow.h
parent2e749c089f6fd93909e7cd4cc8129f2969b35185 (diff)
parent7f943968ade6a65321d4a00822f5b3a034a19e0c (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'examples/opengl/hellowindow/hellowindow.h')
-rw-r--r--examples/opengl/hellowindow/hellowindow.h25
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;
};