mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Use OpenGL also for graph views when selected
This commit is contained in:
parent
da1b2bb90a
commit
b24136a580
@ -3,6 +3,12 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QPaintEngine>
|
||||
#include <QPaintDevice>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
#include <QGLWidget>
|
||||
#else // QT 5
|
||||
#include <QOpenGLWidget>
|
||||
#endif // QT 5
|
||||
#include <QSysInfo>
|
||||
#include "config.h"
|
||||
#include "axisitem.h"
|
||||
#include "slideritem.h"
|
||||
@ -23,6 +29,8 @@ GraphView::GraphView(QWidget *parent)
|
||||
_scene = new QGraphicsScene();
|
||||
setScene(_scene);
|
||||
|
||||
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
setRenderHint(QPainter::Antialiasing, true);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
@ -451,3 +459,18 @@ void GraphView::setGraphWidth(int width)
|
||||
for (int i = 0; i < _graphs.count(); i++)
|
||||
_graphs.at(i)->setWidth(width);
|
||||
}
|
||||
|
||||
void GraphView::useOpenGL(bool use)
|
||||
{
|
||||
if (use) {
|
||||
#ifdef Q_OS_WIN32
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
|
||||
#endif // Q_OS_WIN32
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
setViewport(new QGLWidget);
|
||||
#else // QT 5
|
||||
setViewport(new QOpenGLWidget);
|
||||
#endif // QT 5
|
||||
} else
|
||||
setViewport(new QWidget);
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ public:
|
||||
|
||||
void plot(QPainter *painter, const QRectF &target);
|
||||
|
||||
void useOpenGL(bool use);
|
||||
|
||||
signals:
|
||||
void sliderPositionChanged(qreal);
|
||||
|
||||
|
@ -774,8 +774,11 @@ void GUI::openOptions()
|
||||
if (options.poiRadius != _options.poiRadius)
|
||||
_poi->setRadius(options.poiRadius);
|
||||
|
||||
if (options.useOpenGL != _options.useOpenGL)
|
||||
if (options.useOpenGL != _options.useOpenGL) {
|
||||
_pathView->useOpenGL(options.useOpenGL);
|
||||
for (int i = 0; i < _tabs.count(); i++)
|
||||
_tabs.at(i)->useOpenGL(options.useOpenGL);
|
||||
}
|
||||
|
||||
_options = options;
|
||||
}
|
||||
@ -1541,6 +1544,8 @@ void GUI::readSettings()
|
||||
_tabs.at(i)->setGraphWidth(_options.graphWidth);
|
||||
_tabs.at(i)->setRenderHint(QPainter::Antialiasing,
|
||||
_options.graphAntiAliasing);
|
||||
if (_options.useOpenGL)
|
||||
_tabs.at(i)->useOpenGL(true);
|
||||
}
|
||||
|
||||
_poi->setRadius(_options.poiRadius);
|
||||
|
@ -7,7 +7,9 @@
|
||||
|
||||
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
{
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
#endif // Q_OS_MAC
|
||||
}
|
||||
|
||||
void InfoItem::updateBoundingRect()
|
||||
|
Loading…
Reference in New Issue
Block a user