Commit 5bc904d4 authored by Volker Krause's avatar Volker Krause

Allow QML to check if we have a line color set

parent 153b9116
......@@ -88,6 +88,11 @@ void Line::setColor(const QColor &color)
d->color = color;
}
bool Line::hasColor() const
{
return d->color.isValid();
}
QColor Line::textColor() const
{
return d->textColor;
......@@ -99,6 +104,11 @@ void Line::setTextColor(const QColor &textColor)
d->textColor = textColor;
}
bool Line::hasTextColor() const
{
return d->textColor.isValid();
}
Line::Mode Line::mode() const
{
return d->mode;
......
......@@ -32,8 +32,12 @@ class Line
Q_PROPERTY(QString name READ name WRITE setName)
/** Color of the line. */
Q_PROPERTY(QColor color READ color WRITE setColor)
/** @c true if a line color is set. */
Q_PROPERTY(bool hasColor READ hasColor STORED false)
/** Text color to use on top of the line color. */
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
/** @c true if a text color is set. */
Q_PROPERTY(bool hasTextColor READ hasTextColor STORED false)
/** Type of transport. */
Q_PROPERTY(Mode mode READ mode WRITE setMode)
/** Human readable representation of the type of transport.
......@@ -47,8 +51,10 @@ public:
void setName(const QString &name);
QColor color() const;
void setColor(const QColor &color);
bool hasColor() const;
QColor textColor() const;
void setTextColor(const QColor &textColor);
bool hasTextColor() const;
enum Mode { // ### direct copy from Navitia, we maybe can reduce that a bit
Unknown,
......
......@@ -66,7 +66,7 @@ Kirigami.ApplicationWindow {
Rectangle {
id: colorBar
width: Kirigami.Units.largeSpacing
color: modelData.route.line.color
color: modelData.route.line.hasColor ? modelData.route.line.color : "transparent"
Layout.fillHeight: true
}
......
......@@ -137,7 +137,7 @@ Kirigami.ApplicationWindow {
Rectangle {
id: colorBar
width: Kirigami.Units.largeSpacing
color: modelData.route.line.color
color: modelData.route.line.hasColor ? modelData.route.line.color : "transparent"
Layout.fillHeight: true
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment