mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Use ItemDelegate for CommunitiesList
This commit is contained in:
parent
1e22274d8c
commit
8563ec002d
1 changed files with 23 additions and 24 deletions
|
@ -47,29 +47,32 @@ Page {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: ItemDelegate {
|
||||||
id: communityItem
|
id: communityItem
|
||||||
|
|
||||||
property color background: Nheko.colors.window
|
property color backgroundColor: Nheko.colors.window
|
||||||
property color importantText: Nheko.colors.text
|
property color importantText: Nheko.colors.text
|
||||||
property color unimportantText: Nheko.colors.buttonText
|
property color unimportantText: Nheko.colors.buttonText
|
||||||
property color bubbleBackground: Nheko.colors.highlight
|
property color bubbleBackground: Nheko.colors.highlight
|
||||||
property color bubbleText: Nheko.colors.highlightedText
|
property color bubbleText: Nheko.colors.highlightedText
|
||||||
|
|
||||||
color: background
|
background: Rectangle {
|
||||||
|
color: backgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
height: avatarSize + 2 * Nheko.paddingMedium
|
height: avatarSize + 2 * Nheko.paddingMedium
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
state: "normal"
|
state: "normal"
|
||||||
ToolTip.visible: hovered.hovered && collapsed
|
ToolTip.visible: hovered && collapsed
|
||||||
ToolTip.text: model.tooltip
|
ToolTip.text: model.tooltip
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "highlight"
|
name: "highlight"
|
||||||
when: (hovered.hovered || model.hidden) && !(Communities.currentTagId == model.id)
|
when: (communityItem.hovered || model.hidden) && !(Communities.currentTagId == model.id)
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: communityItem
|
target: communityItem
|
||||||
background: Nheko.colors.dark
|
backgroundColor: Nheko.colors.dark
|
||||||
importantText: Nheko.colors.brightText
|
importantText: Nheko.colors.brightText
|
||||||
unimportantText: Nheko.colors.brightText
|
unimportantText: Nheko.colors.brightText
|
||||||
bubbleBackground: Nheko.colors.highlight
|
bubbleBackground: Nheko.colors.highlight
|
||||||
|
@ -83,7 +86,7 @@ Page {
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: communityItem
|
target: communityItem
|
||||||
background: Nheko.colors.highlight
|
backgroundColor: Nheko.colors.highlight
|
||||||
importantText: Nheko.colors.highlightedText
|
importantText: Nheko.colors.highlightedText
|
||||||
unimportantText: Nheko.colors.highlightedText
|
unimportantText: Nheko.colors.highlightedText
|
||||||
bubbleBackground: Nheko.colors.highlightedText
|
bubbleBackground: Nheko.colors.highlightedText
|
||||||
|
@ -93,24 +96,20 @@ Page {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
margin: -Nheko.paddingSmall
|
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
onSingleTapped: communityContextMenu.show(model.id)
|
onSingleTapped: communityContextMenu.show(model.id)
|
||||||
gesturePolicy: TapHandler.ReleaseWithinBounds
|
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||||
|
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus | PointerDevice.TouchPad
|
||||||
}
|
}
|
||||||
|
|
||||||
TapHandler {
|
|
||||||
margin: -Nheko.paddingSmall
|
|
||||||
onSingleTapped: Communities.setCurrentTagId(model.id)
|
|
||||||
onLongPressed: communityContextMenu.show(model.id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HoverHandler {
|
onClicked: Communities.setCurrentTagId(model.id)
|
||||||
id: hovered
|
onPressAndHold: communityContextMenu.show(model.id)
|
||||||
|
|
||||||
margin: -Nheko.paddingSmall
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: Nheko.paddingMedium
|
spacing: Nheko.paddingMedium
|
||||||
|
@ -132,7 +131,7 @@ Page {
|
||||||
}
|
}
|
||||||
roomid: model.id
|
roomid: model.id
|
||||||
displayName: model.displayName
|
displayName: model.displayName
|
||||||
color: communityItem.background
|
color: communityItem.backgroundColor
|
||||||
}
|
}
|
||||||
|
|
||||||
ElidedLabel {
|
ElidedLabel {
|
||||||
|
|
Loading…
Reference in a new issue