aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph/openglunderqml/squircle.h
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-02 09:58:13 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-02 10:32:33 +0200
commit41e924eb6e1c690bc81d095fc5e8f57244aae964 (patch)
treeb459dfa150530443901be68471df88c69ca7a7d4 /examples/quick/scenegraph/openglunderqml/squircle.h
parentd51afdb74fdcb9a5c7e1fdaa763325c78d794d06 (diff)
parent87a5889029aed8c53a4b02a42804d036614db36b (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: .qmake.conf examples/quick/scenegraph/openglunderqml/squircle.h src/quick/doc/src/qmltypereference.qdoc src/quick/scenegraph/qsgthreadedrenderloop.cpp Change-Id: Ife4f4b897044a7ffcd0710493c6aed1d87cf1ef9
Diffstat (limited to 'examples/quick/scenegraph/openglunderqml/squircle.h')
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h
index 203a174f3c..d557339155 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.h
+++ b/examples/quick/scenegraph/openglunderqml/squircle.h
@@ -46,11 +46,33 @@
#include <QtGui/QOpenGLShaderProgram>
#include <QtGui/QOpenGLFunctions>
+
+
//! [1]
-class Squircle : public QQuickItem, protected QOpenGLFunctions
+class SquircleRenderer : public QObject, protected QOpenGLFunctions
{
Q_OBJECT
+public:
+ SquircleRenderer() : m_t(0), m_program(0) { }
+ ~SquircleRenderer();
+ void setT(qreal t) { m_t = t; }
+ void setViewportSize(const QSize &size) { m_viewportSize = size; }
+
+public slots:
+ void paint();
+
+private:
+ QSize m_viewportSize;
+ qreal m_t;
+ QOpenGLShaderProgram *m_program;
+};
+//! [1]
+
+//! [2]
+class Squircle : public QQuickItem
+{
+ Q_OBJECT
Q_PROPERTY(qreal t READ t WRITE setT NOTIFY tChanged)
public:
@@ -63,19 +85,16 @@ signals:
void tChanged();
public slots:
- void paint();
- void cleanup();
void sync();
+ void cleanup();
private slots:
void handleWindowChanged(QQuickWindow *win);
private:
- QOpenGLShaderProgram *m_program;
-
qreal m_t;
- qreal m_thread_t;
+ SquircleRenderer *m_renderer;
};
-//! [1]
+//! [2]
#endif // SQUIRCLE_H