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

View File

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