Skip to content

Commit

Permalink
Improve RoundedRadioButton's implicitWidth/Height
Browse files Browse the repository at this point in the history
Resolves: #25576
  • Loading branch information
cbjeukendrup committed Dec 11, 2024
1 parent b4f3204 commit ebd1d55
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ RadioDelegate {

ButtonGroup.group: ListView.view && ListView.view instanceof RadioButtonGroup ? ListView.view.radioButtonGroup : null

implicitHeight: 20
implicitWidth: ListView.view
? (ListView.view.orientation === Qt.Vertical
? ListView.view.width
: (ListView.view.width - (ListView.view.spacing * (ListView.view.count - 1))) / ListView.view.count)
: 20
implicitWidth: leftPadding + implicitIndicatorWidth + spacing + implicitContentWidth + rightPadding
implicitHeight: topPadding + Math.max(implicitIndicatorHeight, implicitContentHeight) + bottomPadding

spacing: 6
padding: 0
Expand Down Expand Up @@ -74,6 +70,9 @@ RadioDelegate {
anchors.fill: parent
anchors.leftMargin: root.indicator.width + root.spacing + root.leftPadding

implicitWidth: contentLoader.implicitWidth
implicitHeight: contentLoader.implicitHeight

Loader {
id: contentLoader

Expand All @@ -98,6 +97,7 @@ RadioDelegate {
indicator: Item {
x: root.leftPadding
y: Boolean(parent) ? parent.height / 2 - height / 2 : 0

implicitWidth: 20
implicitHeight: implicitWidth

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ StyleDialogPage {

RadioButtonGroup {
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter

spacing: 12
orientation: ListView.Vertical
Expand All @@ -147,14 +146,11 @@ StyleDialogPage {
{ title: qsTrc("notation", "Draw inner stems through beams"), value: false },
{ title: qsTrc("notation", "Draw inner stems to nearest beam (“French” style)"), value: true }
]
delegate: RoundedRadioButton {
leftPadding: 0
spacing: 6

delegate: RoundedRadioButton {
width: ListView.view.width
text: modelData.title

checked: modelData.value === beamsPageModel.frenchStyleBeams.value

onToggled: {
beamsPageModel.frenchStyleBeams.value = modelData.value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,71 +85,64 @@ Rectangle {
Layout.fillWidth: true

title: qsTrc("notation", "Fret number")

ColumnLayout {
width: parent.width
spacing: 12

RowLayout {
spacing: 12

StyledTextLabel {
horizontalAlignment: Text.AlignLeft
text: qsTrc("notation", "Position:")
}
RowLayout {
spacing: 8
RoundedRadioButton {
checked: fretboardsPage.fretNumPos.value === 0
onToggled: fretboardsPage.fretNumPos.value = 0
}
StyledTextLabel {
horizontalAlignment: Text.AlignLeft
text: fretboardsPage.fretOrientation.value === 0 ? qsTrc("notation", "Left") : qsTrc("notation", "Bottom")
}

RoundedRadioButton {
text: fretboardsPage.fretOrientation.value === 0 ? qsTrc("notation", "Left") : qsTrc("notation", "Bottom")
checked: fretboardsPage.fretNumPos.value === 0
onToggled: fretboardsPage.fretNumPos.value = 0
}
RowLayout {
spacing: 8
RoundedRadioButton {
checked: fretboardsPage.fretNumPos.value === 1
onToggled: fretboardsPage.fretNumPos.value = 1
}
StyledTextLabel {
horizontalAlignment: Text.AlignLeft
text: fretboardsPage.fretOrientation.value === 0 ? qsTrc("notation", "Right") : qsTrc("notation", "Top")
}

RoundedRadioButton {
text: fretboardsPage.fretOrientation.value === 0 ? qsTrc("notation", "Right") : qsTrc("notation", "Top")
checked: fretboardsPage.fretNumPos.value === 1
onToggled: fretboardsPage.fretNumPos.value = 1
}
}

StyledGroupBox {
title: qsTrc("notation", "Format:")
Layout.fillWidth: true

ColumnLayout {
RowLayout {
spacing: 8
RoundedRadioButton {
checked: fretboardsPage.fretUseCustomSuffix.value === false
onToggled: fretboardsPage.fretUseCustomSuffix.value = false
}
StyledTextLabel {
horizontalAlignment: Text.AlignLeft
text: qsTrc("notation", "Number only")
}
width: parent.width
spacing: 12

RoundedRadioButton {
text: qsTrc("notation", "Number only")
checked: fretboardsPage.fretUseCustomSuffix.value === false
onToggled: fretboardsPage.fretUseCustomSuffix.value = false
}

RowLayout {
spacing: 8

RoundedRadioButton {
text: qsTrc("notation", "Custom suffix:")
checked: fretboardsPage.fretUseCustomSuffix.value === true
onToggled: fretboardsPage.fretUseCustomSuffix.value = true
}
StyledTextLabel {
horizontalAlignment: Text.AlignLeft
text: qsTrc("notation", "Custom suffix:")
}

TextInputField {
enabled: fretboardsPage.fretUseCustomSuffix.value === true
Layout.preferredWidth: 60
enabled: fretboardsPage.fretUseCustomSuffix.value === true
currentText: fretboardsPage.fretCustomSuffix.value
onTextChanged: function(newTextValue) {
onTextEdited: function(newTextValue) {
fretboardsPage.fretCustomSuffix.value = newTextValue
}
}

StyledTextLabel {
visible: fretboardsPage.fretUseCustomSuffix.value === true
horizontalAlignment: Text.AlignLeft
Expand Down
2 changes: 1 addition & 1 deletion src/notation/view/widgets/editstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ EditStyle::EditStyle(QWidget* parent)
auto fretboardsPage = createQmlWidget(
fretboardsWidget,
QUrl(QString::fromUtf8("qrc:/qml/MuseScore/NotationScene/internal/EditStyle/FretboardsPage.qml")));
fretboardsPage.widget->setMinimumSize(224, 1000);
fretboardsPage.widget->setMinimumSize(224, 1006);
connect(fretboardsPage.view->rootObject(), SIGNAL(goToTextStylePage(QString)), this, SLOT(goToTextStylePage(QString)));
fretboardsWidget->layout()->addWidget(fretboardsPage.widget);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ Column {
model: exportModel.availableUnitTypes

delegate: RoundedRadioButton {
width: ListView.view.width

text: modelData["text"]

navigation.name: "ExportType_" + text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ ExportSettingsPage {
model: root.model.musicXmlLayoutTypes()

delegate: RoundedRadioButton {
width: ListView.view.width

text: modelData["text"]

navigation.name: "MusicXmlLayoutTypeRadioButton " + text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,40 @@ FlatButton {
Component {
id: commonComp

StyledIconLabel {
Item {
property string accessibleName: root.model.timeSignatureAccessibleName(AdditionalInfoModel.Common)

font.family: ui.theme.musicalFont.family
font.pixelSize: 30
horizontalAlignment: Text.AlignLeft
iconCode: MusicalSymbolCodes.TIMESIG_COMMON
implicitWidth: commonLabel.implicitWidth
implicitHeight: 30

StyledIconLabel {
id: commonLabel
anchors.verticalCenter: parent.verticalCenter
font.family: ui.theme.musicalFont.family
font.pixelSize: 30
horizontalAlignment: Text.AlignLeft
iconCode: MusicalSymbolCodes.TIMESIG_COMMON
}
}
}

Component {
id: cutComp

StyledIconLabel {
Item {
property string accessibleName: root.model.timeSignatureAccessibleName(AdditionalInfoModel.Cut)

font.family: ui.theme.musicalFont.family
font.pixelSize: 30
horizontalAlignment: Text.AlignLeft
iconCode: MusicalSymbolCodes.TIMESIG_CUT
implicitWidth: cutLabel.implicitWidth
implicitHeight: 30

StyledIconLabel {
id: cutLabel
anchors.verticalCenter: parent.verticalCenter
font.family: ui.theme.musicalFont.family
font.pixelSize: 30
horizontalAlignment: Text.AlignLeft
iconCode: MusicalSymbolCodes.TIMESIG_CUT
}
}
}
}

0 comments on commit ebd1d55

Please sign in to comment.