diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-03-10 00:30:45 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-03-10 00:30:45 +0100 |
commit | 0f1a352dd7945b6a685d70a39eead409f6ee2215 (patch) | |
tree | 4557e1a4a2d0c4d525f414150bc181aaa34608b9 /resources/qml/TimelineRow.qml | |
parent | Reduce times we read upload data (diff) | |
download | nheko-0f1a352dd7945b6a685d70a39eead409f6ee2215.tar.xz |
Make buttons hideable via setting, button contents can still be accessed via context menu
Diffstat (limited to 'resources/qml/TimelineRow.qml')
-rw-r--r-- | resources/qml/TimelineRow.qml | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml index 2984844f..a9ae5f5c 100644 --- a/resources/qml/TimelineRow.qml +++ b/resources/qml/TimelineRow.qml @@ -8,36 +8,21 @@ import im.nheko 1.0 import "./delegates" MouseArea { - id: rowArea - anchors.left: parent.left anchors.right: parent.right height: row.height - - hoverEnabled: true - preventStealing: true propagateComposedEvents: true - acceptedButtons: Qt.NoButton - - property bool showButtons: false + preventStealing: true - Timer { - running: rowArea.containsMouse - interval: 150 - onTriggered: rowArea.state = "showButtons" + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + if (mouse.button === Qt.RightButton) + messageContextMenu.show(model.id, model.type, row) + } + onPressAndHold: { + if (mouse.source === Qt.MouseEventNotSynthesized) + messageContextMenu.show(model.id, model.type, row) } - - states: [ - State { - name: "hideButtons" - when: !rowArea.containsMouse - PropertyChanges { target: rowArea; showButtons: false; } - }, - State { - name: "showButtons" - PropertyChanges { target: rowArea; showButtons: true; } - } - ] RowLayout { id: row @@ -70,7 +55,7 @@ MouseArea { } ImageButton { - visible: rowArea.showButtons + visible: timelineSettings.buttons Layout.alignment: Qt.AlignRight | Qt.AlignTop Layout.preferredHeight: 16 width: 16 @@ -86,7 +71,7 @@ MouseArea { onClicked: chat.model.replyAction(model.id) } ImageButton { - visible: rowArea.showButtons + visible: timelineSettings.buttons Layout.alignment: Qt.AlignRight | Qt.AlignTop Layout.preferredHeight: 16 width: 16 @@ -125,6 +110,7 @@ MouseArea { id: ma anchors.fill: parent hoverEnabled: true + propagateComposedEvents: true } ToolTip.visible: ma.containsMouse |