Skip to content

Commit

Permalink
right-click tap handler for replies
Browse files Browse the repository at this point in the history
  • Loading branch information
resolritter committed Aug 25, 2021
1 parent 8e5060b commit 0611f2c
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion resources/qml/delegates/Reply.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.13
import im.nheko 1.0
import Qt.labs.platform 1.1 as Platform

Item {
id: r
Expand Down Expand Up @@ -41,6 +42,39 @@ Item {
gesturePolicy: TapHandler.ReleaseWithinBounds
}

Platform.Menu {
id: replyContextMenu

property string text
property string link

function show(text_, link_) {
text = text_;
link = link_;
open();
}

Platform.MenuItem {
visible: replyContextMenu.text
enabled: visible
text: qsTr("&Copy")
onTriggered: Clipboard.text = replyContextMenu.text
}

Platform.MenuItem {
visible: replyContextMenu.link
enabled: visible
text: qsTr("Copy &link location")
onTriggered: Clipboard.text = replyContextMenu.link
}
}

TapHandler {
acceptedButtons: Qt.RightButton
onSingleTapped: replyContextMenu.show(reply.child.copyText, reply.child.hoveredLink)
gesturePolicy: TapHandler.ReleaseWithinBounds
}

CursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
Expand Down Expand Up @@ -103,7 +137,6 @@ Item {
width: parent.width
isReply: true
}

}

Rectangle {
Expand Down

0 comments on commit 0611f2c

Please sign in to comment.