feat(StatusChatListCategory): apply chat list filter and expose category id in popup menu
This uses the newly introduced `filterFn` in `StatusChatList` to hide chat items that don't belong to a given category. It also optionally exposes the `categoryId` on the provided popup menu, so it has access to it inside menu item triggers.
This commit is contained in:
parent
cb07813444
commit
4577551873
|
@ -51,15 +51,23 @@ Column {
|
||||||
|
|
||||||
StatusChatList {
|
StatusChatList {
|
||||||
id: statusChatList
|
id: statusChatList
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
visible: statusChatListCategory.opened
|
visible: statusChatListCategory.opened
|
||||||
|
categoryId: statusChatListCategory.categoryId
|
||||||
|
filterFn: function (model) {
|
||||||
|
return !!model.categoryId && model.categoryId == statusChatList.categoryId
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: popupMenuSlot
|
id: popupMenuSlot
|
||||||
active: !!statusChatListCategory.popupMenu
|
active: !!statusChatListCategory.popupMenu
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
|
popupMenuSlot.item.openHandler = function () {
|
||||||
|
if (popupMenuSlot.item.hasOwnProperty('categoryId')) {
|
||||||
|
popupMenuSlot.item.categoryId = statusChatListCategory.categoryId
|
||||||
|
}
|
||||||
|
}
|
||||||
popupMenuSlot.item.closeHandler = function () {
|
popupMenuSlot.item.closeHandler = function () {
|
||||||
statusChatListCategoryItem.highlighted = false
|
statusChatListCategoryItem.highlighted = false
|
||||||
statusChatListCategoryItem.menuButton.highlighted = false
|
statusChatListCategoryItem.menuButton.highlighted = false
|
||||||
|
|
Loading…
Reference in New Issue