Revert back to MenuItem

Up to now, RadioButton and CheckButton were added to Menus explicitly
because MenuItem would not use the correct delegate (i.e. CheckButton
instead of RadioButton for a selection group).  Since this has been
fixed in qqc2-desktop-style, we can use the proper component again.
This commit is contained in:
Bart De Vries 2023-04-25 10:51:32 +02:00
parent 8a9dc0f22f
commit 5026b25352
2 changed files with 22 additions and 19 deletions

View File

@ -20,24 +20,27 @@ Controls.Menu {
Controls.ButtonGroup { id: playbackRateGroup }
ColumnLayout {
Repeater {
model: playbackRateModel
// Using instantiator because using Repeater made the separator show up in
// the wrong place
Instantiator {
model: playbackRateModel
Controls.RadioButton {
padding: Kirigami.Units.smallSpacing
text: model.value
checked: model.value === AudioManager.playbackRate.toFixed(2)
Controls.ButtonGroup.group: playbackRateGroup
Controls.MenuItem {
text: model.value
checkable: true
checked: model.value === AudioManager.playbackRate.toFixed(2)
Controls.ButtonGroup.group: playbackRateGroup
onToggled: {
if (checked) {
AudioManager.playbackRate = value;
}
playbackRateMenu.dismiss();
onTriggered: {
if (checked) {
AudioManager.playbackRate = value;
}
playbackRateMenu.dismiss();
}
}
onObjectAdded: playbackRateMenu.insertItem(index, object)
onObjectRemoved: playbackRateMenu.removeItem(object)
}
Controls.MenuSeparator {

View File

@ -133,13 +133,13 @@ Controls.Control {
Repeater {
model: filterModel
Controls.RadioButton {
padding: Kirigami.Units.smallSpacing
Controls.MenuItem {
text: model.name
checkable: true
checked: model.filterType === proxyModel.filterType
Controls.ButtonGroup.group: filterGroup
onToggled: {
onTriggered: {
if (checked) {
proxyModel.filterType = model.filterType;
}
@ -182,11 +182,11 @@ Controls.Control {
Repeater {
model: searchSettingsModel
Controls.CheckBox {
padding: Kirigami.Units.smallSpacing
Controls.MenuItem {
text: model.name
checkable: true
checked: model.checked
onToggled: {
onTriggered: {
if (checked) {
proxyModel.searchFlags = proxyModel.searchFlags | model.searchFlag;
} else {