mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
OpenGL code cleanup
This commit is contained in:
parent
0448ae5eea
commit
b68ca92add
@ -5,7 +5,8 @@ QT += core \
|
||||
network
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
|
||||
lessThan(QT_VERSION, 5.4) : QT += opengl
|
||||
lessThan(QT_VERSION, 5.4): QT += opengl
|
||||
macx: QT += opengl
|
||||
HEADERS += src/config.h \
|
||||
src/icons.h \
|
||||
src/gui.h \
|
||||
@ -74,7 +75,8 @@ HEADERS += src/config.h \
|
||||
src/nmeaparser.h \
|
||||
src/optionsdialog.h \
|
||||
src/colorbox.h \
|
||||
src/stylecombobox.h
|
||||
src/stylecombobox.h \
|
||||
src/opengl.h
|
||||
SOURCES += src/main.cpp \
|
||||
src/gui.cpp \
|
||||
src/poi.cpp \
|
||||
|
18
src/app.cpp
18
src/app.cpp
@ -4,11 +4,7 @@
|
||||
#include <QFileOpenEvent>
|
||||
#include <QNetworkProxyFactory>
|
||||
#include <QPixmapCache>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
|
||||
#include <QGLFormat>
|
||||
#else // QT 5.4
|
||||
#include <QSurfaceFormat>
|
||||
#endif // QT 5.4
|
||||
#include "opengl.h"
|
||||
#include "gui.h"
|
||||
#include "app.h"
|
||||
|
||||
@ -26,18 +22,8 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
|
||||
QGLFormat fmt;
|
||||
fmt.setSamples(4);
|
||||
QGLFormat::setDefaultFormat(fmt);
|
||||
#else // QT 5.4
|
||||
QSurfaceFormat fmt;
|
||||
fmt.setSamples(4);
|
||||
QSurfaceFormat::setDefaultFormat(fmt);
|
||||
#endif // QT 5.4
|
||||
|
||||
QPixmapCache::setCacheLimit(65536);
|
||||
OPENGL_SET_SAMPLES(4);
|
||||
|
||||
_gui = new GUI();
|
||||
}
|
||||
|
@ -3,12 +3,8 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QPaintEngine>
|
||||
#include <QPaintDevice>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
|
||||
#include <QGLWidget>
|
||||
#else // QT 5.4
|
||||
#include <QOpenGLWidget>
|
||||
#endif // QT 5.4
|
||||
#include <QSysInfo>
|
||||
#include "opengl.h"
|
||||
#include "config.h"
|
||||
#include "axisitem.h"
|
||||
#include "slideritem.h"
|
||||
@ -466,11 +462,7 @@ void GraphView::useOpenGL(bool use)
|
||||
#ifdef Q_OS_WIN32
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
|
||||
#endif // Q_OS_WIN32
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
|
||||
setViewport(new QGLWidget);
|
||||
#else // QT 5.4
|
||||
setViewport(new QOpenGLWidget);
|
||||
#endif // QT 5.4
|
||||
setViewport(new OPENGL_WIDGET);
|
||||
} else
|
||||
setViewport(new QWidget);
|
||||
}
|
||||
|
26
src/opengl.h
Normal file
26
src/opengl.h
Normal file
@ -0,0 +1,26 @@
|
||||
#include <QtGlobal>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
|
||||
#include <QGLWidget>
|
||||
#include <QGLFormat>
|
||||
#else
|
||||
#include <QOpenGLWidget>
|
||||
#include <QSurfaceFormat>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
|
||||
#define OPENGL_WIDGET QGLWidget
|
||||
#else
|
||||
#define OPENGL_WIDGET QOpenGLWidget
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) || defined(Q_OS_MAC)
|
||||
#define OPENGL_SET_SAMPLES(samples) \
|
||||
{QGLFormat fmt; \
|
||||
fmt.setSamples(samples); \
|
||||
QGLFormat::setDefaultFormat(fmt);}
|
||||
#else
|
||||
#define OPENGL_SET_SAMPLES(samples) \
|
||||
{QSurfaceFormat fmt; \
|
||||
fmt.setSamples(samples);\
|
||||
QSurfaceFormat::setDefaultFormat(fmt);}
|
||||
#endif
|
@ -185,16 +185,12 @@ QWidget *OptionsDialog::createExportPage()
|
||||
QWidget *OptionsDialog::createSystemPage()
|
||||
{
|
||||
_useOpenGL = new QCheckBox(tr("Use OpenGL"));
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
|
||||
#ifdef Q_OS_WIN32
|
||||
if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
|
||||
#endif // Q_OS_WIN32
|
||||
_useOpenGL->setChecked(false);
|
||||
_useOpenGL->setEnabled(false);
|
||||
#ifdef Q_OS_WIN32
|
||||
} else
|
||||
#endif // Q_OS_WIN32
|
||||
#endif // Q_OS_WIN32 || Q_OS_MAC
|
||||
_useOpenGL->setChecked(_options->useOpenGL);
|
||||
|
||||
QFormLayout *systemLayout = new QFormLayout();
|
||||
|
@ -1,12 +1,8 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
#include <QWheelEvent>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
|
||||
#include <QGLWidget>
|
||||
#else // QT 5.4
|
||||
#include <QOpenGLWidget>
|
||||
#endif // QT 5.4
|
||||
#include <QSysInfo>
|
||||
#include "opengl.h"
|
||||
#include "rd.h"
|
||||
#include "poi.h"
|
||||
#include "data.h"
|
||||
@ -716,11 +712,7 @@ void PathView::useOpenGL(bool use)
|
||||
#ifdef Q_OS_WIN32
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
|
||||
#endif // Q_OS_WIN32
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
|
||||
setViewport(new QGLWidget);
|
||||
#else // QT 5.4
|
||||
setViewport(new QOpenGLWidget);
|
||||
#endif // QT 5.4
|
||||
setViewport(new OPENGL_WIDGET);
|
||||
} else
|
||||
setViewport(new QWidget);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user