From bf7e372df336263ccdc9d0ab22554fb1ff6f629a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 26 Sep 2017 13:42:19 -0400 Subject: Add a bunch of new files specifically for providing a new OpenGL-backed basis for doing visuals within Qt/Lumina. --- src-qt5/src-glwidgets/gltest/colorchange.h | 35 +++++++++++++++++++++++++++++ src-qt5/src-glwidgets/gltest/main.cpp | 26 +++++++++++++++++++++ src-qt5/src-glwidgets/gltest/test | Bin 0 -> 50927 bytes src-qt5/src-glwidgets/gltest/test.pro | 9 ++++++++ 4 files changed, 70 insertions(+) create mode 100644 src-qt5/src-glwidgets/gltest/colorchange.h create mode 100644 src-qt5/src-glwidgets/gltest/main.cpp create mode 100755 src-qt5/src-glwidgets/gltest/test create mode 100644 src-qt5/src-glwidgets/gltest/test.pro (limited to 'src-qt5/src-glwidgets/gltest') diff --git a/src-qt5/src-glwidgets/gltest/colorchange.h b/src-qt5/src-glwidgets/gltest/colorchange.h new file mode 100644 index 00000000..d62fcd5c --- /dev/null +++ b/src-qt5/src-glwidgets/gltest/colorchange.h @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +#include "../glw-base.h" + +class colorchange : public QObject{ + Q_OBJECT +private: + GLW_Base *base; + QTimer *timer; + +public slots: + void toggle(){ + static int current = 0; + if(current==0){ + base->setBackgroundColor(QColor(Qt::red)); + }else{ + base->setBackgroundColor(QColor(Qt::blue)); + current = -1; + } + current++; + } + +public: + colorchange(GLW_Base *parent) : QObject(){ + base = parent; + timer = new QTimer(this); + timer->setInterval(5000); + connect(timer, SIGNAL(timeout()), this, SLOT(toggle()) ); + timer->start(); + } + +}; diff --git a/src-qt5/src-glwidgets/gltest/main.cpp b/src-qt5/src-glwidgets/gltest/main.cpp new file mode 100644 index 00000000..041ee5ff --- /dev/null +++ b/src-qt5/src-glwidgets/gltest/main.cpp @@ -0,0 +1,26 @@ +#include +#include +#include +#include + +#include "../glw-base.h" +#include "../glw-widget.h" + +#include "colorchange.h" + +int main(int argc, char** argv){ + QApplication A(argc,argv); + qDebug() << "Creating base widget"; + GLW_Base base; + qDebug() << "Resize base widget"; + base.resize(200,200); + qDebug() << "Create colorchange"; + GLW_Widget wgt(&base); + wgt.setGLBase(&base); + wgt.setGeometry(50,50,50,50); + colorchange CC(&base); + qDebug() << "Start Event loop"; + base.show(); + A.exec(); + qDebug() << " - Finished"; +} diff --git a/src-qt5/src-glwidgets/gltest/test b/src-qt5/src-glwidgets/gltest/test new file mode 100755 index 00000000..5a69b0c3 Binary files /dev/null and b/src-qt5/src-glwidgets/gltest/test differ diff --git a/src-qt5/src-glwidgets/gltest/test.pro b/src-qt5/src-glwidgets/gltest/test.pro new file mode 100644 index 00000000..cba315c3 --- /dev/null +++ b/src-qt5/src-glwidgets/gltest/test.pro @@ -0,0 +1,9 @@ +QT = core gui widgets + +TARGET = test + +SOURCES += main.cpp + +HEADERS += colorchange.h + +include(../glwidgets.pri); -- cgit