replaced QVariant to PropertyValue for change properties

This commit is contained in:
Igor Korsukov 2021-11-17 09:45:43 +02:00
parent bba2d97ec0
commit 7b3b91ae81
158 changed files with 494 additions and 488 deletions

View file

@ -53,7 +53,7 @@ public:
Ms::EngravingItem* clone() const override;
mu::engraving::PropertyValue getProperty(Ms::Pid) const override { return mu::engraving::PropertyValue(); }
bool setProperty(Ms::Pid, const QVariant&) override { return false; }
bool setProperty(Ms::Pid, const mu::engraving::PropertyValue&) override { return false; }
private:
RootItem* m_root = nullptr;

View file

@ -116,7 +116,7 @@ void LayoutMeasure::createMMRest(const LayoutOptions& options, Score* score, Mea
if (mmrEndBarline->barLineType() != lastMeasureEndBarline->barLineType()) {
// change directly when generating mmrests, do not change underlying measures or follow links
score->undo(new ChangeProperty(mmrEndBarline, Pid::BARLINE_TYPE,
QVariant::fromValue(lastMeasureEndBarline->barLineType()),
PropertyValue::fromValue(lastMeasureEndBarline->barLineType()),
PropertyFlags::NOSTYLE));
score->undo(new ChangeProperty(mmrEndBarline, Pid::GENERATED, generated, PropertyFlags::NOSTYLE));
}

View file

@ -624,7 +624,7 @@ PropertyValue Accidental::propertyDefault(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Accidental::setProperty(Pid propertyId, const QVariant& v)
bool Accidental::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::ACCIDENTAL_TYPE:

View file

@ -139,7 +139,7 @@ public:
void write(XmlWriter& xml) const override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid propertyId) const override;
Pid propertyId(const QStringRef& xmlName) const override;
QString propertyUserValue(Pid) const override;

View file

@ -119,7 +119,7 @@ engraving::PropertyValue ActionIcon::getProperty(Pid pid) const
return EngravingItem::getProperty(pid);
}
bool ActionIcon::setProperty(Pid pid, const QVariant& v)
bool ActionIcon::setProperty(Pid pid, const engraving::PropertyValue& v)
{
switch (pid) {
case Pid::ACTION:

View file

@ -82,7 +82,7 @@ public:
void layout() override;
mu::engraving::PropertyValue getProperty(Pid) const override;
bool setProperty(Pid, const QVariant&) override;
bool setProperty(Pid, const mu::engraving::PropertyValue&) override;
private:
mu::RectF boundingBox() const;

View file

@ -717,7 +717,7 @@ PropertyValue Ambitus::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Ambitus::setProperty(Pid propertyId, const QVariant& v)
bool Ambitus::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::HEAD_GROUP:

View file

@ -113,7 +113,7 @@ public:
// properties
mu::engraving::PropertyValue getProperty(Pid) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
EngravingItem* nextSegmentElement() override;

View file

@ -723,7 +723,7 @@ engraving::PropertyValue Arpeggio::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Arpeggio::setProperty(Pid propertyId, const QVariant& val)
bool Arpeggio::setProperty(Pid propertyId, const engraving::PropertyValue& val)
{
switch (propertyId) {
case Pid::ARPEGGIO_TYPE:

View file

@ -115,7 +115,7 @@ public:
void setStretch(qreal val) { _stretch = val; }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid propertyId) const override;
Pid propertyId(const QStringRef& xmlName) const override;

View file

@ -326,7 +326,7 @@ PropertyValue Articulation::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Articulation::setProperty(Pid propertyId, const QVariant& v)
bool Articulation::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::SYMBOL:

View file

@ -133,7 +133,7 @@ public:
QVector<mu::LineF> dragAnchorLines() const override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
void resetProperty(Pid id) override;
Sid getPropertyStyle(Pid id) const override;

View file

@ -150,7 +150,7 @@ static void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStav
}
} else {
lscore->undo(new ChangeProperty(lbl, Pid::GENERATED, generated, PropertyFlags::NOSTYLE));
lscore->undo(new ChangeProperty(lbl, Pid::BARLINE_TYPE, QVariant::fromValue(barType), PropertyFlags::NOSTYLE));
lscore->undo(new ChangeProperty(lbl, Pid::BARLINE_TYPE, PropertyValue::fromValue(barType), PropertyFlags::NOSTYLE));
// set generated flag before and after so it sticks on type change and also works on undo/redo
lscore->undo(new ChangeProperty(lbl, Pid::GENERATED, generated, PropertyFlags::NOSTYLE));
if (lbl != sbl && !generated && !lbl->links()) {
@ -166,7 +166,7 @@ static void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStav
for (EngravingItem* e : segment1->elist()) {
if (e) {
e->score()->undo(new ChangeProperty(e, Pid::GENERATED, false, PropertyFlags::NOSTYLE));
e->score()->undo(new ChangeProperty(e, Pid::BARLINE_TYPE, QVariant::fromValue(barType), PropertyFlags::NOSTYLE));
e->score()->undo(new ChangeProperty(e, Pid::BARLINE_TYPE, PropertyValue::fromValue(barType), PropertyFlags::NOSTYLE));
// set generated flag before and after so it sticks on type change and also works on undo/redo
e->score()->undo(new ChangeProperty(e, Pid::GENERATED, false, PropertyFlags::NOSTYLE));
}
@ -1489,7 +1489,7 @@ PropertyValue BarLine::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool BarLine::setProperty(Pid id, const QVariant& v)
bool BarLine::setProperty(Pid id, const PropertyValue& v)
{
switch (id) {
case Pid::BARLINE_TYPE:
@ -1519,7 +1519,7 @@ bool BarLine::setProperty(Pid id, const QVariant& v)
// undoChangeProperty
//---------------------------------------------------------
void BarLine::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps)
void BarLine::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if (id == Pid::BARLINE_TYPE && segment()) {
const BarLine* bl = this;

View file

@ -150,10 +150,10 @@ public:
int subtype() const override { return int(_barLineType); }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid propertyId) const override;
Pid propertyId(const QStringRef& xmlName) const override;
void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue&, PropertyFlags ps) override;
using EngravingObject::undoChangeProperty;
static qreal layoutWidth(Score*, BarLineType);

View file

@ -2343,10 +2343,10 @@ void Beam::reset()
undoChangeProperty(Pid::GROW_RIGHT, 1.0);
}
if (userModified()) {
undoChangeProperty(Pid::BEAM_POS, QVariant::fromValue(beamPos()));
undoChangeProperty(Pid::BEAM_POS, PropertyValue::fromValue(beamPos()));
undoChangeProperty(Pid::USER_MODIFIED, false);
}
undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(Direction::AUTO));
undoChangeProperty(Pid::STEM_DIRECTION, PropertyValue::fromValue<Direction>(Direction::AUTO));
resetProperty(Pid::BEAM_NO_SLOPE);
setGenerated(true);
}
@ -2495,7 +2495,7 @@ PropertyValue Beam::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Beam::setProperty(Pid propertyId, const QVariant& v)
bool Beam::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::STEM_DIRECTION:

View file

@ -174,7 +174,7 @@ public:
qreal beamDist() const { return _beamDist; }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
bool isGrace() const { return _isGrace; } // for debugger

View file

@ -425,7 +425,7 @@ PropertyValue Bend::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool Bend::setProperty(Pid id, const QVariant& v)
bool Bend::setProperty(Pid id, const PropertyValue& v)
{
switch (id) {
case Pid::FONT_FACE:

View file

@ -71,7 +71,7 @@ public:
// property methods
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
private:

View file

@ -401,7 +401,7 @@ PropertyValue Box::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Box::setProperty(Pid propertyId, const QVariant& v)
bool Box::setProperty(Pid propertyId, const PropertyValue& v)
{
score()->addRefresh(canvasBoundingRect());
switch (propertyId) {
@ -740,7 +740,7 @@ PropertyValue HBox::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool HBox::setProperty(Pid propertyId, const QVariant& v)
bool HBox::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::CREATE_SYSTEM_HEADER:

View file

@ -96,7 +96,7 @@ public:
void copyValues(Box* origin);
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
QString accessibleExtraInfo() const override;
@ -138,7 +138,7 @@ public:
void setCreateSystemHeader(bool val) { _createSystemHeader = val; }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
std::vector<mu::PointF> gripsPositions(const EditData&) const override;

View file

@ -471,7 +471,7 @@ PropertyValue Bracket::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool Bracket::setProperty(Pid id, const QVariant& v)
bool Bracket::setProperty(Pid id, const PropertyValue& v)
{
return _bi->setProperty(id, v);
}
@ -496,10 +496,10 @@ PropertyValue Bracket::propertyDefault(Pid id) const
// undoChangeProperty
//---------------------------------------------------------
void Bracket::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps)
void Bracket::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if (id == Pid::COLOR) {
setColor(v.value<mu::draw::Color>());
setColor(v.value<draw::Color>());
}
// brackets do not survive layout() and therefore cannot be on

View file

@ -112,10 +112,10 @@ public:
EngravingItem* drop(EditData&) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
void undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps) override;
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue& v, PropertyFlags ps) override;
using EngravingObject::undoChangeProperty;
int gripsCount() const override { return 1; }

View file

@ -57,7 +57,7 @@ mu::engraving::PropertyValue BracketItem::getProperty(Pid id) const
}
}
bool BracketItem::setProperty(Pid id, const QVariant& v)
bool BracketItem::setProperty(Pid id, const engraving::PropertyValue& v)
{
switch (id) {
case Pid::SYSTEM_BRACKET:

View file

@ -51,7 +51,7 @@ public:
Ms::EngravingItem* clone() const override;
mu::engraving::PropertyValue getProperty(Pid) const override;
bool setProperty(Pid, const QVariant&) override;
bool setProperty(Pid, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
int bracketSpan() const { return _bracketSpan; }

View file

@ -196,7 +196,7 @@ PropertyValue Breath::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Breath::setProperty(Pid propertyId, const QVariant& v)
bool Breath::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::SYMBOL:

View file

@ -74,7 +74,7 @@ public:
mu::PointF pagePos() const override; ///< position in page coordinates
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
EngravingItem* nextSegmentElement() override;

View file

@ -2713,7 +2713,7 @@ void Chord::setColor(const mu::draw::Color& color)
ChordRest::setColor(color);
for (Note* note : _notes) {
note->undoChangeProperty(Pid::COLOR, QVariant::fromValue(color));
note->undoChangeProperty(Pid::COLOR, PropertyValue::fromValue(color));
}
}
@ -2798,7 +2798,7 @@ PropertyValue Chord::propertyDefault(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Chord::setProperty(Pid propertyId, const QVariant& v)
bool Chord::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::NO_STEM:
@ -2866,7 +2866,7 @@ void Chord::updateArticulations(const std::set<SymId>& newArticulationIds, Artic
void Chord::reset()
{
undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(Direction::AUTO));
undoChangeProperty(Pid::STEM_DIRECTION, PropertyValue::fromValue<Direction>(Direction::AUTO));
undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::AUTO));
score()->createPlayEvents(this);
ChordRest::reset();
@ -2895,7 +2895,7 @@ void Chord::setSlash(bool flag, bool stemless)
// restore to normal
undoChangeProperty(Pid::NO_STEM, false);
undoChangeProperty(Pid::SMALL, false);
undoChangeProperty(Pid::OFFSET, QVariant::fromValue(PointF()));
undoChangeProperty(Pid::OFFSET, PropertyValue::fromValue(PointF()));
for (Note* n : _notes) {
n->undoChangeProperty(Pid::HEAD_GROUP, int(NoteHead::Group::HEAD_NORMAL));
n->undoChangeProperty(Pid::FIXED, false);
@ -2906,7 +2906,7 @@ void Chord::setSlash(bool flag, bool stemless)
const Drumset* ds = part()->instrument(tick())->drumset();
int pitch = n->pitch();
if (ds && ds->isValid(pitch)) {
undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(ds->stemDirection(pitch)));
undoChangeProperty(Pid::STEM_DIRECTION, PropertyValue::fromValue<Direction>(ds->stemDirection(pitch)));
n->undoChangeProperty(Pid::HEAD_GROUP, int(ds->noteHead(pitch)));
}
}
@ -2915,7 +2915,7 @@ void Chord::setSlash(bool flag, bool stemless)
}
// set stem to auto (mostly important for rhythmic notation on drum staves)
undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(Direction::AUTO));
undoChangeProperty(Pid::STEM_DIRECTION, PropertyValue::fromValue<Direction>(Direction::AUTO));
// make stemless if asked
if (stemless) {
@ -3510,7 +3510,7 @@ Shape Chord::shape() const
return shape;
}
void Chord::undoChangeProperty(Pid id, const QVariant& newValue)
void Chord::undoChangeProperty(Pid id, const PropertyValue& newValue)
{
undoChangeProperty(id, newValue, propertyFlags(id));
}
@ -3519,7 +3519,7 @@ void Chord::undoChangeProperty(Pid id, const QVariant& newValue)
// undoChangeProperty
//---------------------------------------------------------
void Chord::undoChangeProperty(Pid id, const QVariant& newValue, PropertyFlags ps)
void Chord::undoChangeProperty(Pid id, const PropertyValue& newValue, PropertyFlags ps)
{
if (id == Pid::VISIBLE) {
processSiblings([=](EngravingItem* element) {

View file

@ -242,7 +242,7 @@ public:
void localSpatiumChanged(qreal oldValue, qreal newValue) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
void reset() override;
@ -262,8 +262,8 @@ public:
QString accessibleExtraInfo() const override;
Shape shape() const override;
void undoChangeProperty(Pid id, const QVariant& newValue);
void undoChangeProperty(Pid id, const QVariant& newValue, PropertyFlags ps) override;
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue& newValue);
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue& newValue, PropertyFlags ps) override;
};
} // namespace Ms
#endif

View file

@ -443,7 +443,7 @@ PropertyValue ChordLine::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool ChordLine::setProperty(Pid propertyId, const QVariant& val)
bool ChordLine::setProperty(Pid propertyId, const PropertyValue& val)
{
switch (propertyId) {
case Pid::PATH:

View file

@ -82,7 +82,7 @@ public:
QString accessibleInfo() const override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
Pid propertyId(const QStringRef& xmlName) const override;

View file

@ -907,7 +907,7 @@ PropertyValue ChordRest::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool ChordRest::setProperty(Pid propertyId, const QVariant& v)
bool ChordRest::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::SMALL:
@ -924,7 +924,7 @@ bool ChordRest::setProperty(Pid propertyId, const QVariant& v)
measure()->checkMultiVoices(staffIdx());
break;
case Pid::DURATION_TYPE:
setDurationType(v.value<TDuration>());
setDurationType(v.toTDuration());
break;
default:
return DurationElement::setProperty(propertyId, v);

View file

@ -182,7 +182,7 @@ public:
void localSpatiumChanged(qreal oldValue, qreal newValue) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
bool isGrace() const;
bool isGraceBefore() const;

View file

@ -537,7 +537,7 @@ PropertyValue Clef::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Clef::setProperty(Pid propertyId, const QVariant& v)
bool Clef::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::CLEF_TYPE_CONCERT:

View file

@ -200,7 +200,7 @@ public:
void spatiumChanged(qreal oldValue, qreal newValue) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
EngravingItem* nextSegmentElement() override;

View file

@ -3762,7 +3762,7 @@ void Score::cmdPitchDown()
if (el && el->isLyrics()) {
cmdMoveLyrics(toLyrics(el), Direction::DOWN);
} else if (el && (el->isArticulation() || el->isTextBase())) {
el->undoChangeProperty(Pid::OFFSET, QVariant::fromValue(el->offset() + PointF(0.0, MScore::nudgeStep * el->spatium())),
el->undoChangeProperty(Pid::OFFSET, PropertyValue::fromValue(el->offset() + PointF(0.0, MScore::nudgeStep * el->spatium())),
PropertyFlags::UNSTYLED);
} else if (el && el->isRest()) {
cmdMoveRest(toRest(el), Direction::DOWN);
@ -3799,7 +3799,7 @@ void Score::cmdPitchUpOctave()
EngravingItem* el = selection().element();
if (el && (el->isArticulation() || el->isTextBase())) {
el->undoChangeProperty(Pid::OFFSET,
QVariant::fromValue(el->offset() + PointF(0.0, -MScore::nudgeStep10 * el->spatium())),
PropertyValue::fromValue(el->offset() + PointF(0.0, -MScore::nudgeStep10 * el->spatium())),
PropertyFlags::UNSTYLED);
} else {
upDown(true, UpDownMode::OCTAVE);

View file

@ -158,7 +158,7 @@ PropertyValue DurationElement::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool DurationElement::setProperty(Pid propertyId, const QVariant& v)
bool DurationElement::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::DURATION: {

View file

@ -64,7 +64,7 @@ public:
void setTicks(const Fraction& f) { _duration = f; }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
protected:
DurationElement(const ElementType& type, EngravingItem* parent = 0, ElementFlags = ElementFlag::MOVABLE | ElementFlag::ON_STAFF);

View file

@ -578,7 +578,7 @@ PropertyValue Dynamic::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Dynamic::setProperty(Pid propertyId, const QVariant& v)
bool Dynamic::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::DYNAMIC_TYPE:

View file

@ -107,7 +107,7 @@ public:
static Speed nameToSpeed(QString name);
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
Pid propertyId(const QStringRef& xmlName) const override;
QString propertyUserValue(Pid) const override;

View file

@ -827,7 +827,7 @@ bool Score::rewriteMeasures(Measure* fm, Measure* lm, const Fraction& ns, int st
continue;
}
if (cr->isRest() && cr->durationType() == TDuration::DurationType::V_MEASURE) {
cr->undoChangeProperty(Pid::DURATION, QVariant::fromValue(ns));
cr->undoChangeProperty(Pid::DURATION, ns);
} else {
return false;
}
@ -1031,7 +1031,7 @@ bool Score::rewriteMeasures(Measure* fm, const Fraction& ns, int staffIdx)
for (Measure* m = fm1; m; m = m->nextMeasure()) {
ChordRest* cr = m->findChordRest(m->tick(), staffIdx * VOICES);
if (cr && cr->isRest() && cr->durationType() == TDuration::DurationType::V_MEASURE) {
cr->undoChangeProperty(Pid::DURATION, QVariant::fromValue(fr));
cr->undoChangeProperty(Pid::DURATION, fr);
} else {
break;
}
@ -1042,7 +1042,7 @@ bool Score::rewriteMeasures(Measure* fm, const Fraction& ns, int staffIdx)
break;
}
Fraction fr(ns);
m->undoChangeProperty(Pid::TIMESIG_NOMINAL, QVariant::fromValue(fr));
m->undoChangeProperty(Pid::TIMESIG_NOMINAL, fr);
}
return false;
}
@ -1212,9 +1212,9 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
Measure* lm = (lmTick != Fraction(-1, 1)) ? score->tick2measure(lmTick) : nullptr;
for (Measure* m = mf; m != lm; m = m->nextMeasure()) {
bool changeActual = m->ticks() == m->timesig();
m->undoChangeProperty(Pid::TIMESIG_NOMINAL, QVariant::fromValue(ns));
m->undoChangeProperty(Pid::TIMESIG_NOMINAL, ns);
if (changeActual) {
m->undoChangeProperty(Pid::TIMESIG_ACTUAL, QVariant::fromValue(ns));
m->undoChangeProperty(Pid::TIMESIG_ACTUAL, ns);
}
}
std::pair<int, int> staffIdxRange = getStaffIdxRange(score);
@ -1224,12 +1224,12 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
continue;
}
nsig->undoChangeProperty(Pid::SHOW_COURTESY, ts->showCourtesySig());
nsig->undoChangeProperty(Pid::TIMESIG, QVariant::fromValue(ts->sig()));
nsig->undoChangeProperty(Pid::TIMESIG, ts->sig());
nsig->undoChangeProperty(Pid::TIMESIG_TYPE, int(ts->timeSigType()));
nsig->undoChangeProperty(Pid::NUMERATOR_STRING, ts->numeratorString());
nsig->undoChangeProperty(Pid::DENOMINATOR_STRING, ts->denominatorString());
nsig->undoChangeProperty(Pid::TIMESIG_STRETCH, QVariant::fromValue(ts->stretch()));
nsig->undoChangeProperty(Pid::GROUPS, QVariant::fromValue(ts->groups()));
nsig->undoChangeProperty(Pid::TIMESIG_STRETCH, ts->stretch());
nsig->undoChangeProperty(Pid::GROUPS, ts->groups());
nsig->setSelected(false);
nsig->setDropTarget(0);
}
@ -1243,7 +1243,7 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
//
if (mf == mScore->firstMeasure() && mf->nextMeasure() && (mf->ticks() != mf->timesig())) {
// handle upbeat
mf->undoChangeProperty(Pid::TIMESIG_NOMINAL, QVariant::fromValue(ns));
mf->undoChangeProperty(Pid::TIMESIG_NOMINAL, ns);
Measure* m = mf->nextMeasure();
Segment* s = m->findSegment(SegmentType::TimeSig, m->tick());
mf = s ? 0 : mf->nextMeasure();
@ -1299,14 +1299,14 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
} else {
nsig->undoChangeProperty(Pid::SHOW_COURTESY, ts->showCourtesySig());
nsig->undoChangeProperty(Pid::TIMESIG_TYPE, int(ts->timeSigType()));
nsig->undoChangeProperty(Pid::TIMESIG, QVariant::fromValue(ts->sig()));
nsig->undoChangeProperty(Pid::TIMESIG, ts->sig());
nsig->undoChangeProperty(Pid::NUMERATOR_STRING, ts->numeratorString());
nsig->undoChangeProperty(Pid::DENOMINATOR_STRING, ts->denominatorString());
// HACK do it twice to accommodate undo
nsig->undoChangeProperty(Pid::TIMESIG_TYPE, int(ts->timeSigType()));
nsig->undoChangeProperty(Pid::TIMESIG_STRETCH, QVariant::fromValue(ts->stretch()));
nsig->undoChangeProperty(Pid::GROUPS, QVariant::fromValue(ts->groups()));
nsig->undoChangeProperty(Pid::TIMESIG_STRETCH, ts->stretch());
nsig->undoChangeProperty(Pid::GROUPS, ts->groups());
nsig->setSelected(false);
nsig->setDropTarget(0); // DEBUG
}
@ -1380,7 +1380,7 @@ void Score::cmdRemoveTimeSig(TimeSig* ts)
// fix measure rest duration
ChordRest* cr = nm->findChordRest(nm->tick(), i * VOICES);
if (cr && cr->isRest() && cr->durationType() == TDuration::DurationType::V_MEASURE) {
cr->undoChangeProperty(Pid::DURATION, QVariant::fromValue(nm->stretchedLen(staff(i))));
cr->undoChangeProperty(Pid::DURATION, nm->stretchedLen(staff(i)));
}
//cr->setTicks(nm->stretchedLen(staff(i)));
}
@ -2059,7 +2059,7 @@ void Score::cmdFlip()
} else {
flipOnce(chord, [chord]() {
Direction dir = chord->up() ? Direction::DOWN : Direction::UP;
chord->undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(dir));
chord->undoChangeProperty(Pid::STEM_DIRECTION, dir);
});
}
}
@ -2068,13 +2068,13 @@ void Score::cmdFlip()
auto beam = toBeam(e);
flipOnce(beam, [beam]() {
Direction dir = beam->up() ? Direction::DOWN : Direction::UP;
beam->undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(dir));
beam->undoChangeProperty(Pid::STEM_DIRECTION, dir);
});
} else if (e->isSlurTieSegment()) {
auto slurTieSegment = toSlurTieSegment(e)->slurTie();
flipOnce(slurTieSegment, [slurTieSegment]() {
Direction dir = slurTieSegment->up() ? Direction::DOWN : Direction::UP;
slurTieSegment->undoChangeProperty(Pid::SLUR_DIRECTION, QVariant::fromValue<Direction>(dir));
slurTieSegment->undoChangeProperty(Pid::SLUR_DIRECTION, dir);
});
} else if (e->isArticulation()) {
auto artic = toArticulation(e);
@ -2107,12 +2107,12 @@ void Score::cmdFlip()
auto tuplet = toTuplet(e);
flipOnce(tuplet, [tuplet]() {
Direction dir = tuplet->isUp() ? Direction::DOWN : Direction::UP;
tuplet->undoChangeProperty(Pid::DIRECTION, QVariant::fromValue<Direction>(dir), PropertyFlags::UNSTYLED);
tuplet->undoChangeProperty(Pid::DIRECTION, PropertyValue::fromValue<Direction>(dir), PropertyFlags::UNSTYLED);
});
} else if (e->isNoteDot() && e->parent()->isNote()) {
Note* note = toNote(e->parent());
Direction d = note->dotIsUp() ? Direction::DOWN : Direction::UP;
note->undoChangeProperty(Pid::DOT_POSITION, QVariant::fromValue<Direction>(d));
note->undoChangeProperty(Pid::DOT_POSITION, PropertyValue::fromValue<Direction>(d));
} else if (e->isTempoText()
|| e->isSystemText()
|| e->isJump()
@ -2456,7 +2456,7 @@ void Score::deleteItem(EngravingItem* el)
}
}
} else {
bl->undoChangeProperty(Pid::BARLINE_TYPE, QVariant::fromValue(BarLineType::NORMAL));
bl->undoChangeProperty(Pid::BARLINE_TYPE, PropertyValue::fromValue(BarLineType::NORMAL));
}
}
}
@ -4379,7 +4379,7 @@ void Score::cloneVoice(int strack, int dtrack, Segment* sf, const Fraction& lTic
// return true if an property was actually changed
//---------------------------------------------------------
bool Score::undoPropertyChanged(EngravingItem* e, Pid t, const QVariant& st, PropertyFlags ps)
bool Score::undoPropertyChanged(EngravingItem* e, Pid t, const PropertyValue& st, PropertyFlags ps)
{
bool changed = false;
@ -4410,7 +4410,7 @@ bool Score::undoPropertyChanged(EngravingItem* e, Pid t, const QVariant& st, Pro
return changed;
}
void Score::undoPropertyChanged(EngravingObject* e, Pid t, const QVariant& st, PropertyFlags ps)
void Score::undoPropertyChanged(EngravingObject* e, Pid t, const PropertyValue& st, PropertyFlags ps)
{
if (e->getProperty(t) != st) {
undoStack()->push1(new ChangeProperty(e, t, st, ps));
@ -4815,8 +4815,8 @@ void Score::undoChangeChordRestLen(ChordRest* cr, const TDuration& d)
if (!ncr) {
continue;
}
ncr->undoChangeProperty(Pid::DURATION_TYPE, QVariant::fromValue(d));
ncr->undoChangeProperty(Pid::DURATION, QVariant::fromValue(d.fraction()));
ncr->undoChangeProperty(Pid::DURATION_TYPE, PropertyValue::fromValue(d));
ncr->undoChangeProperty(Pid::DURATION, PropertyValue::fromValue(d.fraction()));
}
}

View file

@ -1314,7 +1314,7 @@ PropertyValue EngravingItem::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool EngravingItem::setProperty(Pid propertyId, const QVariant& v)
bool EngravingItem::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::TRACK:
@ -1327,15 +1327,8 @@ bool EngravingItem::setProperty(Pid propertyId, const QVariant& v)
setGenerated(v.toBool());
break;
case Pid::COLOR:
{
if (v.isValid()) {
IF_ASSERT_FAILED(v.canConvert<mu::draw::Color>())
{
}
}
setColor(v.value<mu::draw::Color>());
break;
}
case Pid::VISIBLE:
setVisible(v.toBool());
break;
@ -1379,7 +1372,7 @@ bool EngravingItem::setProperty(Pid propertyId, const QVariant& v)
// undoChangeProperty
//---------------------------------------------------------
void EngravingItem::undoChangeProperty(Pid pid, const QVariant& val, PropertyFlags ps)
void EngravingItem::undoChangeProperty(Pid pid, const PropertyValue& val, PropertyFlags ps)
{
if (pid == Pid::AUTOPLACE && (val.toBool() == true && !autoplace())) {
// Switching autoplacement on. Save user-defined
@ -1588,7 +1581,7 @@ const MeasureBase* EngravingItem::findMeasureBase() const
void EngravingItem::undoSetColor(const mu::draw::Color& c)
{
undoChangeProperty(Pid::COLOR, QVariant::fromValue(c));
undoChangeProperty(Pid::COLOR, PropertyValue::fromValue(c));
}
//---------------------------------------------------------
@ -2341,7 +2334,7 @@ qreal EngravingItem::rebaseOffset(bool nox)
bool flipped = above ? r.top() > staffHeight : r.bottom() < 0.0;
if (flipped && !multi) {
off.ry() += above ? -staffHeight : staffHeight;
undoChangeProperty(Pid::OFFSET, QVariant::fromValue(off + p));
undoChangeProperty(Pid::OFFSET, PropertyValue::fromValue(off + p));
_offsetChanged = OffsetChange::ABSOLUTE_OFFSET; //saveChangedValue;
rypos() += above ? staffHeight : -staffHeight;
PropertyFlags pf = e->propertyFlags(Pid::PLACEMENT);
@ -2356,7 +2349,7 @@ qreal EngravingItem::rebaseOffset(bool nox)
}
if (offsetChanged() == OffsetChange::ABSOLUTE_OFFSET) {
undoChangeProperty(Pid::OFFSET, QVariant::fromValue(off + p));
undoChangeProperty(Pid::OFFSET, PropertyValue::fromValue(off + p));
_offsetChanged = OffsetChange::ABSOLUTE_OFFSET; //saveChangedValue;
// allow autoplace to manage min distance even when not needed
undoResetProperty(Pid::MIN_DISTANCE);

View file

@ -530,8 +530,8 @@ public:
bool addToSkyline() const { return !(_flags & (ElementFlag::INVISIBLE | ElementFlag::NO_AUTOPLACE)); }
mu::engraving::PropertyValue getProperty(Pid) const override;
bool setProperty(Pid, const QVariant&) override;
void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
bool setProperty(Pid, const mu::engraving::PropertyValue&) override;
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue&, PropertyFlags ps) override;
using EngravingObject::undoChangeProperty;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
Pid propertyId(const QStringRef& xmlName) const override;

View file

@ -232,7 +232,7 @@ void EngravingObject::initElementStyle(const ElementStyle* ss)
void EngravingObject::resetProperty(Pid pid)
{
QVariant v = propertyDefault(pid);
PropertyValue v = propertyDefault(pid);
if (v.isValid()) {
setProperty(pid, v);
PropertyFlags p = propertyFlags(pid);
@ -269,7 +269,7 @@ bool EngravingObject::isStyled(Pid pid) const
// changeProperty
//---------------------------------------------------------
static void changeProperty(EngravingObject* e, Pid t, const QVariant& st, PropertyFlags ps)
static void changeProperty(EngravingObject* e, Pid t, const PropertyValue& st, PropertyFlags ps)
{
if (e->getProperty(t) != st || e->propertyFlags(t) != ps) {
if (e->isBracketItem()) {
@ -285,7 +285,7 @@ static void changeProperty(EngravingObject* e, Pid t, const QVariant& st, Proper
// changeProperties
//---------------------------------------------------------
static void changeProperties(EngravingObject* e, Pid t, const QVariant& st, PropertyFlags ps)
static void changeProperties(EngravingObject* e, Pid t, const PropertyValue& st, PropertyFlags ps)
{
if (propertyLink(t)) {
for (EngravingObject* ee : e->linkList()) {
@ -300,12 +300,12 @@ static void changeProperties(EngravingObject* e, Pid t, const QVariant& st, Prop
// undoChangeProperty
//---------------------------------------------------------
void EngravingObject::undoChangeProperty(Pid id, const QVariant& v)
void EngravingObject::undoChangeProperty(Pid id, const PropertyValue& v)
{
undoChangeProperty(id, v, propertyFlags(id));
}
void EngravingObject::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps)
void EngravingObject::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if ((getProperty(id) == v) && (propertyFlags(id) == ps)) {
return;
@ -350,7 +350,7 @@ void EngravingObject::undoChangeProperty(Pid id, const QVariant& v, PropertyFlag
}
changeProperties(this, id, v, ps);
if (id != Pid::GENERATED) {
changeProperties(this, Pid::GENERATED, QVariant(false), PropertyFlags::NOSTYLE);
changeProperties(this, Pid::GENERATED, false, PropertyFlags::NOSTYLE);
}
}
@ -360,7 +360,7 @@ void EngravingObject::undoChangeProperty(Pid id, const QVariant& v, PropertyFlag
void EngravingObject::undoPushProperty(Pid id)
{
QVariant val = getProperty(id);
PropertyValue val = getProperty(id);
score()->undoStack()->push1(new ChangeProperty(this, id, val));
}
@ -370,7 +370,7 @@ void EngravingObject::undoPushProperty(Pid id)
void EngravingObject::readProperty(XmlReader& e, Pid id)
{
QVariant v = Ms::readProperty(id, e);
PropertyValue v = Ms::readProperty(id, e);
switch (propertyType(id)) {
case P_TYPE::SP_REAL:
v = v.toReal() * score()->spatium();

View file

@ -267,7 +267,7 @@ public:
QString mscoreVersion() const;
virtual mu::engraving::PropertyValue getProperty(Pid) const = 0;
virtual bool setProperty(Pid, const QVariant&) = 0;
virtual bool setProperty(Pid, const mu::engraving::PropertyValue&) = 0;
virtual mu::engraving::PropertyValue propertyDefault(Pid) const;
virtual void resetProperty(Pid id);
mu::engraving::PropertyValue propertyDefault(Pid pid, Tid tid) const;
@ -298,8 +298,8 @@ public:
virtual void styleChanged();
virtual void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps);
void undoChangeProperty(Pid id, const QVariant&);
virtual void undoChangeProperty(Pid id, const mu::engraving::PropertyValue&, PropertyFlags ps);
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue&);
void undoResetProperty(Pid id);
void undoPushProperty(Pid);

View file

@ -278,7 +278,7 @@ PropertyValue Fermata::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Fermata::setProperty(Pid propertyId, const QVariant& v)
bool Fermata::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::SYMBOL:

View file

@ -76,7 +76,7 @@ public:
QVector<mu::LineF> dragAnchorLines() const override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
void resetProperty(Pid id) override;

View file

@ -707,7 +707,7 @@ PropertyValue FiguredBassItem::getProperty(Pid propertyId) const
}
}
bool FiguredBassItem::setProperty(Pid propertyId, const QVariant& v)
bool FiguredBassItem::setProperty(Pid propertyId, const PropertyValue& v)
{
score()->addRefresh(canvasBoundingRect());
int val = v.toInt();
@ -1455,7 +1455,7 @@ PropertyValue FiguredBass::getProperty(Pid propertyId) const
return TextBase::getProperty(propertyId);
}
bool FiguredBass::setProperty(Pid propertyId, const QVariant& v)
bool FiguredBass::setProperty(Pid propertyId, const PropertyValue& v)
{
score()->addRefresh(canvasBoundingRect());
return TextBase::setProperty(propertyId, v);

View file

@ -218,7 +218,7 @@ public:
QString displayText() const { return _displayText; }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
};
@ -327,7 +327,7 @@ public:
FiguredBass* nextFiguredBass() const; // returns next *adjacent* f.b. item, if any
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
void appendItem(FiguredBassItem* item) { items.push_back(item); }

View file

@ -1376,7 +1376,7 @@ PropertyValue FretDiagram::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool FretDiagram::setProperty(Pid propertyId, const QVariant& v)
bool FretDiagram::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::MAG:

View file

@ -256,7 +256,7 @@ public:
void scanElements(void* data, void (* func)(void*, EngravingItem*), bool all=true) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
qreal userMag() const { return _userMag; }

View file

@ -700,7 +700,7 @@ PropertyValue Glissando::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Glissando::setProperty(Pid propertyId, const QVariant& v)
bool Glissando::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::GLISS_TYPE:

View file

@ -92,7 +92,7 @@ public:
// property/style methods
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
Pid propertyId(const QStringRef& xmlName) const override;
};

View file

@ -771,7 +771,7 @@ PropertyValue Hairpin::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool Hairpin::setProperty(Pid id, const QVariant& v)
bool Hairpin::setProperty(Pid id, const PropertyValue& v)
{
switch (id) {
case Pid::HAIRPIN_CIRCLEDTIP:

View file

@ -152,7 +152,7 @@ public:
void read(XmlReader&) override;
mu::engraving::PropertyValue getProperty(Pid id) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
Pid propertyId(const QStringRef& xmlName) const override;

View file

@ -2234,7 +2234,7 @@ PropertyValue Harmony::getProperty(Pid pid) const
// setProperty
//---------------------------------------------------------
bool Harmony::setProperty(Pid pid, const QVariant& v)
bool Harmony::setProperty(Pid pid, const PropertyValue& v)
{
switch (pid) {
case Pid::PLAY:

View file

@ -227,7 +227,7 @@ public:
EngravingItem* drop(EditData&) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant& v) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue& v) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
};
} // namespace Ms

View file

@ -613,7 +613,7 @@ PropertyValue Image::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Image::setProperty(Pid propertyId, const QVariant& v)
bool Image::setProperty(Pid propertyId, const PropertyValue& v)
{
bool rv = true;
score()->addRefresh(canvasBoundingRect());

View file

@ -79,7 +79,7 @@ public:
void setSizeIsSpatium(bool val) { _sizeIsSpatium = val; }
mu::engraving::PropertyValue getProperty(Pid) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
mu::SizeF imageSize() const;

View file

@ -133,7 +133,7 @@ PropertyValue InstrumentName::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool InstrumentName::setProperty(Pid id, const QVariant& v)
bool InstrumentName::setProperty(Pid id, const PropertyValue& v)
{
bool rv = true;
switch (id) {

View file

@ -66,7 +66,7 @@ public:
Fraction playTick() const override;
bool isEditable() const override { return false; }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
};
} // namespace Ms

View file

@ -211,7 +211,7 @@ PropertyValue Jump::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Jump::setProperty(Pid propertyId, const QVariant& v)
bool Jump::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::JUMP_TO:

View file

@ -85,7 +85,7 @@ public:
void setPlayRepeats(bool val) { _playRepeats = val; }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
EngravingItem* nextSegmentElement() override;

View file

@ -675,7 +675,7 @@ PropertyValue KeySig::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool KeySig::setProperty(Pid propertyId, const QVariant& v)
bool KeySig::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::KEY:

View file

@ -93,7 +93,7 @@ public:
bool forInstrumentChange() const { return _sig.forInstrumentChange(); }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
EngravingItem* nextSegmentElement() override;

View file

@ -121,7 +121,7 @@ std::vector<mu::PointF> Lasso::gripsPositions(const EditData&) const
// setProperty
//---------------------------------------------------------
bool Lasso::setProperty(Pid propertyId, const QVariant& v)
bool Lasso::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::LASSO_POS:

View file

@ -49,7 +49,7 @@ public:
void endDrag(EditData&) override {}
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
int gripsCount() const override { return 8; }
Grip initialEditModeGrip() const override { return Grip(7); }

View file

@ -287,7 +287,7 @@ PropertyValue LayoutBreak::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool LayoutBreak::setProperty(Pid propertyId, const QVariant& v)
bool LayoutBreak::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::LAYOUT_BREAK:

View file

@ -75,7 +75,7 @@ public:
bool isNoBreak() const { return _layoutBreakType == Type::NOBREAK; }
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
Pid propertyId(const QStringRef& xmlName) const override;

View file

@ -1474,7 +1474,7 @@ PropertyValue SLine::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool SLine::setProperty(Pid id, const QVariant& v)
bool SLine::setProperty(Pid id, const PropertyValue& v)
{
switch (id) {
case Pid::DIAGONAL:

View file

@ -142,7 +142,7 @@ public:
const LineSegment* segmentAt(int n) const { return toLineSegment(Spanner::segmentAt(n)); }
mu::engraving::PropertyValue getProperty(Pid id) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
friend class LineSegment;

View file

@ -566,7 +566,7 @@ PropertyValue Lyrics::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Lyrics::setProperty(Pid propertyId, const QVariant& v)
bool Lyrics::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::PLACEMENT:
@ -653,7 +653,7 @@ void Score::forAllLyrics(std::function<void(Lyrics*)> f)
// undoChangeProperty
//---------------------------------------------------------
void Lyrics::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps)
void Lyrics::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if (id == Pid::VERSE && no() != v.toInt()) {
for (Lyrics* l : chordRest()->lyrics()) {

View file

@ -66,7 +66,7 @@ private:
Lyrics(const Lyrics&);
bool isMelisma() const;
void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue&, PropertyFlags ps) override;
protected:
int _no; ///< row index
@ -110,7 +110,7 @@ public:
void paste(EditData& ed, const QString& txt) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
};
@ -138,7 +138,7 @@ public:
Lyrics* nextLyrics() const { return _nextLyrics; }
bool isEndMelisma() const { return lyrics()->ticks().isNotZero(); }
bool isDash() const { return !isEndMelisma(); }
bool setProperty(Pid propertyId, const QVariant& v) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue& v) override;
SpannerSegment* layoutSystem(System*) override;
};

View file

@ -306,7 +306,7 @@ void LyricsLine::removeUnmanaged()
// setProperty
//---------------------------------------------------------
bool LyricsLine::setProperty(Pid propertyId, const QVariant& v)
bool LyricsLine::setProperty(Pid propertyId, const engraving::PropertyValue& v)
{
switch (propertyId) {
case Pid::SPANNER_TICKS:

View file

@ -274,7 +274,7 @@ PropertyValue Marker::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Marker::setProperty(Pid propertyId, const QVariant& v)
bool Marker::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::LABEL:

View file

@ -79,7 +79,7 @@ public:
void styleChanged() override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
EngravingItem* nextSegmentElement() override;

View file

@ -1911,16 +1911,16 @@ void Measure::adjustToLen(Fraction nf, bool appendRestsIfNecessary)
if (rests == 1 && chords == 0) {
// if measure value didn't change, stick to whole measure rest
if (m_timesig == nf) {
rest->undoChangeProperty(Pid::DURATION, QVariant::fromValue<Fraction>(nf * stretch));
rest->undoChangeProperty(Pid::DURATION_TYPE, QVariant::fromValue<TDuration>(TDuration::DurationType::V_MEASURE));
rest->undoChangeProperty(Pid::DURATION, PropertyValue::fromValue<Fraction>(nf * stretch));
rest->undoChangeProperty(Pid::DURATION_TYPE, PropertyValue::fromValue<TDuration>(TDuration::DurationType::V_MEASURE));
} else { // if measure value did change, represent with rests actual measure value
// convert the measure duration in a list of values (no dots for rests)
std::vector<TDuration> durList = toDurationList(nf * stretch, false, 0);
// set the existing rest to the first value of the duration list
for (EngravingObject* e : rest->linkList()) {
e->undoChangeProperty(Pid::DURATION, QVariant::fromValue<Fraction>(durList[0].fraction()));
e->undoChangeProperty(Pid::DURATION_TYPE, QVariant::fromValue<TDuration>(durList[0]));
e->undoChangeProperty(Pid::DURATION, PropertyValue::fromValue<Fraction>(durList[0].fraction()));
e->undoChangeProperty(Pid::DURATION_TYPE, PropertyValue::fromValue<TDuration>(durList[0]));
}
// add rests for any other duration list value
@ -2820,7 +2820,7 @@ PropertyValue Measure::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Measure::setProperty(Pid propertyId, const QVariant& value)
bool Measure::setProperty(Pid propertyId, const PropertyValue& value)
{
switch (propertyId) {
case Pid::TIMESIG_NOMINAL:
@ -3538,7 +3538,7 @@ qreal Measure::createEndBarLines(bool isLastMeasureInSystem)
} else {
if (bl->barLineType() != t) {
if (force) {
bl->undoChangeProperty(Pid::BARLINE_TYPE, QVariant::fromValue(t));
bl->undoChangeProperty(Pid::BARLINE_TYPE, PropertyValue::fromValue(t));
bl->setGenerated(true);
}
}

View file

@ -295,7 +295,7 @@ public:
mu::RectF staffabbox(int staffIdx) const;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
bool hasMMRest() const { return m_mmRest != 0; }

View file

@ -400,7 +400,7 @@ PropertyValue MeasureBase::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool MeasureBase::setProperty(Pid id, const QVariant& value)
bool MeasureBase::setProperty(Pid id, const PropertyValue& value)
{
switch (id) {
case Pid::REPEAT_END:

View file

@ -154,7 +154,7 @@ public:
qreal pause() const;
mu::engraving::PropertyValue getProperty(Pid) const override;
bool setProperty(Pid, const QVariant&) override;
bool setProperty(Pid, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
void clearElements();

View file

@ -70,7 +70,7 @@ engraving::PropertyValue MeasureNumberBase::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool MeasureNumberBase::setProperty(Pid id, const QVariant& val)
bool MeasureNumberBase::setProperty(Pid id, const PropertyValue& val)
{
switch (id) {
case Pid::HPLACEMENT:

View file

@ -41,7 +41,7 @@ public:
MeasureNumberBase(const MeasureNumberBase& other);
mu::engraving::PropertyValue getProperty(Pid id) const override;
bool setProperty(Pid id, const QVariant& val) override;
bool setProperty(Pid id, const mu::engraving::PropertyValue& val) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
bool readProperties(XmlReader&) override;

View file

@ -240,7 +240,7 @@ PropertyValue MeasureRepeat::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool MeasureRepeat::setProperty(Pid propertyId, const QVariant& v)
bool MeasureRepeat::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::SUBTYPE:

View file

@ -64,7 +64,7 @@ public:
void write(XmlWriter& xml) const override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
bool setProperty(Pid, const QVariant&) override;
bool setProperty(Pid, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue getProperty(Pid) const override;
mu::RectF numberRect() const override;

View file

@ -247,7 +247,7 @@ PropertyValue MMRest::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool MMRest::setProperty(Pid propertyId, const QVariant& v)
bool MMRest::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::MMREST_NUMBER_POS:

View file

@ -52,7 +52,7 @@ public:
void write(XmlWriter&) const override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
bool setProperty(Pid, const QVariant&) override;
bool setProperty(Pid, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue getProperty(Pid) const override;
Shape shape() const override;

View file

@ -66,7 +66,7 @@ PropertyValue MMRestRange::getProperty(Pid id) const
}
}
bool MMRestRange::setProperty(Pid id, const QVariant& val)
bool MMRestRange::setProperty(Pid id, const PropertyValue& val)
{
switch (id) {
case Pid::MMREST_RANGE_BRACKET_TYPE:

View file

@ -43,7 +43,7 @@ public:
MMRestRange* clone() const override { return new MMRestRange(*this); }
mu::engraving::PropertyValue getProperty(Pid id) const override;
bool setProperty(Pid id, const QVariant& val) override;
bool setProperty(Pid id, const mu::engraving::PropertyValue& val) override;
mu::engraving::PropertyValue propertyDefault(Pid id) const override;
bool readProperties(XmlReader&) override;

View file

@ -2522,8 +2522,8 @@ void Note::setTrack(int val)
void Note::reset()
{
undoChangeProperty(Pid::OFFSET, PointF());
chord()->undoChangeProperty(Pid::OFFSET, QVariant::fromValue(PointF()));
chord()->undoChangeProperty(Pid::STEM_DIRECTION, QVariant::fromValue<Direction>(Direction::AUTO));
chord()->undoChangeProperty(Pid::OFFSET, PropertyValue::fromValue(PointF()));
chord()->undoChangeProperty(Pid::STEM_DIRECTION, PropertyValue::fromValue<Direction>(Direction::AUTO));
}
//---------------------------------------------------------
@ -2755,7 +2755,7 @@ void Note::editDrag(EditData& editData)
} else if (ch->notes().size() == 1) {
// if the chord contains only this note, then move the whole chord
// including stem, flag etc.
ch->undoChangeProperty(Pid::OFFSET, QVariant::fromValue(ch->offset() + offset() + editData.evtDelta));
ch->undoChangeProperty(Pid::OFFSET, PropertyValue::fromValue(ch->offset() + offset() + editData.evtDelta));
setOffset(PointF());
} else {
setOffset(offset() + editData.evtDelta);
@ -3045,7 +3045,7 @@ PropertyValue Note::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Note::setProperty(Pid propertyId, const QVariant& v)
bool Note::setProperty(Pid propertyId, const PropertyValue& v)
{
Measure* m = chord() ? chord()->measure() : nullptr;
switch (propertyId) {

View file

@ -537,7 +537,7 @@ public:
void localSpatiumChanged(qreal oldValue, qreal newValue) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
QString propertyUserValue(Pid) const override;

View file

@ -123,7 +123,7 @@ void Ottava::setPlacement(Placement p)
// undoChangeProperty
//---------------------------------------------------------
void OttavaSegment::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps)
void OttavaSegment::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if (id == Pid::OTTAVA_TYPE || id == Pid::NUMBERS_ONLY) {
EngravingObject::undoChangeProperty(id, v, ps);
@ -132,7 +132,7 @@ void OttavaSegment::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags
}
}
void Ottava::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps)
void Ottava::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if (id == Pid::OTTAVA_TYPE || id == Pid::NUMBERS_ONLY) {
TextLineBase::undoChangeProperty(id, v, ps);
@ -375,7 +375,7 @@ PropertyValue Ottava::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Ottava::setProperty(Pid propertyId, const QVariant& val)
bool Ottava::setProperty(Pid propertyId, const PropertyValue& val)
{
switch (propertyId) {
case Pid::OTTAVA_TYPE:

View file

@ -78,7 +78,7 @@ class Ottava;
class OttavaSegment final : public TextLineBaseSegment
{
void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue&, PropertyFlags ps) override;
Sid getPropertyStyle(Pid) const override;
public:
@ -102,7 +102,7 @@ class Ottava final : public TextLineBase
void updateStyledProperties();
Sid getPropertyStyle(Pid) const override;
void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
void undoChangeProperty(Pid id, const mu::engraving::PropertyValue&, PropertyFlags ps) override;
protected:
friend class OttavaSegment;
@ -129,7 +129,7 @@ public:
bool readProperties(XmlReader& e) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
Pid propertyId(const QStringRef& xmlName) const override;

View file

@ -551,7 +551,7 @@ PropertyValue Part::getProperty(Pid id) const
// setProperty
//---------------------------------------------------------
bool Part::setProperty(Pid id, const QVariant& property)
bool Part::setProperty(Pid id, const PropertyValue& property)
{
switch (id) {
case Pid::VISIBLE:

View file

@ -157,7 +157,7 @@ public:
void setColor(int value) { _color = value; }
mu::engraving::PropertyValue getProperty(Pid) const override;
bool setProperty(Pid, const QVariant&) override;
bool setProperty(Pid, const mu::engraving::PropertyValue&) override;
int lyricCount() const;
int harmonyCount() const;

View file

@ -43,6 +43,7 @@
#include "fret.h"
using namespace mu;
using namespace mu::engraving;
namespace Ms {
//---------------------------------------------------------
@ -456,126 +457,126 @@ QString propertyUserName(Pid id)
// propertyFromString
//---------------------------------------------------------
QVariant propertyFromString(Pid id, QString value)
PropertyValue propertyFromString(Pid id, QString value)
{
switch (propertyType(id)) {
case P_TYPE::BOOL:
return QVariant(bool(value.toInt()));
return PropertyValue(bool(value.toInt()));
case P_TYPE::ZERO_INT:
case P_TYPE::INT:
return QVariant(value.toInt());
return PropertyValue(value.toInt());
case P_TYPE::REAL:
case P_TYPE::SPATIUM:
case P_TYPE::SP_REAL:
case P_TYPE::TEMPO:
return QVariant(value.toDouble());
return PropertyValue(value.toDouble());
case P_TYPE::FRACTION:
return Fraction::fromString(value);
case P_TYPE::COLOR:
// not used by MSCX
return QVariant::fromValue(mu::draw::Color(value.toLocal8Bit().data()));
return PropertyValue::fromValue(mu::draw::Color(value.toLocal8Bit().data()));
case P_TYPE::POINT:
case P_TYPE::POINT_SP:
case P_TYPE::POINT_SP_MM: {
// not used by MSCX
const int i = value.indexOf(';');
return QVariant::fromValue(PointF(value.leftRef(i).toDouble(), value.midRef(i + 1).toDouble()));
return PropertyValue::fromValue(PointF(value.leftRef(i).toDouble(), value.midRef(i + 1).toDouble()));
}
case P_TYPE::SCALE:
case P_TYPE::SIZE: {
// not used by MSCX
const int i = value.indexOf('x');
return QVariant::fromValue(SizeF(value.leftRef(i).toDouble(), value.midRef(i + 1).toDouble()));
return PropertyValue::fromValue(SizeF(value.leftRef(i).toDouble(), value.midRef(i + 1).toDouble()));
}
case P_TYPE::FONT:
case P_TYPE::STRING:
return value;
case P_TYPE::GLISS_STYLE: {
if (value == "whitekeys") {
return QVariant(int(GlissandoStyle::WHITE_KEYS));
return PropertyValue(int(GlissandoStyle::WHITE_KEYS));
} else if (value == "blackkeys") {
return QVariant(int(GlissandoStyle::BLACK_KEYS));
return PropertyValue(int(GlissandoStyle::BLACK_KEYS));
} else if (value == "diatonic") {
return QVariant(int(GlissandoStyle::DIATONIC));
return PropertyValue(int(GlissandoStyle::DIATONIC));
} else if (value == "portamento") {
return QVariant(int(GlissandoStyle::PORTAMENTO));
return PropertyValue(int(GlissandoStyle::PORTAMENTO));
} else { // e.g., normally "Chromatic"
return QVariant(int(GlissandoStyle::CHROMATIC));
return PropertyValue(int(GlissandoStyle::CHROMATIC));
}
}
break;
case P_TYPE::ORNAMENT_STYLE: {
if (value == "baroque") {
return QVariant(int(MScore::OrnamentStyle::BAROQUE));
return PropertyValue(int(MScore::OrnamentStyle::BAROQUE));
}
return QVariant(int(MScore::OrnamentStyle::DEFAULT));
return PropertyValue(int(MScore::OrnamentStyle::DEFAULT));
}
case P_TYPE::DIRECTION:
return QVariant::fromValue<Direction>(toDirection(value));
return PropertyValue::fromValue<Direction>(toDirection(value));
case P_TYPE::DIRECTION_H:
{
if (value == "left" || value == "1") {
return QVariant(int(MScore::DirectionH::LEFT));
return PropertyValue(int(MScore::DirectionH::LEFT));
} else if (value == "right" || value == "2") {
return QVariant(int(MScore::DirectionH::RIGHT));
return PropertyValue(int(MScore::DirectionH::RIGHT));
} else if (value == "auto") {
return QVariant(int(MScore::DirectionH::AUTO));
return PropertyValue(int(MScore::DirectionH::AUTO));
}
}
break;
case P_TYPE::LAYOUT_BREAK: {
if (value == "line") {
return QVariant(int(LayoutBreak::Type::LINE));
return PropertyValue(int(LayoutBreak::Type::LINE));
}
if (value == "page") {
return QVariant(int(LayoutBreak::Type::PAGE));
return PropertyValue(int(LayoutBreak::Type::PAGE));
}
if (value == "section") {
return QVariant(int(LayoutBreak::Type::SECTION));
return PropertyValue(int(LayoutBreak::Type::SECTION));
}
if (value == "nobreak") {
return QVariant(int(LayoutBreak::Type::NOBREAK));
return PropertyValue(int(LayoutBreak::Type::NOBREAK));
}
qDebug("getProperty: invalid P_TYPE::LAYOUT_BREAK: <%s>", qPrintable(value));
}
break;
case P_TYPE::VALUE_TYPE: {
if (value == "offset") {
return QVariant(int(Note::ValueType::OFFSET_VAL));
return PropertyValue(int(Note::ValueType::OFFSET_VAL));
} else if (value == "user") {
return QVariant(int(Note::ValueType::USER_VAL));
return PropertyValue(int(Note::ValueType::USER_VAL));
}
}
break;
case P_TYPE::PLACEMENT: {
if (value == "above") {
return QVariant(int(Placement::ABOVE));
return PropertyValue(int(Placement::ABOVE));
} else if (value == "below") {
return QVariant(int(Placement::BELOW));
return PropertyValue(int(Placement::BELOW));
}
}
break;
case P_TYPE::HPLACEMENT: {
if (value == "left") {
return QVariant(int(HPlacement::LEFT));
return PropertyValue(int(HPlacement::LEFT));
} else if (value == "center") {
return QVariant(int(HPlacement::CENTER));
return PropertyValue(int(HPlacement::CENTER));
} else if (value == "right") {
return QVariant(int(HPlacement::RIGHT));
return PropertyValue(int(HPlacement::RIGHT));
}
}
break;
case P_TYPE::TEXT_PLACE: {
if (value == "auto") {
return QVariant(int(PlaceText::AUTO));
return PropertyValue(int(PlaceText::AUTO));
} else if (value == "above") {
return QVariant(int(PlaceText::ABOVE));
return PropertyValue(int(PlaceText::ABOVE));
} else if (value == "below") {
return QVariant(int(PlaceText::BELOW));
return PropertyValue(int(PlaceText::BELOW));
} else if (value == "left") {
return QVariant(int(PlaceText::LEFT));
return PropertyValue(int(PlaceText::LEFT));
}
}
break;
@ -583,39 +584,39 @@ QVariant propertyFromString(Pid id, QString value)
bool ok;
const int ct = value.toInt(&ok);
if (ok) {
return QVariant(ct);
return PropertyValue(ct);
} else {
BarLineType t = BarLine::barLineType(value);
return QVariant::fromValue(t);
return PropertyValue::fromValue(t);
}
}
break;
case P_TYPE::BEAM_MODE:
return QVariant(int(0));
return PropertyValue(int(0));
case P_TYPE::GROUPS:
// unsupported
return QVariant();
return PropertyValue();
case P_TYPE::SYMID:
return QVariant::fromValue(SymNames::symIdByName(value));
return PropertyValue::fromValue(SymNames::symIdByName(value));
case P_TYPE::HEAD_SCHEME:
return QVariant::fromValue(NoteHead::name2scheme(value));
return PropertyValue::fromValue(int(NoteHead::name2scheme(value)));
case P_TYPE::HEAD_GROUP:
return QVariant::fromValue(NoteHead::name2group(value));
return PropertyValue::fromValue(int(NoteHead::name2group(value)));
case P_TYPE::HEAD_TYPE:
return QVariant::fromValue(NoteHead::name2type(value));
return PropertyValue::fromValue(int(NoteHead::name2type(value)));
case P_TYPE::POINT_MM: // not supported
case P_TYPE::TDURATION:
case P_TYPE::SIZE_MM:
case P_TYPE::INT_LIST:
return QVariant();
return PropertyValue();
case P_TYPE::SUB_STYLE:
return int(textStyleFromName(value));
case P_TYPE::ALIGN: {
QStringList sl = value.split(',');
if (sl.size() != 2) {
qDebug("bad align text <%s>", qPrintable(value));
return QVariant();
return PropertyValue();
}
Align align = Align::LEFT;
if (sl[0] == "center") {
@ -625,7 +626,7 @@ QVariant propertyFromString(Pid id, QString value)
} else if (sl[0] == "left") {
} else {
qDebug("bad align text <%s>", qPrintable(sl[0]));
return QVariant();
return PropertyValue();
}
if (sl[1] == "center") {
align = align | Align::VCENTER;
@ -636,56 +637,56 @@ QVariant propertyFromString(Pid id, QString value)
} else if (sl[1] == "top") {
} else {
qDebug("bad align text <%s>", qPrintable(sl[1]));
return QVariant();
return PropertyValue();
}
return int(align);
}
case P_TYPE::CHANGE_METHOD:
return QVariant(int(ChangeMap::nameToChangeMethod(value)));
return PropertyValue(int(ChangeMap::nameToChangeMethod(value)));
case P_TYPE::ORIENTATION:
if (value == "vertical") {
return QVariant(int(Orientation::VERTICAL));
return PropertyValue(int(Orientation::VERTICAL));
} else if (value == "horizontal") {
return QVariant(int(Orientation::HORIZONTAL));
return PropertyValue(int(Orientation::HORIZONTAL));
}
break;
default:
break;
}
return QVariant();
return PropertyValue();
}
//---------------------------------------------------------
// readProperty
//---------------------------------------------------------
QVariant readProperty(Pid id, XmlReader& e)
PropertyValue readProperty(Pid id, XmlReader& e)
{
switch (propertyType(id)) {
case P_TYPE::BOOL:
return QVariant(bool(e.readInt()));
return PropertyValue(bool(e.readInt()));
case P_TYPE::ZERO_INT:
case P_TYPE::INT:
return QVariant(e.readInt());
return PropertyValue(e.readInt());
case P_TYPE::REAL:
case P_TYPE::SPATIUM:
case P_TYPE::SP_REAL:
case P_TYPE::TEMPO:
return QVariant(e.readDouble());
return PropertyValue(e.readDouble());
case P_TYPE::FRACTION:
return QVariant::fromValue(e.readFraction());
return PropertyValue::fromValue(e.readFraction());
case P_TYPE::COLOR:
return QVariant::fromValue(e.readColor());
return PropertyValue::fromValue(e.readColor());
case P_TYPE::POINT:
case P_TYPE::POINT_SP:
case P_TYPE::POINT_SP_MM:
return QVariant::fromValue(e.readPoint());
return PropertyValue::fromValue(e.readPoint());
case P_TYPE::SCALE:
case P_TYPE::SIZE:
return QVariant::fromValue(e.readSize());
return PropertyValue::fromValue(e.readSize());
case P_TYPE::FONT:
case P_TYPE::STRING:
return QVariant(e.readElementText());
return PropertyValue(e.readElementText());
case P_TYPE::GLISS_STYLE:
case P_TYPE::ORNAMENT_STYLE:
case P_TYPE::DIRECTION:
@ -706,24 +707,24 @@ QVariant readProperty(Pid id, XmlReader& e)
return propertyFromString(id, e.readElementText());
case P_TYPE::BEAM_MODE:
return QVariant(int(0));
return PropertyValue(int(0));
case P_TYPE::GROUPS:
{
Groups g;
g.read(e);
return QVariant::fromValue(g);
return PropertyValue::fromValue(g);
}
case P_TYPE::POINT_MM: // not supported
case P_TYPE::TDURATION:
case P_TYPE::SIZE_MM:
case P_TYPE::INT_LIST:
return QVariant();
return PropertyValue();
default:
qFatal("unhandled PID type");
break;
}
return QVariant();
return PropertyValue();
}
//---------------------------------------------------------

View file

@ -26,6 +26,8 @@
#include <QVariant>
#include <QString>
#include "property/propertyvalue.h"
namespace Ms {
class XmlReader;
@ -392,61 +394,8 @@ enum class Pid {
END
};
enum class P_TYPE {
UNDEFINED = 0,
BOOL,
INT,
REAL,
SPATIUM,
SP_REAL, // real (point) value saved in (score) spatium units
FRACTION,
POINT,
POINT_SP, // point units, value saved in (score) spatium units
POINT_MM,
POINT_SP_MM, // point units, value saved as mm or spatium depending on EngravingItem->sizeIsSpatiumDependent()
SIZE,
SIZE_MM,
STRING,
SCALE,
COLOR,
DIRECTION, // enum class Direction
DIRECTION_H, // enum class MScore::DirectionH
ORNAMENT_STYLE, // enum class MScore::OrnamentStyle
TDURATION,
LAYOUT_BREAK,
VALUE_TYPE,
BEAM_MODE,
PLACEMENT, // ABOVE or BELOW
HPLACEMENT, // LEFT, CENTER or RIGHT
TEXT_PLACE,
TEMPO,
GROUPS,
SYMID,
INT_LIST,
GLISS_STYLE,
BARLINE_TYPE,
HEAD_TYPE, // enum class Notehead::Type
HEAD_GROUP, // enum class Notehead::Group
ZERO_INT, // displayed with offset +1
FONT,
SUB_STYLE,
ALIGN,
CHANGE_METHOD, // enum class VeloChangeMethod (for single note dynamics)
CHANGE_SPEED, // enum class Dynamic::Speed
CLEF_TYPE, // enum class ClefType
DYNAMIC_TYPE, // enum class DynamicType
KEYMODE, // enum class KeyMode
ORIENTATION, // enum class Orientation
PATH, // mu::PainterPath
HEAD_SCHEME, // enum class NoteHead::Scheme
PITCH_VALUES,
HOOK_TYPE
};
extern QVariant readProperty(Pid type, XmlReader& e);
extern QVariant propertyFromString(Pid type, QString value);
extern mu::engraving::PropertyValue readProperty(Pid type, XmlReader& e);
extern mu::engraving::PropertyValue propertyFromString(Pid type, QString value);
extern QString propertyToString(Pid, QVariant value, bool mscx);
extern P_TYPE propertyType(Pid);
extern const char* propertyName(Pid);

View file

@ -1033,7 +1033,7 @@ PropertyValue Rest::getProperty(Pid propertyId) const
// setProperty
//---------------------------------------------------------
bool Rest::setProperty(Pid propertyId, const QVariant& v)
bool Rest::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::GAP:
@ -1067,7 +1067,7 @@ bool Rest::setProperty(Pid propertyId, const QVariant& v)
void Rest::undoChangeDotsVisible(bool v)
{
for (NoteDot* dot : m_dots) {
dot->undoChangeProperty(Pid::VISIBLE, QVariant(v));
dot->undoChangeProperty(Pid::VISIBLE, v);
}
}

View file

@ -96,7 +96,7 @@ public:
void localSpatiumChanged(qreal oldValue, qreal newValue) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
void resetProperty(Pid id) override;
bool setProperty(Pid propertyId, const QVariant& v) override;
bool setProperty(Pid propertyId, const mu::engraving::PropertyValue& v) override;
mu::engraving::PropertyValue getProperty(Pid propertyId) const override;
void undoChangeDotsVisible(bool v);

View file

@ -46,7 +46,7 @@ public:
Ms::EngravingItem* clone() const override { return nullptr; }
mu::engraving::PropertyValue getProperty(Ms::Pid) const override { return mu::engraving::PropertyValue(); }
bool setProperty(Ms::Pid, const QVariant&) override { return false; }
bool setProperty(Ms::Pid, const mu::engraving::PropertyValue&) override { return false; }
private:

View file

@ -4940,7 +4940,7 @@ PropertyValue Score::getProperty(Pid /*id*/) const
// setProperty
//---------------------------------------------------------
bool Score::setProperty(Pid /*id*/, const QVariant& /*v*/)
bool Score::setProperty(Pid /*id*/, const PropertyValue& /*v*/)
{
qDebug("Score::setProperty: unhandled id");
setLayoutAll();

View file

@ -672,8 +672,8 @@ public:
void undoChangeUserMirror(Note*, MScore::DirectionH);
void undoChangeKeySig(Staff* ostaff, const Fraction& tick, KeySigEvent);
void undoChangeClef(Staff* ostaff, EngravingItem*, ClefType st, bool forInstrumentChange = false);
bool undoPropertyChanged(EngravingItem* e, Pid t, const QVariant& st, PropertyFlags ps = PropertyFlags::NOSTYLE);
void undoPropertyChanged(EngravingObject*, Pid, const QVariant& v, PropertyFlags ps = PropertyFlags::NOSTYLE);
bool undoPropertyChanged(EngravingItem* e, Pid t, const mu::engraving::PropertyValue& st, PropertyFlags ps = PropertyFlags::NOSTYLE);
void undoPropertyChanged(EngravingObject*, Pid, const mu::engraving::PropertyValue& v, PropertyFlags ps = PropertyFlags::NOSTYLE);
virtual UndoStack* undoStack() const;
void undo(UndoCommand*, EditData* = 0) const;
void undoRemoveMeasures(Measure*, Measure*, bool preserveTies = false);
@ -1217,7 +1217,7 @@ public:
void switchToPageMode();
mu::engraving::PropertyValue getProperty(Pid) const override;
bool setProperty(Pid, const QVariant&) override;
bool setProperty(Pid, const mu::engraving::PropertyValue&) override;
mu::engraving::PropertyValue propertyDefault(Pid) const override;
virtual QQueue<MidiInputEvent>* midiInputQueue();

Some files were not shown because too many files have changed in this diff Show more