Fix menu lock bug with no choices

This commit is contained in:
Anton Thomasson 2022-05-02 21:30:02 +02:00
parent dd19333c81
commit f84d05e514

View file

@ -14,7 +14,11 @@ Setting {
displayValue: Utils.ippName(name, choice != undefined ? choice : default_choice, strings) displayValue: Utils.ippName(name, choice != undefined ? choice : default_choice, strings)
onClicked: { onClicked: {
if(actual_choices.length>num_large_choices) if(hasMenu)
{
menu.open(this)
}
else if(actual_choices.length != 0)
{ {
var dialog = pageStack.push("LargeChoiceDialog.qml", var dialog = pageStack.push("LargeChoiceDialog.qml",
{name:name, choice: choice != undefined ? choice : default_choice, choices: actual_choices, {name:name, choice: choice != undefined ? choice : default_choice, choices: actual_choices,
@ -24,10 +28,6 @@ Setting {
choice = dialog.choice choice = dialog.choice
}) })
} }
else
{
menu.open(this)
}
} }
menu: ContextMenu { menu: ContextMenu {
@ -45,7 +45,5 @@ Setting {
} }
hasMenu: !actual_choices.length>num_large_choices hasMenu: actual_choices.length != 0 && (actual_choices.length <= num_large_choices)
} }