feat(StatusSearchPopupMenuItem): new API

Status Menu item received new value property.
This commit is contained in:
Sale Djenic 2021-08-16 14:04:00 +02:00 committed by Pascal Precht
parent c306b68296
commit b133d10f96
3 changed files with 19 additions and 1 deletions

View File

@ -229,13 +229,15 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
property ListModel optionsModel: ListModel { property ListModel optionsModel: ListModel {
ListElement { ListElement {
title: "Item with icon"; value: "item_1"
title: "Item with icon"
imageSource: "" imageSource: ""
iconName: "chat" iconName: "chat"
iconColor: "" iconColor: ""
isIdenticon: false isIdenticon: false
subItems: [ subItems: [
ListElement { ListElement {
value: "sub_item_1_1"
text: "Profile image item" text: "Profile image item"
imageSource: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg" imageSource: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
iconName: "" iconName: ""
@ -243,6 +245,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: false isIdenticon: false
}, },
ListElement { ListElement {
value: "sub_item_1_2"
text: "identicon item" text: "identicon item"
imageSource: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC" imageSource: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
iconName: "" iconName: ""
@ -250,6 +253,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: true isIdenticon: true
}]} }]}
ListElement { ListElement {
value: "item_2"
title: "Community item"; title: "Community item";
imageSource: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg" imageSource: "https://pbs.twimg.com/profile_images/1369221718338895873/T_5fny6o_400x400.jpg"
iconName: "" iconName: ""
@ -257,6 +261,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: false isIdenticon: false
subItems: [ subItems: [
ListElement { ListElement {
value: "sub_item_2_1"
text: "welcome" text: "welcome"
imageSource: "" imageSource: ""
iconName: "channel" iconName: "channel"
@ -264,6 +269,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: false isIdenticon: false
}, },
ListElement { ListElement {
value: "sub_item_2_2"
text: "support" text: "support"
imageSource: "" imageSource: ""
iconName: "channel" iconName: "channel"
@ -271,6 +277,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: false isIdenticon: false
}, },
ListElement { ListElement {
value: "sub_item_2_3"
text: "news" text: "news"
imageSource: "" imageSource: ""
iconName: "channel" iconName: "channel"
@ -278,6 +285,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: false isIdenticon: false
}]} }]}
ListElement { ListElement {
value: "item_3"
title: "Other"; title: "Other";
imageSource: ""; imageSource: "";
iconName: "info" iconName: "info"
@ -285,6 +293,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: false isIdenticon: false
subItems: [ subItems: [
ListElement { ListElement {
value: "sub_item_3_1"
text: "news" text: "news"
imageSource: "" imageSource: ""
iconName: "channel" iconName: "channel"
@ -292,6 +301,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: false isIdenticon: false
}]} }]}
ListElement { ListElement {
value: "item_4"
title: "Letter identicon"; title: "Letter identicon";
imageSource: ""; imageSource: "";
iconName: "" iconName: ""
@ -299,6 +309,7 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
isIdenticon: false isIdenticon: false
subItems: [ subItems: [
ListElement { ListElement {
value: "sub_item_4_1"
text: "news" text: "news"
imageSource: "" imageSource: ""
iconName: "channel" iconName: "channel"

View File

@ -33,6 +33,7 @@ StatusPopupMenu {
sourceComponent: (!!model.subItems && model.subItems.count > 0) ? subMenus : subMenuItemComponent sourceComponent: (!!model.subItems && model.subItems.count > 0) ? subMenus : subMenuItemComponent
onLoaded: { onLoaded: {
if (!!model.subItems && model.subItems.count > 0) { if (!!model.subItems && model.subItems.count > 0) {
item.parentValue = model.value
item.title = model.title; item.title = model.title;
item.subItemsModel = model.subItems; item.subItemsModel = model.subItems;
item.parentIconName = model.iconName; item.parentIconName = model.iconName;
@ -48,6 +49,7 @@ StatusPopupMenu {
}); });
root.insertMenu(index+2, item); root.insertMenu(index+2, item);
} else { } else {
item.value = model.value
item.text = model.title; item.text = model.title;
item.iconSettings.name = model.iconName; item.iconSettings.name = model.iconName;
item.iconSettings.color = model.iconColor; item.iconSettings.color = model.iconColor;
@ -82,6 +84,7 @@ StatusPopupMenu {
StatusPopupMenu { StatusPopupMenu {
id: menu id: menu
property var subItemsModel property var subItemsModel
property string parentValue
property string parentIconName property string parentIconName
property string parentImageSource property string parentImageSource
property string parentIdenticonColor property string parentIdenticonColor
@ -89,6 +92,7 @@ StatusPopupMenu {
Repeater { Repeater {
id: menuLoader id: menuLoader
model: menu.subItemsModel model: menu.subItemsModel
property string parentValue: menu.parentValue
property string parentTitleText: menu.title property string parentTitleText: menu.title
property string parentIconName: menu.parentIconName property string parentIconName: menu.parentIconName
property string parentImageSource: menu.parentImageSource property string parentImageSource: menu.parentImageSource
@ -97,6 +101,7 @@ StatusPopupMenu {
Loader { Loader {
id: subMenuLoader id: subMenuLoader
sourceComponent: StatusSearchPopupMenuItem { sourceComponent: StatusSearchPopupMenuItem {
value: model.value
text: model.text text: model.text
image.source: model.imageSource image.source: model.imageSource
iconSettings.name: model.iconName iconSettings.name: model.iconName

View File

@ -9,6 +9,8 @@ MenuItem {
id: root id: root
implicitHeight: 38 implicitHeight: 38
property string value: ""
property StatusImageSettings image: StatusImageSettings { property StatusImageSettings image: StatusImageSettings {
height: 16 height: 16
width: 16 width: 16