aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/src-glwidgets
diff options
context:
space:
mode:
authorZackaryWelch <welch.zackary@gmail.com>2017-10-03 15:24:26 -0400
committerZackaryWelch <welch.zackary@gmail.com>2017-10-03 15:24:26 -0400
commit711b219a001d0c4fdd61367903696fa1c6ff1a3d (patch)
tree2682e737fb6e90adcb0f9e465d3cfe2ad2b51c09 /src-qt5/src-glwidgets
parentAdjust the border on the simple scrollbar style, and update the pkg-plist. (diff)
downloadlumina-711b219a001d0c4fdd61367903696fa1c6ff1a3d.tar.gz
lumina-711b219a001d0c4fdd61367903696fa1c6ff1a3d.tar.bz2
lumina-711b219a001d0c4fdd61367903696fa1c6ff1a3d.zip
Added experimental video thumbnails in lumina-fm and fileinfo
Diffstat (limited to 'src-qt5/src-glwidgets')
-rw-r--r--src-qt5/src-glwidgets/gltest/colorchange.h11
-rw-r--r--src-qt5/src-glwidgets/gltest/main.cpp13
-rwxr-xr-xsrc-qt5/src-glwidgets/gltest/testbin59456 -> 58272 bytes
-rw-r--r--src-qt5/src-glwidgets/glw-base.cpp21
4 files changed, 27 insertions, 18 deletions
diff --git a/src-qt5/src-glwidgets/gltest/colorchange.h b/src-qt5/src-glwidgets/gltest/colorchange.h
index d62fcd5c..aad01f05 100644
--- a/src-qt5/src-glwidgets/gltest/colorchange.h
+++ b/src-qt5/src-glwidgets/gltest/colorchange.h
@@ -13,14 +13,9 @@ private:
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++;
+ static bool current = false;
+ base->setBackgroundColor( current ? QColor(Qt::blue) : QColor(Qt::red));
+ current = !current;
}
public:
diff --git a/src-qt5/src-glwidgets/gltest/main.cpp b/src-qt5/src-glwidgets/gltest/main.cpp
index b303cb6b..efcebea1 100644
--- a/src-qt5/src-glwidgets/gltest/main.cpp
+++ b/src-qt5/src-glwidgets/gltest/main.cpp
@@ -10,14 +10,14 @@
int main(int argc, char** argv){
- QSurfaceFormat fmt;
+ QSurfaceFormat fmt;
fmt.setRenderableType(QSurfaceFormat::OpenGL); //OpenGL, OpenGLES, OpenVG
fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
- QSurfaceFormat::setDefaultFormat(fmt);
+ QSurfaceFormat::setDefaultFormat(fmt);
QApplication A(argc,argv);
- qDebug() << "Creating base widget";
+ qDebug() << "Creating base widget";
GLW_Base base;
qDebug() << "Resize base widget";
base.resize(1024,768);
@@ -29,7 +29,7 @@ int main(int argc, char** argv){
GLW_Widget wgt(&base);
wgt.setGLBase(&base);
wgt.setGeometry(75,50,50,50);
- QPropertyAnimation anim(&wgt);
+ QPropertyAnimation anim(&wgt);
anim.setTargetObject(&wgt);
anim.setPropertyName("geometry");
//anim.setStartValue(QRect(-50,-50,50,50));
@@ -46,6 +46,7 @@ int main(int argc, char** argv){
colorchange CC(&base);
qDebug() << "Start Event loop";
base.show();
- A.exec();
- qDebug() << " - Finished";
+ int ret = A.exec();
+ qDebug() << " - Finished";
+ return ret;
}
diff --git a/src-qt5/src-glwidgets/gltest/test b/src-qt5/src-glwidgets/gltest/test
index 85760654..3ba6f8db 100755
--- a/src-qt5/src-glwidgets/gltest/test
+++ b/src-qt5/src-glwidgets/gltest/test
Binary files differ
diff --git a/src-qt5/src-glwidgets/glw-base.cpp b/src-qt5/src-glwidgets/glw-base.cpp
index ef54606b..4065f70f 100644
--- a/src-qt5/src-glwidgets/glw-base.cpp
+++ b/src-qt5/src-glwidgets/glw-base.cpp
@@ -67,7 +67,24 @@ void GLW_Base::resizeEvent(QResizeEvent *ev){
}*/
void GLW_Base::paintGL(){
+
//Setup the OpenGL stuff
+ QOpenGLFunctions *f = this->context()->functions();
+ f->glViewport(0, 0, width(), height());
+ f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ GLfloat vertices[] = {
+ 0.0f, 0.707f,
+ -0.5f, -0.5f,
+ 0.5f, -0.5f
+ };
+
+ f->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, vertices);
+ f->glEnableVertexAttribArray(0);
+ f->glDrawArrays(GL_TRIANGLES, 0, 3);
+ f->glDisableVertexAttribArray(0);
+ glDrawPixels(bg_img.width(), bg_img.height(), GL_RGBA, GL_UNSIGNED_BYTE, bg_img.bits());
+
QRect rect = QRect(QPoint(0,0), this->size());
//Prepare the image to be painted
QImage img(this->size(), QImage::Format_RGBA8888);
@@ -75,10 +92,6 @@ void GLW_Base::paintGL(){
painter.begin(&img);
painter.fillRect(rect, bg_color);
painter.end();
- QOpenGLFunctions *f = this->context()->functions();
- //f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- //do native OpenGL commands here
- glDrawPixels(bg_img.width(), bg_img.height(), GL_RGBA, GL_UNSIGNED_BYTE, bg_img.bits());
//Now do any QPainter drawing
/*QOpenGLPaintDevice device(rect.size());
bgstack15