Remove unnecessary properties; simplify hover code

This commit is contained in:
Loren Burkholder 2021-01-16 10:16:27 -05:00
parent 139ab146bb
commit 7671927fa4
2 changed files with 5 additions and 16 deletions

View File

@ -5,13 +5,11 @@ import im.nheko 1.0
ImageButton {
id: indicator
property int state: 0
property string eventId
width: 16
height: 16
hoverEnabled: true
ToolTip.visible: hovered && state != MtxEvent.Empty
changeColorOnHover: (model.state == MtxEvent.Read)
ToolTip.visible: hovered && model.state != MtxEvent.Empty
ToolTip.text: {
switch (state) {
case MtxEvent.Failed:
@ -28,12 +26,12 @@ ImageButton {
}
onClicked: {
if (state == MtxEvent.Read)
TimelineManager.timeline.readReceiptsAction(eventId);
if (model.state == MtxEvent.Read)
TimelineManager.timeline.readReceiptsAction(model.id);
}
image: {
switch (state) {
switch (model.state) {
case MtxEvent.Failed:
return ":/icons/icons/ui/remove-symbol.png";
case MtxEvent.Sent:
@ -46,11 +44,4 @@ ImageButton {
return "";
}
}
changeColorOnHover: {
if (state == MtxEvent.Read)
return true;
else
return false;
}
}

View File

@ -69,8 +69,6 @@ Item {
}
StatusIndicator {
state: model.state
eventId: model.id
Layout.alignment: Qt.AlignRight | Qt.AlignTop
Layout.preferredHeight: 16
width: 16