diff --git a/libmscore/cmd.cpp b/libmscore/cmd.cpp index a5bd5fb160f4b..b42ae8c38d69e 100644 --- a/libmscore/cmd.cpp +++ b/libmscore/cmd.cpp @@ -3329,7 +3329,7 @@ void Score::cmdAddPitch(const EditData& ed, int note, bool addFlag, bool insert) int curPitch = 60; if (is.segment()) { Staff* staff = Score::staff(is.track() / VOICES); - Segment* seg = is.segment()->prev1(SegmentType::ChordRest | SegmentType::Clef); + Segment* seg = is.segment()->prev1(SegmentType::ChordRest | SegmentType::Clef | SegmentType::HeaderClef); while (seg) { if (seg->isChordRestType()) { Element* p = seg->element(is.track()); @@ -3338,7 +3338,7 @@ void Score::cmdAddPitch(const EditData& ed, int note, bool addFlag, bool insert) break; } } - else if (seg->isClefType()) { + else if (seg->isClefType() || seg->isHeaderClefType()) { Element* p = seg->element( (is.track() / VOICES) * VOICES); // clef on voice 1 if (p && p->isClef()) { Clef* clef = toClef(p); diff --git a/libmscore/scoreElement.cpp b/libmscore/scoreElement.cpp index bdd148e4d4b46..6bac1d8a22356 100644 --- a/libmscore/scoreElement.cpp +++ b/libmscore/scoreElement.cpp @@ -169,9 +169,24 @@ ScoreElement::~ScoreElement() // propertyDefault //--------------------------------------------------------- +QVariant ScoreElement::propertyDefault(Pid pid, Tid tid) const + { + for (const StyledProperty& spp : *textStyle(tid)) { + if (spp.pid == pid) { + if (propertyType(pid) == P_TYPE::SP_REAL) + return score()->styleP(spp.sid); + return score()->styleV(spp.sid); + } + } + return QVariant(); + } + +//--------------------------------------------------------- +// propertyDefault +//--------------------------------------------------------- + QVariant ScoreElement::propertyDefault(Pid pid) const { - QVariant v; for (const StyledProperty& spp : *_elementStyle) { if (spp.pid == pid) { if (propertyType(pid) == P_TYPE::SP_REAL) @@ -179,9 +194,8 @@ QVariant ScoreElement::propertyDefault(Pid pid) const return score()->styleV(spp.sid); } } - if (!v.isValid()) - qDebug("<%s>(%d) not found in <%s>", propertyQmlName(pid), int(pid), name()); - return v; + qDebug("<%s>(%d) not found in <%s>", propertyQmlName(pid), int(pid), name()); + return QVariant(); } //--------------------------------------------------------- diff --git a/libmscore/scoreElement.h b/libmscore/scoreElement.h index f80bf02fefeb8..ab4ec3cd9dd1e 100644 --- a/libmscore/scoreElement.h +++ b/libmscore/scoreElement.h @@ -194,6 +194,7 @@ class ScoreElement { virtual bool setProperty(Pid, const QVariant&) = 0; virtual QVariant propertyDefault(Pid) const; virtual void resetProperty(Pid id); + QVariant propertyDefault(Pid pid, Tid tid) const; virtual void reset(); // reset all properties & position to default diff --git a/libmscore/tuplet.cpp b/libmscore/tuplet.cpp index 18a26ab81e60e..aa2d331c0cb1d 100644 --- a/libmscore/tuplet.cpp +++ b/libmscore/tuplet.cpp @@ -1057,13 +1057,11 @@ QVariant Tuplet::propertyDefault(Pid id) const case Pid::P2: return QPointF(); default: - for (const StyledProperty& p : *textStyle(Tid::DEFAULT)) { - if (p.pid == id) { - if (propertyType(id) == P_TYPE::SP_REAL) - return score()->styleP(p.sid); - return score()->styleV(p.sid); - } - } + { + QVariant v = ScoreElement::propertyDefault(id, Tid::DEFAULT); + if (v.isValid()) + return v; + } return DurationElement::propertyDefault(id); } }