Skip to content

Commit

Permalink
Merge pull request #1346 from AntonioBL/slur_color
Browse files Browse the repository at this point in the history
fix #22779 : Slur color change not showing in the score
  • Loading branch information
lasconic committed Oct 4, 2014
2 parents 4cf2ce1 + b0098ee commit 599f929
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libmscore/element.cpp
Expand Up @@ -1547,7 +1547,7 @@ bool Element::setProperty(P_ID propertyId, const QVariant& v)
_generated = v.toBool();
break;
case P_ID::COLOR:
_color = v.value<QColor>();
setColor(v.value<QColor>());
break;
case P_ID::VISIBLE:
setVisible(v.toBool());
Expand Down
4 changes: 2 additions & 2 deletions libmscore/element.h
Expand Up @@ -179,6 +179,7 @@ class Element : public QObject {
protected:
bool _selected; ///< set if element is selected
bool _visible; ///< visibility attribute
QColor _color; ///< element color attribute

public:
//-------------------------------------------------------------------
Expand Down Expand Up @@ -292,7 +293,6 @@ class Element : public QObject {
mutable ElementFlags _flags;

int _track; ///< staffIdx * VOICES + voice
QColor _color;
qreal _mag; ///< standard magnification (derived value)

QPointF _pos; ///< Reference position, relative to _parent.
Expand Down Expand Up @@ -454,7 +454,7 @@ class Element : public QObject {
QColor color() const { return _color; }
QColor curColor() const;
QColor curColor(const Element* proxy) const;
void setColor(const QColor& c) { _color = c; }
virtual void setColor(const QColor& c) { _color = c; }
void undoSetColor(const QColor& c);

static Element::Type readType(XmlReader& node, QPointF*, Fraction*);
Expand Down
26 changes: 26 additions & 0 deletions libmscore/spanner.cpp
Expand Up @@ -172,6 +172,21 @@ void SpannerSegment::setVisible(bool f)
_visible = f;
}

//---------------------------------------------------------
// setColor
//---------------------------------------------------------

void SpannerSegment::setColor(const QColor& col)
{
if (_spanner) {
for (SpannerSegment* ss : _spanner->spannerSegments())
ss->_color = col;
_spanner->_color = col;
}
else
_color = col;
}

//---------------------------------------------------------
// nextElement
//---------------------------------------------------------
Expand Down Expand Up @@ -545,6 +560,17 @@ void Spanner::setVisible(bool f)
_visible = f;
}

//---------------------------------------------------------
// setColor
//---------------------------------------------------------

void Spanner::setColor(const QColor& col)
{
for (SpannerSegment* ss : spannerSegments())
ss->setColor(col);
_color = col;
}

//---------------------------------------------------------
// setStartElement
//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions libmscore/spanner.h
Expand Up @@ -77,6 +77,7 @@ class SpannerSegment : public Element {
virtual void reset() override;
virtual void setSelected(bool f) override;
virtual void setVisible(bool f) override;
virtual void setColor(const QColor& col) override;

virtual Element* nextElement() override;
virtual Element* prevElement() override;
Expand Down Expand Up @@ -176,6 +177,7 @@ class Spanner : public Element {

virtual void setSelected(bool f) override;
virtual void setVisible(bool f) override;
virtual void setColor(const QColor& col) override;
virtual Element* nextElement() override;
virtual Element* prevElement() override;

Expand Down

0 comments on commit 599f929

Please sign in to comment.