mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Preserve the configured path line style when no style is provided in the data
This commit is contained in:
parent
20f4f72999
commit
26d2bc4f5d
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user