Port lance manual test to qopengl

Task-number: QTBUG-74408
Change-Id: I5e112a2024aebee4be740e770ea0fb4e5b2a9daa
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2020-02-19 11:12:44 +01:00
parent e3f2e7afbb
commit e0fb295aad
3 changed files with 18 additions and 17 deletions

View File

@ -171,4 +171,5 @@ add_qt_resource(lance "images"
extend_target(lance CONDITION TARGET Qt::OpenGL extend_target(lance CONDITION TARGET Qt::OpenGL
PUBLIC_LIBRARIES PUBLIC_LIBRARIES
Qt::OpenGL Qt::OpenGL
Qt::OpenGLWidgets
) )

View File

@ -2,7 +2,7 @@ LANCELOT_DIR = $$PWD/../../auto/other/lancelot
CONFIG += cmdline moc CONFIG += cmdline moc
TEMPLATE = app TEMPLATE = app
INCLUDEPATH += . $$LANCELOT_DIR INCLUDEPATH += . $$LANCELOT_DIR
QT += core-private gui-private widgets printsupport QT += core-private gui-private widgets printsupport openglwidgets
HEADERS += widgets.h \ HEADERS += widgets.h \
interactivewidget.h \ interactivewidget.h \

View File

@ -42,8 +42,9 @@
#endif #endif
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
#include <qgl.h> #include <QtOpenGL/QOpenGLFramebufferObjectFormat>
#include <QGLPixelBuffer> #include <QtOpenGL/QOpenGLPaintDevice>
#include <QtOpenGLWidgets/QOpenGLWidget>
#endif #endif
// #define DO_QWS_DEBUGGING // #define DO_QWS_DEBUGGING
@ -89,7 +90,7 @@ static void printHelp()
" -imagemono Paints the files to a monochrome image\n" " -imagemono Paints the files to a monochrome image\n"
" -imagewidget same as image, but with interacion...\n" " -imagewidget same as image, but with interacion...\n"
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
" -opengl Paints the files to a QGLWidget (Qt4 style) on screen\n" " -opengl Paints the files to a QOpenGLWidget on screen\n"
" -glbuffer Paints the files to a QOpenGLFrameBufferObject (Qt5 style) \n" " -glbuffer Paints the files to a QOpenGLFrameBufferObject (Qt5 style) \n"
" -coreglbuffer Paints the files to a Core Profile context QOpenGLFrameBufferObject\n" " -coreglbuffer Paints the files to a Core Profile context QOpenGLFrameBufferObject\n"
#endif #endif
@ -233,12 +234,11 @@ int main(int argc, char **argv)
bool verboseMode = false; bool verboseMode = false;
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
QGLFormat f = QGLFormat::defaultFormat(); QSurfaceFormat f = QSurfaceFormat::defaultFormat();
f.setSampleBuffers(true); f.setSamples(1);
f.setStencil(true); f.setStencilBufferSize(8);
f.setAlpha(true);
f.setAlphaBufferSize(8); f.setAlphaBufferSize(8);
QGLFormat::setDefaultFormat(f); QSurfaceFormat::setDefaultFormat(f);
#endif #endif
char *arg; char *arg;
@ -447,14 +447,14 @@ int main(int argc, char **argv)
} }
case OpenGLType: case OpenGLType:
{ {
OnScreenWidget<QGLWidget> *qGLWidget = new OnScreenWidget<QGLWidget>(files.at(j)); OnScreenWidget<QOpenGLWidget> *qOpenGLWidget = new OnScreenWidget<QOpenGLWidget>(files.at(j));
qGLWidget->setVerboseMode(verboseMode); qOpenGLWidget->setVerboseMode(verboseMode);
qGLWidget->setType(type); qOpenGLWidget->setType(type);
qGLWidget->setCheckersBackground(checkers_background); qOpenGLWidget->setCheckersBackground(checkers_background);
qGLWidget->m_commands = content; qOpenGLWidget->m_commands = content;
qGLWidget->resize(width, height); qOpenGLWidget->resize(width, height);
qGLWidget->show(); qOpenGLWidget->show();
activeWidget = qGLWidget; activeWidget = qOpenGLWidget;
break; break;
} }
#else #else