mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-29 14:26:22 +00:00
Fix flicking, cursors and selection in messages.
- Avoid Flicking on messages. - Use a different cursor when hovering on links in chat. - Keep selection displayed on the first right click in a message.
This commit is contained in:
parent
8661f287f8
commit
8c2a332f20
5 changed files with 45 additions and 19 deletions
|
|
@ -26,6 +26,9 @@ Column{
|
|||
property string lastTextSelected
|
||||
property alias textColor: message.color
|
||||
property alias textFont: message.font
|
||||
|
||||
signal rightClicked()
|
||||
|
||||
height: fitHeight
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
|
@ -49,5 +52,6 @@ Column{
|
|||
contentModel: mainItem.contentModel
|
||||
onLastTextSelectedChanged: mainItem.lastTextSelected = lastTextSelected
|
||||
color: isOutgoing ? ChatStyle.entry.message.outgoing.text.color : ChatStyle.entry.message.incoming.text.color
|
||||
onRightClicked: mainItem.rightClicked()
|
||||
}
|
||||
}
|
||||
|
|
@ -114,18 +114,4 @@ Item {
|
|||
onTriggered: container.removeEntryRequested()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Handle hovered link.
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
acceptedButtons: Qt.RightButton
|
||||
propagateComposedEvents:true
|
||||
cursorShape: parent.hoveredLink
|
||||
? Qt.PointingHandCursor
|
||||
: Qt.IBeamCursor
|
||||
onClicked: mouse.button === Qt.RightButton && messageMenu.popup()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ TextEdit {
|
|||
property int fitHeight: visible ? contentHeight + padding : 0
|
||||
property int fitWidth: visible ? implicitWidth + padding*2 : 0
|
||||
|
||||
signal rightClicked()
|
||||
|
||||
|
||||
property int removeWarningFromBindingLoop : implicitWidth // Just a dummy variable to remove meaningless binding loop on implicitWidth
|
||||
|
||||
|
|
@ -49,12 +51,44 @@ TextEdit {
|
|||
textFormat: Text.RichText // To supports links and imgs.
|
||||
wrapMode: TextEdit.Wrap
|
||||
|
||||
onCursorRectangleChanged: Logic.ensureVisible(cursorRectangle)
|
||||
onCursorRectangleChanged: if(!readOnly) Logic.ensureVisible(cursorRectangle)
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
onSelectedTextChanged:if(selectedText != '') lastTextSelected = selectedText
|
||||
onSelectedTextChanged:{
|
||||
if(selectedText != '') lastTextSelected = selectedText
|
||||
else {
|
||||
if( mouseArea.keepLastSelection) {
|
||||
mouseArea.keepLastSelection = false
|
||||
select(mouseArea.lastStartSelection, mouseArea.lastEndSelection)
|
||||
}
|
||||
}
|
||||
}
|
||||
onActiveFocusChanged: {
|
||||
if(activeFocus)
|
||||
if(activeFocus) {
|
||||
lastTextSelected = ''
|
||||
mouseArea.keepLastSelection = false
|
||||
}
|
||||
deselect()
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
property bool keepLastSelection: false
|
||||
property int lastStartSelection:0
|
||||
property int lastEndSelection:0
|
||||
anchors.fill: parent
|
||||
propagateComposedEvents: true
|
||||
hoverEnabled: false
|
||||
scrollGestureEnabled: false
|
||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
|
||||
acceptedButtons: Qt.RightButton
|
||||
onClicked: {
|
||||
if(!keepLastSelection) {
|
||||
lastStartSelection = parent.selectionStart
|
||||
lastEndSelection = parent.selectionEnd
|
||||
}
|
||||
keepLastSelection = true
|
||||
message.rightClicked()
|
||||
mouse.accepted = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,13 +98,15 @@ Item {
|
|||
chatMessageModel: $chatEntry
|
||||
}
|
||||
height: contentHeight
|
||||
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
interactive: false
|
||||
delegate: ChatContent{
|
||||
contentModel: modelData
|
||||
onFitWidthChanged:{
|
||||
rectangle.updateWidth()
|
||||
}
|
||||
onLastTextSelectedChanged: container.lastTextSelected= lastTextSelected
|
||||
onRightClicked: chatMenu.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit d69419023710a53f3a1c946243d3448ca3db5e4c
|
||||
Subproject commit 21c354aaf1c6e39797840bc79a1f60aa70dd6a49
|
||||
Loading…
Add table
Reference in a new issue