Make buttons hideable via setting, button contents can still be accessed via context menu
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
|