feat(Wallet)_: Enhance ComboBox with 'isDisabled' property

Added an optional 'isDisabled' property to the ComboBox model to dynamically control the visibility and interaction of entries based on their state. This enhancement allows for entries to be disabled under certain conditions, improving the UI's adaptability and user interaction.

fixes: #13630
This commit is contained in:
belalshehab 2024-06-14 02:17:43 +03:00 committed by Belal Shehab
parent 1e35724cb7
commit 1834581821
1 changed files with 4 additions and 1 deletions

View File

@ -14,7 +14,7 @@ import utils 1.0
ComboBox {
id: root
// expected model role names: text, value (enum TokenOrder), sortRoleName, icon (optional)
// expected model role names: text, value (enum TokenOrder), sortRoleName, icon (optional), isDisabled (optional) default is false
// text === "---" denotes a separator
property bool hasCustomOrderDefined
@ -228,6 +228,9 @@ ComboBox {
modelData["value"] === SortOrderComboBox.TokenOrderCustom
visible: {
if (modelData["isDisabled"]) {
return false;
}
if (custom) // hide "Custom order" menu entry if none defined
return root.hasCustomOrderDefined
return true