Skip to content

Commit 83bf498

Browse files
committed
scripting: use undo when changing visible property
1 parent e5c70a3 commit 83bf498

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

libmscore/element.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,15 @@ void Element::undoSetColor(const QColor& c)
16201620
score()->undoChangeProperty(this, P_ID::COLOR, c);
16211621
}
16221622

1623+
//---------------------------------------------------------
1624+
// undoSetVisible
1625+
//---------------------------------------------------------
1626+
1627+
void Element::undoSetVisible(bool v)
1628+
{
1629+
score()->undoChangeProperty(this, P_ID::VISIBLE, v);
1630+
}
1631+
16231632
//---------------------------------------------------------
16241633
// bbox() function for scripts
16251634
//

libmscore/element.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class Element : public QObject, public ScoreElement {
175175
Q_PROPERTY(int track READ track WRITE setTrack)
176176
Q_PROPERTY(Ms::Element::Type type READ type)
177177
Q_PROPERTY(QPointF userOff READ scriptUserOff WRITE scriptSetUserOff)
178-
Q_PROPERTY(bool visible READ visible WRITE setVisible)
178+
Q_PROPERTY(bool visible READ visible WRITE undoSetVisible)
179179

180180
Element* _parent { 0 };
181181

@@ -465,6 +465,7 @@ class Element : public QObject, public ScoreElement {
465465
QColor curColor(const Element* proxy) const;
466466
virtual void setColor(const QColor& c) { _color = c; }
467467
void undoSetColor(const QColor& c);
468+
void undoSetVisible(bool v);
468469

469470
static Element::Type readType(XmlReader& node, QPointF*, Fraction*);
470471

0 commit comments

Comments
 (0)