Fix pulley going disabled with big ChoiceSettings

If ChoiceSetting uses the LargeChoiceDialog, it would leak an open
empty ContextMenu, which blocks usage of the PullDownMenu.
Add a hasMenu attribute to conditionally not open it.
This commit is contained in:
Anton Thomasson 2021-01-02 17:39:06 +01:00
parent dab0e0ebf4
commit 731db2dd1e
2 changed files with 11 additions and 2 deletions

View file

@ -42,5 +42,7 @@ Setting {
}
hasMenu: !limited_choices.length>num_large_choices
}

View file

@ -2,7 +2,7 @@ import QtQuick 2.0
import Sailfish.Silica 1.0
Item {
height: button.height + menu.height
height: button.height + (menu != undefined ? menu.height : 0)
width: parent.width
property string name
@ -14,7 +14,12 @@ Item {
property var default_choice
signal clicked()
onClicked: menu.open(this)
onClicked: {
if (hasMenu)
{
menu.open(this)
}
}
property alias displayValue: button.value
@ -24,6 +29,8 @@ Item {
label: prettyName
onClicked: parent.clicked()
}
property var menu
property bool hasMenu: true
}