Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
e442609e
Commit
e442609e
authored
Nov 09, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Chat): handle correctly hovered links in messages
parent
1da42133
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
11 deletions
+37
-11
Message.qml
tests/ui/modules/Linphone/Chat/Message.qml
+32
-9
utils.spec.qml
tests/ui/scripts/Utils/utils.spec.qml
+5
-2
No files found.
tests/ui/modules/Linphone/Chat/Message.qml
View file @
e442609e
...
...
@@ -12,10 +12,28 @@ Item {
property
alias
backgroundColor
:
rectangle
.
color
property
alias
color
:
text
.
color
property
alias
fontSize
:
text
.
font
.
pointSize
default
property
alias
_content
:
content
.
data
// -----------------------------------------------------------------
function
_handleHoveredLink
(
hoveredLink
)
{
var
root
=
Utils
.
getTopParent
(
container
)
var
children
=
root
.
children
// Can be the `invertedMouseArea` of other message.
// Or another? It's a problem in this case...
var
mouseArea
=
children
[
children
.
length
-
1
]
if
(
Utils
.
qmlTypeof
(
mouseArea
,
'
QQuickMouseArea
'
))
{
mouseArea
.
cursorShape
=
hoveredLink
?
Qt
.
PointingHandCursor
:
Qt
.
ArrowCursor
}
}
// -----------------------------------------------------------------
implicitHeight
:
text
.
contentHeight
+
text
.
padding
*
2
Rectangle
{
...
...
@@ -45,21 +63,15 @@ Item {
imagesHeight
:
ChatStyle
.
entry
.
message
.
images
.
height
,
imagesWidth
:
ChatStyle
.
entry
.
message
.
images
.
width
})
wrapMode
:
Text
.
Wrap
// See http://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop
// and http://doc.qt.io/qt-5/richtext-html-subset.html
textFormat
:
Text
.
RichText
// To supports links and imgs.
onLinkActivated
:
Qt
.
openUrlExternally
(
link
)
wrapMode
:
Text
.
Wrap
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
NoButton
cursorShape
:
parent
.
hoveredLink
?
Qt
.
PointingHandCursor
:
Qt
.
ArrowCursor
}
onHoveredLinkChanged
:
_handleHoveredLink
(
hoveredLink
)
onLinkActivated
:
Qt
.
openUrlExternally
(
link
)
InvertedMouseArea
{
anchors.fill
:
parent
...
...
@@ -70,6 +82,17 @@ Item {
parent
.
focus
=
false
}
}
// Used if no InvertedMouseArea exists.
MouseArea
{
id
:
mouseArea
anchors.fill
:
parent
acceptedButtons
:
Qt
.
NoButton
cursorShape
:
parent
.
hoveredLink
?
Qt
.
PointingHandCursor
:
Qt
.
ArrowCursor
}
}
Item
{
...
...
tests/ui/scripts/Utils/utils.spec.qml
View file @
e442609e
...
...
@@ -117,11 +117,14 @@ TestCase {
component
:
'
import QtQuick 2.7; ListModel {}
'
,
result
:
true
,
type
:
'
QQmlListModel
'
},
{
},
{
component
:
'
import QtQuick 2.7; ListView {}
'
,
result
:
true
,
type
:
'
QQuickListView
'
},
{
component
:
'
import QtQuick 2.7; MouseArea {}
'
,
result
:
true
,
type
:
'
QQuickMouseArea
'
}
]
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment