1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Fixed PDF output on QT4

This commit is contained in:
Martin Tůma 2016-09-25 18:08:39 +02:00
parent 1a07360d91
commit 1634b0715c
4 changed files with 14 additions and 2 deletions

View File

@ -5,6 +5,7 @@
#include "axisitem.h"
#define AXIS_WIDTH 1
#define TICK 6
#define PADDING 6
#define XTICKS 15
@ -114,9 +115,11 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
struct Label l;
qreal range = _range.size();
qreal val;
QPen pen = QPen(Qt::black, AXIS_WIDTH);
painter->setFont(font);
painter->setPen(pen);
ls = fm.tightBoundingRect(_label);

View File

@ -51,7 +51,7 @@ GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent)
_id = 0;
_type = Distance;
_pen.setWidth(GRAPH_WIDTH);
_pen = QPen(Qt::black, GRAPH_WIDTH);
_pen.setCosmetic(true);
_distancePath.moveTo(graph.first().s(), -graph.first().y());
@ -81,6 +81,12 @@ void GraphItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
*/
}
void GraphItem::setGraphType(GraphType type)
{
prepareGeometryChange();
_type = type;
}
void GraphItem::setColor(const QColor &color)
{
_pen.setColor(color);

View File

@ -18,7 +18,7 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
void setGraphType(GraphType type) {_type = type;}
void setGraphType(GraphType type);
int id() const {return _id;}
void setId(int id) {_id = id;}
void setColor(const QColor &color);

View File

@ -5,6 +5,7 @@
#include "scaleitem.h"
#define BORDER_WIDTH 1
#define SCALE_WIDTH 132
#define SCALE_HEIGHT 5
#define SEGMENTS 3
@ -50,6 +51,7 @@ void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
font.setFamily(FONT_FAMILY);
QFontMetrics fm(font);
QRect br;
QPen pen = QPen(Qt::black, BORDER_WIDTH);
bool aa;
@ -57,6 +59,7 @@ void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setFont(font);
painter->setPen(pen);
for (int i = 0; i <= SEGMENTS; i++) {
QString label = QString::number(_length * i);