diff --git a/importexport/musicxml/exportxml.cpp b/importexport/musicxml/exportxml.cpp
index b4176d83943f0..c2c47d959c25c 100644
--- a/importexport/musicxml/exportxml.cpp
+++ b/importexport/musicxml/exportxml.cpp
@@ -598,6 +598,9 @@ static QString fontStyleToXML(const FontStyle style, bool allowUnderline = true)
res += " font-style=\"italic\"";
if (allowUnderline && style & FontStyle::Underline)
res += " underline=\"1\"";
+ // at places where underline is not wanted (e.g. fingering, pluck), strike is not wanted too
+ if (allowUnderline && style & FontStyle::Strike)
+ res += " line-through=\"1\"";
return res;
}
diff --git a/importexport/musicxml/importmxmlpass1.cpp b/importexport/musicxml/importmxmlpass1.cpp
index 35afcec0788e1..e9be41bddcd13 100644
--- a/importexport/musicxml/importmxmlpass1.cpp
+++ b/importexport/musicxml/importmxmlpass1.cpp
@@ -1316,6 +1316,7 @@ static QString nextPartOfFormattedString(QXmlStreamReader& e)
QString fontSize = e.attributes().value("font-size").toString();
QString fontStyle = e.attributes().value("font-style").toString();
QString underline = e.attributes().value("underline").toString();
+ QString strike = e.attributes().value("line-through").toString();
QString fontFamily = e.attributes().value("font-family").toString();
// TODO: color, enclosure, yoffset in only part of the text, ...
@@ -1346,11 +1347,19 @@ static QString nextPartOfFormattedString(QXmlStreamReader& e)
if (!underline.isEmpty()) {
bool ok = true;
int lines = underline.toInt(&ok);
- if (ok && (lines > 0)) // 1,2, or 3 underlines are imported as single underline
+ if (ok && (lines > 0)) // 1, 2, or 3 underlines are imported as single underline
importedtext += "";
else
underline = "";
}
+ if (!strike.isEmpty()) {
+ bool ok = true;
+ int lines = strike.toInt(&ok);
+ if (ok && (lines > 0)) // 1, 2, or 3 strikes are imported as single strike
+ importedtext += "";
+ else
+ strike = "";
+ }
if (txt == syms) {
txt.replace(QString("\r"), QString("")); // convert Windows line break \r\n -> \n
importedtext += txt.toHtmlEscaped();
@@ -1359,6 +1368,8 @@ static QString nextPartOfFormattedString(QXmlStreamReader& e)
// replacement made, should be no need for line break or other conversions
importedtext += syms;
}
+ if (strike != "")
+ importedtext += "";
if (underline != "")
importedtext += "";
if (fontStyle == "italic")
diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp
index 4887113745e9a..48e884f08269c 100644
--- a/importexport/musicxml/importmxmlpass2.cpp
+++ b/importexport/musicxml/importmxmlpass2.cpp
@@ -781,6 +781,7 @@ static QString nextPartOfFormattedString(QXmlStreamReader& e)
QString fontSize = e.attributes().value("font-size").toString();
QString fontStyle = e.attributes().value("font-style").toString();
QString underline = e.attributes().value("underline").toString();
+ QString strike = e.attributes().value("line-through").toString();
QString fontFamily = e.attributes().value("font-family").toString();
// TODO: color, enclosure, yoffset in only part of the text, ...
@@ -811,11 +812,19 @@ static QString nextPartOfFormattedString(QXmlStreamReader& e)
if (!underline.isEmpty()) {
bool ok = true;
int lines = underline.toInt(&ok);
- if (ok && (lines > 0)) // 1,2, or 3 underlines are imported as single underline
+ if (ok && (lines > 0)) // 1, 2, or 3 underlines are imported as single underline
importedtext += "";
else
underline = "";
}
+ if (!strike.isEmpty()) {
+ bool ok = true;
+ int lines = underline.toInt(&ok);
+ if (ok && (lines > 0)) // 1, 2, or 3 strike are imported as single strike
+ importedtext += "";
+ else
+ strike = "";
+ }
if (txt == syms) {
txt.replace(QString("\r"), QString("")); // convert Windows line break \r\n -> \n
importedtext += txt.toHtmlEscaped();
@@ -824,6 +833,8 @@ static QString nextPartOfFormattedString(QXmlStreamReader& e)
// replacement made, should be no need for line break or other conversions
importedtext += syms;
}
+ if (underline != "")
+ importedtext += "";
if (underline != "")
importedtext += "";
if (fontStyle == "italic")
diff --git a/importexport/musicxml/musicxmlfonthandler.cpp b/importexport/musicxml/musicxmlfonthandler.cpp
index 6b874c3e17d41..e4c7998d40491 100644
--- a/importexport/musicxml/musicxmlfonthandler.cpp
+++ b/importexport/musicxml/musicxmlfonthandler.cpp
@@ -35,10 +35,11 @@ namespace Ms {
#if 0
static QString charFormat2QString(const CharFormat& f)
{
- return QString("b %1 i %2 u %3 va %4 fs %5 fam %6")
+ return QString("b %1 i %2 u %3 s %4 va %5 fs %6 fam %7")
.arg(f.bold())
.arg(f.italic())
.arg(f.underline())
+ .arg(f.strike())
.arg(static_cast(f.valign()))
.arg(f.fontSize())
.arg(f.fontFamily())
@@ -82,6 +83,7 @@ MScoreTextToMXML::MScoreTextToMXML(const QString& tag, const QString& attr, cons
oldFormat.setBold(false);
oldFormat.setItalic(false);
oldFormat.setUnderline(false);
+ oldFormat.setStrike(false);
}
//---------------------------------------------------------
@@ -272,6 +274,7 @@ QString MScoreTextToMXML::updateFormat()
res += attribute(newFormat.bold() != oldFormat.bold(), newFormat.bold(), "font-weight=\"bold\"", "font-weight=\"normal\"");
res += attribute(newFormat.italic() != oldFormat.italic(), newFormat.italic(), "font-style=\"italic\"", "font-style=\"normal\"");
res += attribute(newFormat.underline() != oldFormat.underline(), newFormat.underline(), "underline=\"1\"", "underline=\"0\"");
+ res += attribute(newFormat.strike() != oldFormat.strike(), newFormat.strike(), "line-through=\"1\"", "line-through=\"0\"");
res += attribute(newFormat.fontFamily() != oldFormat.fontFamily(), true, QString("font-family=\"%1\"").arg(newFormat.fontFamily()), "");
bool needSize = newFormat.fontSize() < 0.99 * oldFormat.fontSize() || newFormat.fontSize() > 1.01 * oldFormat.fontSize();
res += attribute(needSize, true, QString("font-size=\"%1\"").arg(newFormat.fontSize()), "");
diff --git a/libmscore/bend.cpp b/libmscore/bend.cpp
index d0110767f62aa..154d0a66dc7f2 100644
--- a/libmscore/bend.cpp
+++ b/libmscore/bend.cpp
@@ -57,6 +57,7 @@ QFont Bend::font(qreal sp) const
f.setBold(_fontStyle & FontStyle::Bold);
f.setItalic(_fontStyle & FontStyle::Italic);
f.setUnderline(_fontStyle & FontStyle::Underline);
+ f.setStrikeOut(_fontStyle & FontStyle::Strike);
qreal m = _fontSize;
m *= sp / SPATIUM20;
diff --git a/libmscore/glissando.cpp b/libmscore/glissando.cpp
index 30e8645ac3cf9..1adb1ab9e0f25 100644
--- a/libmscore/glissando.cpp
+++ b/libmscore/glissando.cpp
@@ -118,6 +118,7 @@ void GlissandoSegment::draw(QPainter* painter) const
f.setBold(glissando()->fontStyle() & FontStyle::Bold);
f.setItalic(glissando()->fontStyle() & FontStyle::Italic);
f.setUnderline(glissando()->fontStyle() & FontStyle::Underline);
+ f.setStrikeOut(glissando()->fontStyle() & FontStyle::Strike);
QFontMetricsF fm(f, painter->device()); // use the QPaintDevice, otherwise calculations will be done in screen metrics
QRectF r = fm.boundingRect(glissando()->text());
diff --git a/libmscore/read114.cpp b/libmscore/read114.cpp
index 265c1feae14c3..08f4b5c21cde5 100644
--- a/libmscore/read114.cpp
+++ b/libmscore/read114.cpp
@@ -169,7 +169,15 @@ QString convertFromHtml(TextBase* t, const QString& ss)
s += "";
if (font.underline())
s += "";
+#if 0 // should not happen, but won't harm either
+ if (font.strikeOut())
+ s += "";
+#endif
s += f.text().toHtmlEscaped();
+#if 0 // see above
+ if (font.strikeOut())
+ s += "";
+#endif
if (font.underline())
s += "";
if (font.italic())
diff --git a/libmscore/read206.cpp b/libmscore/read206.cpp
index a26a23179ae85..230b9d0166829 100644
--- a/libmscore/read206.cpp
+++ b/libmscore/read206.cpp
@@ -187,6 +187,12 @@ void readTextStyle206(MStyle* style, XmlReader& e, std::map, 3> styleNamesEndings {{
+ static const std::array, 4> styleNamesEndings {{
{ "FontBold", FontStyle::Bold },
{ "FontItalic", FontStyle::Italic },
- { "FontUnderline", FontStyle::Underline }
+ { "FontUnderline", FontStyle::Underline },
+ { "FontStrike", FontStyle::Strike }
}};
const QStringRef tag(e.name());
diff --git a/libmscore/textbase.cpp b/libmscore/textbase.cpp
index f5fc91f178520..4315bd75d98d8 100644
--- a/libmscore/textbase.cpp
+++ b/libmscore/textbase.cpp
@@ -765,7 +765,7 @@ void TextFragment::draw(QPainter* p, const TextBase* t) const
void TextBase::drawTextWorkaround(QPainter* p, QFont& f, const QPointF pos, const QString text)
{
qreal mm = p->worldTransform().m11();
- if (!(MScore::pdfPrinting) && (mm < 1.0) && f.bold() && !(f.underline())) {
+ if (!(MScore::pdfPrinting) && (mm < 1.0) && f.bold() && !(f.underline() || f.strikeOut())) {
// workaround for https://musescore.org/en/node/284218
// and https://musescore.org/en/node/281601
// only needed for certain artificially emboldened fonts
@@ -849,6 +849,7 @@ QFont TextFragment::font(const TextBase* t) const
if (format.valign() != VerticalAlignment::AlignNormal)
m *= subScriptSize;
font.setUnderline(format.underline() || format.preedit());
+ font.setStrikeOut(format.strike() || format.preedit());
QString family;
if (format.fontFamily() == "ScoreText") {
@@ -1405,6 +1406,9 @@ void CharFormat::setFormat(FormatId id, QVariant data)
case FormatId::Underline:
setUnderline(data.toBool());
break;
+ case FormatId::Strike:
+ setStrike(data.toBool());
+ break;
case FormatId::Valign:
_valign = static_cast(data.toInt());
break;
@@ -1963,6 +1967,7 @@ class XmlNesting : public QStack {
void pushB() { pushToken("b"); }
void pushI() { pushToken("i"); }
void pushU() { pushToken("u"); }
+ void pushS() { pushToken("s"); }
QString popToken() {
QString s = pop();
@@ -1985,6 +1990,7 @@ class XmlNesting : public QStack {
void popB() { popToken("b"); }
void popI() { popToken("i"); }
void popU() { popToken("u"); }
+ void popS() { popToken("s"); }
};
//---------------------------------------------------------
@@ -1997,6 +2003,7 @@ void TextBase::genText() const
bool bold_ = false;
bool italic_ = false;
bool underline_ = false;
+ bool strike_ = false;
for (const TextBlock& block : _layout) {
for (const TextFragment& f : block.fragments()) {
@@ -2006,6 +2013,8 @@ void TextBase::genText() const
italic_ = true;
if (!f.format.underline() && underline())
underline_ = true;
+ if (!f.format.strike() && strike())
+ strike_ = true;
}
}
CharFormat fmt;
@@ -2022,6 +2031,8 @@ void TextBase::genText() const
xmlNesting.pushI();
if (underline_)
xmlNesting.pushU();
+ if (strike_)
+ xmlNesting.pushS();
for (const TextBlock& block : _layout) {
for (const TextFragment& f : block.fragments()) {
@@ -2047,6 +2058,12 @@ void TextBase::genText() const
else
xmlNesting.popU();
}
+ if (fmt.strike() != format.strike()) {
+ if (format.strike())
+ xmlNesting.pushS();
+ else
+ xmlNesting.popS();
+ }
if (format.fontSize() != fmt.fontSize())
_text += QString("").arg(format.fontSize());
@@ -2185,28 +2202,24 @@ bool TextBase::readProperties(XmlReader& e)
setXmlText(e.readXml());
else if (tag == "bold") {
bool val = e.readInt();
- if (val)
- _fontStyle = _fontStyle + FontStyle::Bold;
- else
- _fontStyle = _fontStyle - FontStyle::Bold;
+ setBold(val);
if (isStyled(Pid::FONT_STYLE))
setPropertyFlags(Pid::FONT_STYLE, PropertyFlags::UNSTYLED);
}
else if (tag == "italic") {
bool val = e.readInt();
- if (val)
- _fontStyle = _fontStyle + FontStyle::Italic;
- else
- _fontStyle = _fontStyle - FontStyle::Italic;
+ setItalic(val);
if (isStyled(Pid::FONT_STYLE))
setPropertyFlags(Pid::FONT_STYLE, PropertyFlags::UNSTYLED);
}
else if (tag == "underline") {
bool val = e.readInt();
- if (val)
- _fontStyle = _fontStyle + FontStyle::Underline;
- else
- _fontStyle = _fontStyle - FontStyle::Underline;
+ setUnderline(val); if (isStyled(Pid::FONT_STYLE))
+ setPropertyFlags(Pid::FONT_STYLE, PropertyFlags::UNSTYLED);
+ }
+ else if (tag == "strike") {
+ bool val = e.readInt();
+ setStrike(val);
if (isStyled(Pid::FONT_STYLE))
setPropertyFlags(Pid::FONT_STYLE, PropertyFlags::UNSTYLED);
}
@@ -2446,7 +2459,11 @@ QString TextBase::convertFromHtml(const QString& ss) const
s += "";
if (font.underline())
s += "";
+ if (font.strikeOut())
+ s += "";
s += f.text().toHtmlEscaped();
+ if (font.strikeOut())
+ s += "";
if (font.underline())
s += "";
if (font.italic())
@@ -2674,7 +2691,7 @@ bool TextBase::validateText(QString& s)
d.append("&");
}
else if (c == '<') {
- const char* ok[] { "b>", "/b>", "i>", "/i>", "u>", "/u", "font ", "/font>", "sym>", "/sym>", "sub>", "/sub>", "sup>", "/sup>" };
+ const char* ok[] { "b>", "/b>", "i>", "/i>", "u>", "/u", "s>", "/s>", "font ", "/font>", "sym>", "/sym>", "sub>", "/sub>", "sup>", "/sup>" };
QString t = s.mid(i+1);
bool found = false;
for (auto k : ok) {
@@ -2720,6 +2737,8 @@ QFont TextBase::font() const
QFont f(_family, m, bold() ? QFont::Bold : QFont::Normal, italic());
if (underline())
f.setUnderline(underline());
+ if (strike())
+ f.setStrikeOut(strike());
return f;
}
@@ -3205,6 +3224,7 @@ QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace)
bool bold_ = false;
bool italic_ = false;
bool underline_ = false;
+ bool strike_ = false;
for (const TextBlock& block : _layout) {
for (const TextFragment& f : block.fragments()) {
@@ -3214,6 +3234,8 @@ QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace)
italic_ = true;
if (!f.format.underline() && underline())
underline_ = true;
+ if (!f.format.strike() && strike())
+ strike_ = true;
}
}
CharFormat fmt;
@@ -3231,6 +3253,8 @@ QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace)
xmlNesting.pushI();
if (underline_)
xmlNesting.pushU();
+ if (strike_)
+ xmlNesting.pushS();
}
for (const TextBlock& block : _layout) {
@@ -3257,6 +3281,12 @@ QString TextBase::stripText(bool removeStyle, bool removeSize, bool removeFace)
else
xmlNesting.popU();
}
+ if (fmt.strike() != format.strike()) {
+ if (format.strike())
+ xmlNesting.pushS();
+ else
+ xmlNesting.popS();
+ }
}
if (!removeSize && (format.fontSize() != fmt.fontSize()))
diff --git a/libmscore/textbase.h b/libmscore/textbase.h
index 27c7a03dcbaf9..0840cf049700e 100644
--- a/libmscore/textbase.h
+++ b/libmscore/textbase.h
@@ -46,7 +46,7 @@ enum class VerticalAlignment : char {
//---------------------------------------------------------
enum class FormatId : char {
- Bold, Italic, Underline, Valign, FontSize, FontFamily
+ Bold, Italic, Underline, Strike, Valign, FontSize, FontFamily
};
//---------------------------------------------------------
@@ -78,9 +78,11 @@ class CharFormat {
bool bold() const { return _style & FontStyle::Bold; }
bool italic() const { return _style & FontStyle::Italic; }
bool underline() const { return _style & FontStyle::Underline; }
+ bool strike() const { return _style & FontStyle::Strike; }
void setBold(bool val) { _style = val ? _style + FontStyle::Bold : _style - FontStyle::Bold; }
void setItalic(bool val) { _style = val ? _style + FontStyle::Italic : _style - FontStyle::Italic; }
void setUnderline(bool val) { _style = val ? _style + FontStyle::Underline : _style - FontStyle::Underline; }
+ void setStrike(bool val) { _style = val ? _style + FontStyle::Strike : _style - FontStyle::Strike; }
bool preedit() const { return _preedit; }
VerticalAlignment valign() const { return _valign; }
@@ -396,9 +398,11 @@ class TextBase : public Element {
bool bold() const { return _fontStyle & FontStyle::Bold; }
bool italic() const { return _fontStyle & FontStyle::Italic; }
bool underline() const { return _fontStyle & FontStyle::Underline; }
+ bool strike() const { return _fontStyle & FontStyle::Strike; }
void setBold(bool val) { _fontStyle = val ? _fontStyle + FontStyle::Bold : _fontStyle - FontStyle::Bold; }
void setItalic(bool val) { _fontStyle = val ? _fontStyle + FontStyle::Italic : _fontStyle - FontStyle::Italic; }
void setUnderline(bool val) { _fontStyle = val ? _fontStyle + FontStyle::Underline : _fontStyle - FontStyle::Underline; }
+ void setStrike(bool val) { _fontStyle = val ? _fontStyle + FontStyle::Strike : _fontStyle - FontStyle::Strike; }
bool hasCustomFormatting() const;
diff --git a/libmscore/textlinebase.cpp b/libmscore/textlinebase.cpp
index 40f727998a38b..acff7d636ea1c 100644
--- a/libmscore/textlinebase.cpp
+++ b/libmscore/textlinebase.cpp
@@ -250,6 +250,7 @@ void TextLineBaseSegment::layout()
_text->setBold(tl->beginFontStyle() & FontStyle::Bold);
_text->setItalic(tl->beginFontStyle() & FontStyle::Italic);
_text->setUnderline(tl->beginFontStyle() & FontStyle::Underline);
+ _text->setStrike(tl->beginFontStyle() & FontStyle::Strike);
break;
case SpannerSegmentType::MIDDLE:
case SpannerSegmentType::END:
@@ -261,7 +262,7 @@ void TextLineBaseSegment::layout()
_text->setBold(tl->continueFontStyle() & FontStyle::Bold);
_text->setItalic(tl->continueFontStyle() & FontStyle::Italic);
_text->setUnderline(tl->continueFontStyle() & FontStyle::Underline);
-
+ _text->setStrike(tl->continueFontStyle() & FontStyle::Strike);
break;
}
_text->setPlacement(Placement::ABOVE);
@@ -277,6 +278,7 @@ void TextLineBaseSegment::layout()
_endText->setBold(tl->endFontStyle() & FontStyle::Bold);
_endText->setItalic(tl->endFontStyle() & FontStyle::Italic);
_endText->setUnderline(tl->endFontStyle() & FontStyle::Underline);
+ _endText->setStrike(tl->endFontStyle() & FontStyle::Strike);
_endText->setPlacement(Placement::ABOVE);
_endText->setTrack(track());
_endText->layout();
diff --git a/libmscore/tuplet.cpp b/libmscore/tuplet.cpp
index 60bd7a5f72d10..40176f7c80b62 100644
--- a/libmscore/tuplet.cpp
+++ b/libmscore/tuplet.cpp
@@ -847,6 +847,13 @@ bool Tuplet::readProperties(XmlReader& e)
if (isStyled(Pid::FONT_STYLE))
setPropertyFlags(Pid::FONT_STYLE, PropertyFlags::UNSTYLED);
}
+ else if (tag == "strike") {
+ bool val = e.readInt();
+ if (_number)
+ _number->setStrike(val);
+ if (isStyled(Pid::FONT_STYLE))
+ setPropertyFlags(Pid::FONT_STYLE, PropertyFlags::UNSTYLED);
+ }
else if (tag == "normalNotes")
_ratio.setDenominator(e.readInt());
else if (tag == "actualNotes")
diff --git a/libmscore/types.h b/libmscore/types.h
index 5a9002410d29b..1d34d777f9277 100644
--- a/libmscore/types.h
+++ b/libmscore/types.h
@@ -588,7 +588,11 @@ constexpr Align operator~ (Align a) {
//---------------------------------------------------------
enum class FontStyle : char {
- Normal = 0, Bold = 1, Italic = 2, Underline = 4
+ Normal = 0,
+ Bold = 1 << 0,
+ Italic = 1 << 1,
+ Underline = 1 << 2,
+ Strike = 1 << 3
};
constexpr FontStyle operator+ (FontStyle a1, FontStyle a2) {
diff --git a/mscore/data/icons/format-text-strike.svg b/mscore/data/icons/format-text-strike.svg
new file mode 100644
index 0000000000000..1bff9fc6a44c4
--- /dev/null
+++ b/mscore/data/icons/format-text-strike.svg
@@ -0,0 +1,12 @@
+
+
diff --git a/mscore/icons.cpp b/mscore/icons.cpp
index b1ee525625d91..f9163909a2ded 100644
--- a/mscore/icons.cpp
+++ b/mscore/icons.cpp
@@ -110,6 +110,7 @@ static const char* iconNames[] = {
"format-text-bold.svg",
"format-text-italic.svg",
"format-text-underline.svg",
+ "format-text-strike.svg",
"format-justify-left.svg",
"format-justify-center.svg",
"format-justify-right.svg",
diff --git a/mscore/icons.h b/mscore/icons.h
index 6fc61587d6276..e1261d0ec5ade 100644
--- a/mscore/icons.h
+++ b/mscore/icons.h
@@ -42,7 +42,7 @@ enum class Icons : short { Invalid_ICON = -1,
noteEntry_ICON, // noteEntrySteptime_ICON, (using normal icon for the time being.)
noteEntryRepitch_ICON, noteEntryRhythm_ICON, noteEntryRealtimeAuto_ICON, noteEntryRealtimeManual_ICON,
keys_ICON, tie_ICON,
- textBold_ICON, textItalic_ICON, textUnderline_ICON,
+ textBold_ICON, textItalic_ICON, textUnderline_ICON, textStrike_ICON,
textLeft_ICON, textCenter_ICON, textRight_ICON, textTop_ICON, textBottom_ICON, textVCenter_ICON, textBaseline_ICON,
textSuper_ICON, textSub_ICON,
fotomode_ICON,
diff --git a/mscore/inspector/fontStyleSelect.cpp b/mscore/inspector/fontStyleSelect.cpp
index 16585ea41b988..d6d943eeae3ab 100644
--- a/mscore/inspector/fontStyleSelect.cpp
+++ b/mscore/inspector/fontStyleSelect.cpp
@@ -27,10 +27,12 @@ FontStyleSelect::FontStyleSelect(QWidget* parent)
bold->setIcon(*icons[int(Icons::textBold_ICON)]);
italic->setIcon(*icons[int(Icons::textItalic_ICON)]);
underline->setIcon(*icons[int(Icons::textUnderline_ICON)]);
+ strike->setIcon(*icons[int(Icons::textStrike_ICON)]);
connect(bold, SIGNAL(toggled(bool)), SLOT(_fontStyleChanged()));
connect(italic, SIGNAL(toggled(bool)), SLOT(_fontStyleChanged()));
connect(underline, SIGNAL(toggled(bool)), SLOT(_fontStyleChanged()));
+ connect(strike, SIGNAL(toggled(bool)), SLOT(_fontStyleChanged()));
}
//---------------------------------------------------------
@@ -56,6 +58,8 @@ FontStyle FontStyleSelect::fontStyle() const
fs = fs + FontStyle::Italic;
if (underline->isChecked())
fs = fs + FontStyle::Underline;
+ if (strike->isChecked())
+ fs = fs + FontStyle::Strike;
return fs;
}
@@ -69,6 +73,7 @@ void FontStyleSelect::setFontStyle(FontStyle fs)
bold->setChecked(fs & FontStyle::Bold);
italic->setChecked(fs & FontStyle::Italic);
underline->setChecked(fs & FontStyle::Underline);
+ strike->setChecked(fs & FontStyle::Strike);
}
}
diff --git a/mscore/inspector/font_style_select.ui b/mscore/inspector/font_style_select.ui
index 08df7e715b514..0f6e16961be74 100644
--- a/mscore/inspector/font_style_select.ui
+++ b/mscore/inspector/font_style_select.ui
@@ -125,6 +125,35 @@
+ -
+
+
+
+ 28
+ 28
+
+
+
+
+ 28
+ 28
+
+
+
+ Strike
+
+
+
+ :/data/icons/format-text-strike.svg:/data/icons/format-text-strike.svg
+
+
+ true
+
+
+ true
+
+
+
diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp
index 0d8b25638e5f1..57c5cc715d7c9 100644
--- a/mscore/musescore.cpp
+++ b/mscore/musescore.cpp
@@ -6520,6 +6520,10 @@ void MuseScore::cmd(QAction* a, const QString& cmd)
if (_textTools)
_textTools->toggleUnderline();
}
+ else if (cmd == "text-s") {
+ if (_textTools)
+ _textTools->toggleStrike();
+ }
else if (cmd == "edit-toolbars")
showToolbarEditor();
else if (cmd == "viewmode") {
diff --git a/mscore/musescore.qrc b/mscore/musescore.qrc
index 784dd8c2ed239..4711145fc1a61 100644
--- a/mscore/musescore.qrc
+++ b/mscore/musescore.qrc
@@ -146,6 +146,7 @@
data/icons/format-text-subscript.svg
data/icons/format-text-superscript.svg
data/icons/format-text-underline.svg
+ data/icons/format-text-strike.svg
data/icons/list-ordered.svg
data/icons/list-unordered.svg
data/icons/format-indent-less.svg
diff --git a/mscore/shortcut.cpp b/mscore/shortcut.cpp
index 0733b54d76aa6..71a312bd04efa 100644
--- a/mscore/shortcut.cpp
+++ b/mscore/shortcut.cpp
@@ -3773,6 +3773,12 @@ Shortcut Shortcut::_sc[] = {
"text-u",
QT_TRANSLATE_NOOP("action","Underline")
},
+ {
+ MsWidget::SCORE_TAB,
+ STATE_TEXT_EDIT,
+ "text-s",
+ QT_TRANSLATE_NOOP("action","Strike-trough")
+ },
{
MsWidget::SCORE_TAB,
STATE_TEXT_EDIT,
diff --git a/mscore/texttools.cpp b/mscore/texttools.cpp
index 1c972765617e4..40728bb0d7539 100644
--- a/mscore/texttools.cpp
+++ b/mscore/texttools.cpp
@@ -78,6 +78,9 @@ TextTools::TextTools(QWidget* parent)
typefaceUnderline = toolbar->addAction(*icons[int(Icons::textUnderline_ICON)], "");
typefaceUnderline->setCheckable(true);
+ typefaceStrike = toolbar->addAction(*icons[int(Icons::textStrike_ICON)], "");
+ typefaceStrike->setCheckable(true);
+
toolbar->addSeparator();
typefaceSubscript = toolbar->addAction(*icons[int(Icons::textSub_ICON)], "");
@@ -107,6 +110,7 @@ TextTools::TextTools(QWidget* parent)
connect(typefaceBold, SIGNAL(triggered(bool)), SLOT(boldClicked(bool)));
connect(typefaceItalic, SIGNAL(triggered(bool)), SLOT(italicClicked(bool)));
connect(typefaceUnderline, SIGNAL(triggered(bool)), SLOT(underlineClicked(bool)));
+ connect(typefaceStrike, SIGNAL(triggered(bool)), SLOT(StrikeClicked(bool)));
connect(typefaceSubscript, SIGNAL(triggered(bool)), SLOT(subscriptClicked(bool)));
connect(typefaceSuperscript, SIGNAL(triggered(bool)), SLOT(superscriptClicked(bool)));
connect(showKeyboard, SIGNAL(toggled(bool)), SLOT(showKeyboardClicked(bool)));
@@ -124,6 +128,8 @@ void TextTools::retranslate()
toolbar->setWindowTitle(tr("Text Edit"));
typefaceBold->setToolTip(tr("Bold"));
typefaceItalic->setToolTip(tr("Italic"));
+ typefaceUnderline->setToolTip(tr("Underline"));
+ typefaceStrike->setToolTip(tr("Strike-throuhg"));
typefaceSubscript->setToolTip(tr("Subscript"));
typefaceSuperscript->setToolTip(tr("Superscript"));
}
@@ -150,6 +156,7 @@ void TextTools::blockAllSignals(bool val)
typefaceBold->blockSignals(val);
typefaceItalic->blockSignals(val);
typefaceUnderline->blockSignals(val);
+ typefaceStrike->blockSignals(val);
typefaceSubscript->blockSignals(val);
typefaceSuperscript->blockSignals(val);
typefaceFamily->blockSignals(val);
@@ -183,6 +190,7 @@ void TextTools::updateTools(EditData& ed)
typefaceItalic->setChecked(format->italic());
typefaceBold->setChecked(format->bold());
typefaceUnderline->setChecked(format->underline());
+ typefaceStrike->setChecked(format->strike());
typefaceSubscript->setChecked(format->valign() == VerticalAlignment::AlignSubScript);
typefaceSuperscript->setChecked(format->valign() == VerticalAlignment::AlignSuperScript);
@@ -283,6 +291,29 @@ void TextTools::toggleUnderline()
underlineClicked(typefaceUnderline->isChecked());
}
+//---------------------------------------------------------
+// toggleStrike
+//---------------------------------------------------------
+
+void TextTools::toggleStrike()
+ {
+ typefaceStrike->toggle();
+ strikeClicked(typefaceStrike->isChecked());
+ }
+
+//---------------------------------------------------------
+// strikeClicked
+//---------------------------------------------------------
+
+void TextTools::strikeClicked(bool val)
+ {
+ IF_ASSERT_FAILED(cursor) {
+ return;
+ }
+ cursor->setFormat(FormatId::Strike, val);
+ updateText();
+ }
+
//---------------------------------------------------------
// underlineClicked
//---------------------------------------------------------
diff --git a/mscore/texttools.h b/mscore/texttools.h
index 1374f64f68426..6c88382cb8e1a 100644
--- a/mscore/texttools.h
+++ b/mscore/texttools.h
@@ -36,6 +36,7 @@ class TextTools : public QDockWidget {
QAction* typefaceBold;
QAction* typefaceItalic;
QAction* typefaceUnderline;
+ QAction* typefaceStrike;
QAction* typefaceSubscript;
QAction* typefaceSuperscript;
QAction* showKeyboard;
@@ -50,6 +51,7 @@ class TextTools : public QDockWidget {
void boldClicked(bool);
void italicClicked(bool);
void underlineClicked(bool);
+ void strikeClicked(bool);
void subscriptClicked(bool);
void superscriptClicked(bool);
void showKeyboardClicked(bool);
@@ -65,6 +67,7 @@ class TextTools : public QDockWidget {
void toggleBold();
void toggleItalic();
void toggleUnderline();
+ void toggleStrike();
TextBase* textElement();
};
}