gui-kf5: fix reaction badge not updating via reactive property
In Qt5 Repeater delegates, 'property var block: model' doesn't propagate dataChanged updates for individual roles. Add a reactive 'blockReaction' string property bound to model.reaction directly, which updates when the model emits dataChanged.
This commit is contained in:
parent
9cf63f67b4
commit
5bc480c706
|
|
@ -1148,6 +1148,7 @@ ApplicationWindow {
|
|||
delegate: Loader {
|
||||
width: paneColumn.width
|
||||
property var block: model
|
||||
property string blockReaction: model.reaction || ""
|
||||
sourceComponent: {
|
||||
switch (blockType) {
|
||||
case "user": return userDelegate
|
||||
|
|
@ -1540,20 +1541,20 @@ ApplicationWindow {
|
|||
anchors.right: parent.right
|
||||
anchors.margins: 4
|
||||
z: 10
|
||||
text: block.reaction || ""
|
||||
text: blockReaction
|
||||
font.pixelSize: 18
|
||||
visible: block.reaction !== ""
|
||||
visible: blockReaction !== ""
|
||||
}
|
||||
|
||||
// Reaction buttons (hover only, hidden when already reacted)
|
||||
Row {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: block.reaction !== "" ? 36 : 4
|
||||
anchors.rightMargin: blockReaction !== "" ? 36 : 4
|
||||
anchors.margins: 4
|
||||
z: 10
|
||||
spacing: 2
|
||||
opacity: (assistantHover.hovered && block.reaction === "") ? 0.9 : 0
|
||||
opacity: (assistantHover.hovered && blockReaction === "") ? 0.9 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 150 } }
|
||||
|
||||
Repeater {
|
||||
|
|
|
|||
Reference in New Issue