Skip to content

Commit 1bf1bec

Browse files
committed
Set text property flags when begin hook is changed
The default value of text depends on the value of begin hook
1 parent 9465a64 commit 1bf1bec

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/engraving/dom/pedal.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,31 @@ engraving::PropertyValue Pedal::propertyDefault(Pid propertyId) const
196196
}
197197
}
198198

199+
bool Pedal::setProperty(Pid propertyId, const PropertyValue& v)
200+
{
201+
// Update style flag for text
202+
if (propertyId == Pid::BEGIN_HOOK_TYPE) {
203+
setBeginHookType(v.value<HookType>());
204+
205+
PropertyFlags beginTextStyleFlag = beginText() == propertyDefault(Pid::BEGIN_TEXT).value<String>()
206+
? PropertyFlags::STYLED : PropertyFlags::UNSTYLED;
207+
setPropertyFlags(Pid::BEGIN_TEXT, beginTextStyleFlag);
208+
PropertyFlags continueTextStyleFlag = continueText() == propertyDefault(Pid::CONTINUE_TEXT).value<String>()
209+
? PropertyFlags::STYLED : PropertyFlags::UNSTYLED;
210+
setPropertyFlags(Pid::CONTINUE_TEXT, continueTextStyleFlag);
211+
} else if (propertyId == Pid::LINE_VISIBLE) {
212+
setLineVisible(v.toBool());
213+
PropertyFlags endTextStyleFlag = endText() == propertyDefault(Pid::END_TEXT).value<String>()
214+
? PropertyFlags::STYLED : PropertyFlags::UNSTYLED;
215+
setPropertyFlags(Pid::END_TEXT, endTextStyleFlag);
216+
} else {
217+
return TextLineBase::setProperty(propertyId, v);
218+
}
219+
220+
triggerLayout();
221+
return true;
222+
}
223+
199224
Pedal* Pedal::findNextInStaff() const
200225
{
201226
Fraction endTick = tick2();

src/engraving/dom/pedal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Pedal final : public TextLineBase
7272

7373
LineSegment* createLineSegment(System* parent) override;
7474
PropertyValue propertyDefault(Pid propertyId) const override;
75+
bool setProperty(Pid propertyId, const PropertyValue& v) override;
7576

7677
Pedal* findNextInStaff() const;
7778
bool connect45HookToNext() const;

0 commit comments

Comments
 (0)