Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix special characters being lost in title frame texts when "cloning" to custom part #18712

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions src/inspector/view/qml/MuseScore/Inspector/common/FrameSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import MuseScore.UiComponents 1.0
import MuseScore.Inspector 1.0

Column {
id: frameSettings
id: root

width: parent.width
spacing: 12
Expand All @@ -37,21 +37,21 @@ Column {
property int navigationRowStart: 0
readonly property int navigationRowEnd: cornerRadiusSection.navigationRowEnd

required property QtObject frameTypePropertyItem
required property QtObject frameBorderColorPropertyItem
required property QtObject frameFillColorPropertyItem
required property QtObject frameThicknessPropertyItem
required property QtObject frameMarginPropertyItem
required property QtObject frameCornerRadiusPropertyItem
required property PropertyItem frameType
required property PropertyItem frameBorderColor
required property PropertyItem frameFillColor
required property PropertyItem frameThickness
required property PropertyItem frameMargin
required property PropertyItem frameCornerRadius

FlatRadioButtonGroupPropertyView {
id: frameSection
titleText: qsTrc("inspector", "Frame")
propertyItem: frameSettings.frameTypePropertyItem ? frameSettings.frameTypePropertyItem : null
propertyItem: root.frameType ? root.frameType : null

navigationName: "FrameMenu"
navigationPanel: frameSettings.navigationPanel
navigationRowStart: frameSettings.navigationRowStart
navigationPanel: root.navigationPanel
navigationRowStart: root.navigationRowStart

model: [
{ text: qsTrc("inspector", "None"), value: TextTypes.FRAME_TYPE_NONE, titleRole: qsTrc("inspector", "None") },
Expand All @@ -71,14 +71,14 @@ Column {
anchors.rightMargin: 2

navigationName: "BorderColorMenu"
navigationPanel: frameSettings.navigationPanel
navigationPanel: root.navigationPanel
navigationRowStart: frameSection.navigationRowEnd + 1

visible: frameSettings.frameBorderColorPropertyItem.isEnabled
visible: root.frameBorderColor ? root.frameBorderColor.isEnabled : false
height: visible ? implicitHeight : 0

titleText: qsTrc("inspector", "Border")
propertyItem: frameSettings.frameBorderColorPropertyItem
propertyItem: root.frameBorderColor
}

ColorSection {
Expand All @@ -88,14 +88,14 @@ Column {
anchors.right: parent.right

navigationName: "HighlightColorMenu"
navigationPanel: frameSettings.navigationPanel
navigationPanel: root.navigationPanel
navigationRowStart: borderColorSection.navigationRowEnd + 1

visible: frameSettings.frameFillColorPropertyItem.isEnabled
visible: root.frameFillColor ? root.frameFillColor.isEnabled : false
height: visible ? implicitHeight : 0

titleText: qsTrc("inspector", "Fill color")
propertyItem: frameSettings.frameFillColorPropertyItem
propertyItem: root.frameFillColor
}
}

Expand All @@ -110,14 +110,14 @@ Column {
anchors.rightMargin: 2

navigationName: "Thickness"
navigationPanel: frameSettings.navigationPanel
navigationPanel: root.navigationPanel
navigationRowStart: highlightColorSection.navigationRowEnd + 1

visible: frameSettings.frameThicknessPropertyItem.isEnabled
visible: root.frameThickness ? root.frameThickness.isEnabled : false
height: visible ? implicitHeight : 0

titleText: qsTrc("inspector", "Thickness")
propertyItem: frameSettings.frameThicknessPropertyItem
propertyItem: root.frameThickness

step: 0.1
minValue: 0
Expand All @@ -131,14 +131,14 @@ Column {
anchors.right: parent.right

navigationName: "Padding"
navigationPanel: frameSettings.navigationPanel
navigationPanel: root.navigationPanel
navigationRowStart: thicknessSection.navigationRowEnd + 1

visible: frameSettings.frameMarginPropertyItem.isEnabled
visible: root.frameMargin ? root.frameMargin.isEnabled : false
height: visible ? implicitHeight : 0

titleText: qsTrc("inspector", "Padding")
propertyItem: frameSettings.frameMarginPropertyItem
propertyItem: root.frameMargin

step: 0.1
minValue: 0
Expand All @@ -153,14 +153,14 @@ Column {
anchors.rightMargin: 2

navigationName: "Corner radius"
navigationPanel: frameSettings.navigationPanel
navigationPanel: root.navigationPanel
navigationRowStart: marginSection.navigationRowEnd + 1

visible: frameSettings.frameCornerRadiusPropertyItem.isEnabled
visible: root.frameCornerRadius ? root.frameCornerRadius.isEnabled : false
height: visible ? implicitHeight : 0

titleText: qsTrc("inspector", "Corner radius")
propertyItem: frameSettings.frameCornerRadiusPropertyItem
propertyItem: root.frameCornerRadius

step: 1
decimals: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ Column {
navigationPanel: root.navigationPanel
navigationRowStart: dynamicAlignmentGroup.navigationRowEnd + 1

frameTypePropertyItem: root.model ? root.model.frameType : null
frameBorderColorPropertyItem: root.model ? root.model.frameBorderColor : null
frameFillColorPropertyItem: root.model ? root.model.frameFillColor : null
frameThicknessPropertyItem: root.model ? root.model.frameThickness : null
frameMarginPropertyItem: root.model ? root.model.frameMargin : null
frameCornerRadiusPropertyItem: root.model ? root.model.frameCornerRadius : null
frameType: root.model ? root.model.frameType : null
frameBorderColor: root.model ? root.model.frameBorderColor : null
frameFillColor: root.model ? root.model.frameFillColor : null
frameThickness: root.model ? root.model.frameThickness : null
frameMargin: root.model ? root.model.frameMargin : null
frameCornerRadius: root.model ? root.model.frameCornerRadius : null
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/inspector/view/qml/MuseScore/Inspector/text/TextSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ Column {
navigationPanel: root.navigationPanel
navigationRowStart: subscriptOptionsButtonList.navigationRowEnd + 1

frameTypePropertyItem: root.model ? root.model.frameType : null
frameBorderColorPropertyItem: root.model ? root.model.frameBorderColor : null
frameFillColorPropertyItem: root.model ? root.model.frameFillColor : null
frameThicknessPropertyItem: root.model ? root.model.frameThickness : null
frameMarginPropertyItem: root.model ? root.model.frameMargin : null
frameCornerRadiusPropertyItem: root.model ? root.model.frameCornerRadius : null
frameType: root.model ? root.model.frameType : null
frameBorderColor: root.model ? root.model.frameBorderColor : null
frameFillColor: root.model ? root.model.frameFillColor : null
frameThickness: root.model ? root.model.frameThickness : null
frameMargin: root.model ? root.model.frameMargin : null
frameCornerRadius: root.model ? root.model.frameCornerRadius : null
}

SeparatorLine { anchors.margins: -12 }
Expand Down
26 changes: 6 additions & 20 deletions src/notation/internal/excerptnotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,31 +96,17 @@ void ExcerptNotation::fillWithDefaultInfo()
topVerticalFrame->undoUnlink();
}

auto setText = [&score](TextStyleType textType, const QString& text) {
TextBase* textItem = score->getText(textType);

if (!textItem) {
textItem = score->addText(textType, nullptr /*destinationElement*/, false /*addToAllScores*/);
}

auto unlinkText = [&score](TextStyleType textType) {
engraving::Text* textItem = score->getText(textType);
if (textItem) {
textItem->undoUnlink();
textItem->setPlainText(text);
}
};

auto getText = [&score](TextStyleType textType, const QString& defaultText) {
if (mu::engraving::Text* t = score->getText(textType)) {
return t->plainText().toQString();
} else {
return defaultText;
}
};

setText(TextStyleType::TITLE, getText(TextStyleType::TITLE, ""));
setText(TextStyleType::COMPOSER, getText(TextStyleType::COMPOSER, ""));
setText(TextStyleType::SUBTITLE, getText(TextStyleType::SUBTITLE, ""));
setText(TextStyleType::POET, getText(TextStyleType::POET, ""));
unlinkText(TextStyleType::TITLE);
unlinkText(TextStyleType::SUBTITLE);
unlinkText(TextStyleType::COMPOSER);
unlinkText(TextStyleType::POET);
}

mu::engraving::Excerpt* ExcerptNotation::excerpt() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ StyledDialogView {
NavigationPanel {
id: measuresCountNavigationPanel
name: "MeasuresCountNavigationPanel"
enabled: parent.enabled && parent.visible
enabled: parent && parent.enabled && parent.visible
section: root.navigationSection
order: 1
direction: NavigationPanel.Horizontal
Expand Down Expand Up @@ -94,7 +94,7 @@ StyledDialogView {
NavigationPanel {
id: buttonsNavigationPanel
name: "ButtonsNavigationPanel"
enabled: parent.enabled && parent.visible
enabled: parent && parent.enabled && parent.visible
section: root.navigationSection
order: 2
direction: NavigationPanel.Horizontal
Expand Down