From 294a6b0aa1a86d886836e0c7b0bd106d3c82aa44 Mon Sep 17 00:00:00 2001 From: XiaoMigros Date: Thu, 14 Nov 2024 12:47:53 +0100 Subject: [PATCH] Change frame color with text color Backport of #25508 and fix a clazy warning --- libmscore/textbase.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libmscore/textbase.cpp b/libmscore/textbase.cpp index c1c7070b386fd..f02c7b6f6da68 100644 --- a/libmscore/textbase.cpp +++ b/libmscore/textbase.cpp @@ -33,7 +33,7 @@ namespace Ms { #endif static const qreal subScriptSize = 0.6; -static const qreal subScriptOffset = 0.5; // of x-height +static const qreal subScriptOffset = 0.5; // of x-height static const qreal superScriptOffset = -.9; // of x-height //static const qreal tempotextOffset = 0.4; // of x-height // 80% of 50% = 2 spatiums @@ -188,9 +188,10 @@ QChar TextCursor::currentCharacter() const QString TextCursor::currentWord() const { + static QRegularExpression regex (" .*"); const TextBlock& t = _text->_layout[row()]; QString s = t.text(column(), -1); - return s.remove(QRegularExpression(" .*")); + return s.remove(regex); } //--------------------------------------------------------- @@ -2819,6 +2820,11 @@ bool TextBase::setProperty(Pid pid, const QVariant& v) genText(); bool rv = true; switch (pid) { + case Pid::COLOR: + if (color() == frameColor()) + setFrameColor(v.value()); + Element::setProperty(pid, v); + break; case Pid::SUB_STYLE: initTid(Tid(v.toInt())); break;