Remove unnecessary properties; simplify hover code
2 files changed, 5 insertions, 16 deletions
diff --git a/resources/qml/StatusIndicator.qml b/resources/qml/StatusIndicator.qml
index 923fdead..e9659f20 100644
--- a/resources/qml/StatusIndicator.qml
+++ b/resources/qml/StatusIndicator.qml
@@ -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;
- }
}
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index 1eb07daa..077171c9 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -69,8 +69,6 @@ Item {
}
StatusIndicator {
- state: model.state
- eventId: model.id
Layout.alignment: Qt.AlignRight | Qt.AlignTop
Layout.preferredHeight: 16
width: 16
|