Skip to content

Commit 32231b7

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 32231b7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/engraving/dom/pedal.cpp

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

199+
bool Pedal::setProperty(Pid propertyId, const PropertyValue& v)
200+
{
201+
if (propertyId == Pid::BEGIN_HOOK_TYPE) {
202+
setBeginHookType(v.value<HookType>());
203+
204+
// Update style flag for text
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+
PropertyFlags endTextStyleFlag = endText() == propertyDefault(Pid::END_TEXT).value<String>()
212+
? PropertyFlags::STYLED : PropertyFlags::UNSTYLED;
213+
setPropertyFlags(Pid::END_TEXT, endTextStyleFlag);
214+
triggerLayout();
215+
return true;
216+
}
217+
218+
return TextLineBase::setProperty(propertyId, v);
219+
}
220+
199221
Pedal* Pedal::findNextInStaff() const
200222
{
201223
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)