mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
Make long press menu actually work
This commit is contained in:
parent
6f557c19a1
commit
8bf26917ad
3 changed files with 22 additions and 14 deletions
|
@ -5,7 +5,7 @@ TextEdit {
|
||||||
textFormat: TextEdit.RichText
|
textFormat: TextEdit.RichText
|
||||||
readOnly: true
|
readOnly: true
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
selectByMouse: true
|
selectByMouse: ma.containsMouse // try to make scrollable by finger but selectable by mouse
|
||||||
color: colors.text
|
color: colors.text
|
||||||
|
|
||||||
onLinkActivated: {
|
onLinkActivated: {
|
||||||
|
@ -23,6 +23,7 @@ TextEdit {
|
||||||
id: ma
|
id: ma
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
|
hoverEnabled: true
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,22 +8,25 @@ import im.nheko 1.0
|
||||||
import "./delegates"
|
import "./delegates"
|
||||||
import "./emoji"
|
import "./emoji"
|
||||||
|
|
||||||
MouseArea {
|
Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: row.height
|
height: row.height
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.AllButtons
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (mouse.button === Qt.RightButton)
|
if (mouse.button === Qt.RightButton)
|
||||||
messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
|
messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
|
||||||
}
|
}
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
if (mouse.source === Qt.MouseEventNotSynthesized)
|
messageContextMenu.show(model.id, model.type, model.isEncrypted, row, mapToItem(timelineRoot, mouse.x, mouse.y))
|
||||||
messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: (settings.messageHoverHighlight && parent.containsMouse) ? colors.base : "transparent"
|
color: (settings.messageHoverHighlight && parent.containsMouse) ? colors.base : "transparent"
|
||||||
|
|
|
@ -42,10 +42,14 @@ Page {
|
||||||
id: messageContextMenu
|
id: messageContextMenu
|
||||||
modal: true
|
modal: true
|
||||||
|
|
||||||
function show(eventId_, eventType_, isEncrypted_, showAt_) {
|
function show(eventId_, eventType_, isEncrypted_, showAt_, position) {
|
||||||
eventId = eventId_
|
eventId = eventId_
|
||||||
eventType = eventType_
|
eventType = eventType_
|
||||||
isEncrypted = isEncrypted_
|
isEncrypted = isEncrypted_
|
||||||
|
|
||||||
|
if (position)
|
||||||
|
popup(position, showAt_)
|
||||||
|
else
|
||||||
popup(showAt_)
|
popup(showAt_)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue