Commit ebeb1bb3 authored by Jan Möbius's avatar Jan Möbius

- Remove QT4 ifdefs from interfaces

refs #141
parent c1696b74
......@@ -81,37 +81,26 @@ QtGLGraphicsScene::QtGLGraphicsScene(QtBaseViewer* _w) :
void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
{
// Check for switch in qt4.6 to OpenGL2
#if QT_VERSION >= 0x040600
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL && _painter->paintEngine()->type() != QPaintEngine::OpenGL2 ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#else
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#endif
// Initialize background first
_painter->setBackground(QApplication::palette().window());
_painter->eraseRect(_rect);
// From now on we do OpenGL direct painting on the scene
#if QT_VERSION >= 0x040600
// Tell Qt that we directly use OpenGL
_painter->beginNativePainting();
#endif
// Clear the depth buffer (This is required since QT4.6 Otherwise we get an emtpty scene!
glClear(GL_DEPTH_BUFFER_BIT);
w_->paintGL();
#if QT_VERSION >= 0x040600
// The rest is painting through QT again.
_painter->endNativePainting();
#endif
}
......
......@@ -466,17 +466,6 @@ updateVBO() {
#ifdef WIN32
metricWidth += leftBearing + rightBearing;
#elif QT_VERSION < 0x050000
// QFontMetrics does not seem to always give the correct width
// therefore we add a margin so that characters are not cut off
if (leftBearing + rightBearing < 0.1*maxFontWidth_) {
if (metricWidth + 0.25*maxFontWidth_ < maxFontWidth_)
metricWidth += 0.25*maxFontWidth_;
else
metricWidth = maxFontWidth_;
} else {
metricWidth += leftBearing + rightBearing;
}
#endif
float widthTx = (float) metricWidth / (float) imageWidth_;
......
......@@ -50,11 +50,8 @@
#include "ui_aboutWidget.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
class AboutWidget : public QMainWindow, public Ui::AboutWidget
......
......@@ -57,14 +57,7 @@
#include "ui_addEmpty.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
class addEmptyWidget : public QDialog, public Ui::addEmpty
{
......
......@@ -91,11 +91,8 @@
#include <QImageWriter>
#if QT_VERSION < 0x050000
#include <QGLFramebufferObject>
#else
#include <QOpenGLFramebufferObject>
#endif
#ifdef max
# undef max
......
......@@ -111,13 +111,10 @@ class QtShiftPopupMenu;
class CursorPainter;
class PostProcessing;
#if QT_VERSION < 0x050000
class QGLFramebufferObject;
class QGLFramebufferObjectFormat;
#else
class QOpenGLFramebufferObject;
class QOpenGLFramebufferObjectFormat;
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
class QOpenGLDebugLogger;
......@@ -881,13 +878,10 @@ private:
private:
#if QT_VERSION < 0x050000
typedef QGLFramebufferObjectFormat QFramebufferObjectFormat;
typedef QGLFramebufferObject QFramebufferObject;
#else
typedef QOpenGLFramebufferObjectFormat QFramebufferObjectFormat;
typedef QOpenGLFramebufferObject QFramebufferObject;
#endif
/// Framebuffer object that holds the pick cache
QFramebufferObject* pickCache_;
......
......@@ -65,11 +65,9 @@
#include "OpenFlipper/common/GlobalOptions.hh"
#if QT_VERSION < 0x050000
#include <QGLFramebufferObject>
#else
#include <QOpenGLFramebufferObject>
#endif
//== NAMESPACES ===============================================================
......
......@@ -86,17 +86,10 @@ QtGLGraphicsScene::QtGLGraphicsScene(std::vector< glViewer *> *_views,
void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
{
// Check for switch in qt4.6 to OpenGL2
#if QT_VERSION >= 0x040600
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL && _painter->paintEngine()->type() != QPaintEngine::OpenGL2 ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#else
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#endif
// Initialize background first
_painter->setBackground(QApplication::palette().window());
......@@ -107,10 +100,8 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
_painter->eraseRect(_rect);
// From now on we do OpenGL direct painting on the scene
#if QT_VERSION >= 0x040600
// Tell Qt that we directly use OpenGL
_painter->beginNativePainting();
#endif
static bool initialized = false;
if (!initialized)
......@@ -163,10 +154,8 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
views_->at(i)->paintGL();
}
#if QT_VERSION >= 0x040600
// The rest is painting through QT again.
_painter->endNativePainting();
#endif
// Draw red box around active examiner
if (layout_->mode() != QtMultiViewLayout::SingleView)
......
......@@ -87,17 +87,10 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
{
// Check for switch in qt4.6 to OpenGL2
#if QT_VERSION >= 0x040600
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL && _painter->paintEngine()->type() != QPaintEngine::OpenGL2 ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#else
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#endif
// Initialize background first
_painter->setBackground(QApplication::palette().window());
......@@ -107,10 +100,8 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
return;
// From now on we do OpenGL direct painting on the scene
#if QT_VERSION >= 0x040600
// Tell Qt that we directly use OpenGL
_painter->beginNativePainting();
#endif
if (!initialized_)
{
......@@ -149,10 +140,8 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
view_->paintGL();
#if QT_VERSION >= 0x040600
// The rest is painting through QT again.
_painter->endNativePainting();
#endif
}
......
......@@ -49,11 +49,8 @@
\*===========================================================================*/
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
#include "TextBrowserWidget.hh"
......
......@@ -48,12 +48,7 @@
\*===========================================================================*/
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
#include "renderObjectHighLighter.hh"
......
......@@ -49,11 +49,7 @@
#include "rendererObjectWidget.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
......
......@@ -49,11 +49,8 @@
#include "rendererWidget.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
......
......@@ -49,11 +49,7 @@
#include "ui_SnapshotDialog.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
class SnapshotDialog : public QDialog, public Ui::SnapshotDialog
{
......
......@@ -57,11 +57,8 @@
#include "ui_stereoSettingsWidget.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
class StereoSettingsWidget : public QWidget, public Ui::StereoSettingsWidget
......
......@@ -49,11 +49,8 @@
#include "ui_VideoCaptureDialog.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
class VideoCaptureDialog : public QDialog, public Ui::VideoCaptureDialog
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment