mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 03:42:09 +01:00
Some more performance improvement magic
This commit is contained in:
parent
6034685fa0
commit
b369ffacef
@ -18,6 +18,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
#include <QPixmapCache>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
@ -90,6 +91,8 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
_exportOrientation = QPrinter::Portrait;
|
_exportOrientation = QPrinter::Portrait;
|
||||||
_exportFileName = QString("%1/export.pdf").arg(QDir::currentPath());
|
_exportFileName = QString("%1/export.pdf").arg(QDir::currentPath());
|
||||||
_exportMargins = MarginsF(5.0, 5.0, 5.0, 5.0);
|
_exportMargins = MarginsF(5.0, 5.0, 5.0, 5.0);
|
||||||
|
|
||||||
|
QPixmapCache::setCacheLimit(65536);
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI::~GUI()
|
GUI::~GUI()
|
||||||
|
@ -26,6 +26,11 @@ void RouteItem::updateShape()
|
|||||||
QPainterPathStroker s;
|
QPainterPathStroker s;
|
||||||
s.setWidth(HOVER_WIDTH * 1.0/scale());
|
s.setWidth(HOVER_WIDTH * 1.0/scale());
|
||||||
_shape = s.createStroke(_path);
|
_shape = s.createStroke(_path);
|
||||||
|
|
||||||
|
if (qMax(boundingRect().width(), boundingRect().height()) * scale() <= 768)
|
||||||
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
else
|
||||||
|
setCacheMode(QGraphicsItem::NoCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
|
RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
|
||||||
@ -53,7 +58,6 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
|
|||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
|
||||||
|
|
||||||
updateShape();
|
updateShape();
|
||||||
|
|
||||||
@ -74,8 +78,7 @@ void RouteItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
painter->drawPath(_path);
|
painter->drawPath(_path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QPen p = QPen(Qt::red);
|
QPen p = QPen(QBrush(Qt::red), 0);
|
||||||
p.setWidthF(1.0/scale());
|
|
||||||
painter->setPen(p);
|
painter->setPen(p);
|
||||||
painter->drawRect(boundingRect());
|
painter->drawRect(boundingRect());
|
||||||
*/
|
*/
|
||||||
|
@ -30,6 +30,11 @@ void TrackItem::updateShape()
|
|||||||
QPainterPathStroker s;
|
QPainterPathStroker s;
|
||||||
s.setWidth(HOVER_WIDTH * 1.0/scale());
|
s.setWidth(HOVER_WIDTH * 1.0/scale());
|
||||||
_shape = s.createStroke(_path);
|
_shape = s.createStroke(_path);
|
||||||
|
|
||||||
|
if (qMax(boundingRect().width(), boundingRect().height()) * scale() <= 768)
|
||||||
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
else
|
||||||
|
setCacheMode(QGraphicsItem::NoCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
||||||
@ -53,7 +58,6 @@ TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
|||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
|
||||||
|
|
||||||
updateShape();
|
updateShape();
|
||||||
|
|
||||||
@ -74,10 +78,8 @@ void TrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
painter->drawPath(_path);
|
painter->drawPath(_path);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QPen p = QPen(Qt::red);
|
QPen p = QPen(QBrush(Qt::red), 0);
|
||||||
p.setWidthF(1.0/scale());
|
|
||||||
painter->setPen(p);
|
painter->setPen(p);
|
||||||
painter->setBrush(Qt::NoBrush);
|
|
||||||
painter->drawRect(boundingRect());
|
painter->drawRect(boundingRect());
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user