Introduce a USE_QOPENGLWIDGET define, added qopenglwidget CONFIG to qmake

This commit is contained in:
Marius Kintel 2015-12-02 13:24:18 -05:00
parent 510daf3636
commit 4af8cc7525
3 changed files with 13 additions and 7 deletions

View file

@ -118,6 +118,12 @@ mingw* {
CONFIG += qt
QT += opengl concurrent
qopenglwidget {
!lessThan(QT_VERSION, 5.4) {
DEFINES += USE_QOPENGLWIDGET
}
}
# see http://fedoraproject.org/wiki/UnderstandingDSOLinkChange
# and https://github.com/openscad/openscad/pull/119
# ( QT += opengl does not automatically link glu on some DSO systems. )

View file

@ -51,7 +51,7 @@
#endif
QGLView::QGLView(QWidget *parent) :
#if QT_VERSION >= 0x050400
#if QT_VERSION >= 0x050400 && defined(USE_QOPENGLWIDGET)
QOpenGLWidget(parent)
#else
QGLWidget(parent)
@ -60,7 +60,7 @@ QGLView::QGLView(QWidget *parent) :
init();
}
#if !(QT_VERSION >= 0x050400)
#ifdef _WIN32
static bool running_under_wine = false;
#endif
@ -166,7 +166,7 @@ void QGLView::paintGL()
statusLabel->setText(QString::fromStdString(nc.statusText()));
}
#if !(QT_VERSION >= 0x050400)
#ifdef _WIN32
if (running_under_wine) swapBuffers();
#endif
}

View file

@ -3,7 +3,7 @@
#include "system-gl.h"
#include <QtGlobal>
#if QT_VERSION >= 0x050400
#ifdef USE_QOPENGLWIDGET
#include <QOpenGLWidget>
#else
#include <QGLWidget>
@ -16,7 +16,7 @@
#include "renderer.h"
class QGLView :
#if QT_VERSION >= 0x050400
#ifdef USE_QOPENGLWIDGET
public QOpenGLWidget,
#else
public QGLWidget,
@ -62,13 +62,13 @@ public:
public slots:
void ZoomIn(void);
void ZoomOut(void);
#if QT_VERSION >= 0x050400
#ifdef USE_QOPENGLWIDGET
inline void updateGL() { update(); }
#endif
public:
QLabel *statusLabel;
#if QT_VERSION >= 0x050400
#ifdef USE_QOPENGLWIDGET
inline QImage grabFrameBuffer() { return grabFramebuffer(); }
#endif
private: