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

Preserve the configured path line style when no style is provided in the data

This commit is contained in:
Martin Tůma 2022-10-07 21:54:39 +02:00
parent 20f4f72999
commit 26d2bc4f5d
4 changed files with 11 additions and 7 deletions

View File

@ -200,7 +200,8 @@ void PathItem::updateWidth()
Qt::PenStyle PathItem::penStyle() const
{
return _useStyle ? Qt::SolidLine : _penStyle;
return (_useStyle && _path.style().style() != Qt::NoPen)
? _path.style().style() : _penStyle;
}
void PathItem::setPenStyle(Qt::PenStyle style)

View File

@ -74,7 +74,7 @@ static void setTrackProperties(TrackData &track, const QJsonValue &properties)
width = o["stroke-width"].toDouble();
}
track.setStyle(LineStyle(color, width));
track.setStyle(LineStyle(color, width, Qt::SolidLine));
}
static void setWaypointProperties(Waypoint &waypoint,

View File

@ -691,7 +691,7 @@ void KMLParser::placemark(const Ctx &ctx, QList<TrackData> &tracks,
t.setName(name);
t.setDescription(desc);
t.setStyle(lit == lineStyles.end()
? LineStyle(QColor(0x55, 0x55, 0x55), 2) : *lit);
? LineStyle(QColor(0x55, 0x55, 0x55), 2, Qt::SolidLine) : *lit);
}
for (int i = areaIdx; i < areas.size(); i++) {
Area &a = areas[i];
@ -790,7 +790,7 @@ void KMLParser::lineStyle(const QString &id, LineStyleMap &styles)
_reader.skipCurrentElement();
}
styles.insert(id, LineStyle(c, width));
styles.insert(id, LineStyle(c, width, Qt::SolidLine));
}
void KMLParser::styleMapPair(const QString &id, QMap<QString, QString> &map)

View File

@ -44,16 +44,19 @@ private:
class LineStyle {
public:
LineStyle() : _width(-1) {}
LineStyle(const QColor &color, qreal width = -1)
: _color(color), _width(width) {}
LineStyle() : _width(-1), _style(Qt::NoPen) {}
LineStyle(const QColor &color, qreal width = -1,
Qt::PenStyle style = Qt::NoPen)
: _color(color), _width(width), _style(style) {}
const QColor &color() const {return _color;}
qreal width() const {return _width;}
Qt::PenStyle style() const {return _style;}
private:
QColor _color;
qreal _width;
Qt::PenStyle _style;
};
#endif // STYLE_H