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
ba804f5d
Commit
ba804f5d
authored
Nov 10, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Common/InvertedMouseArea): check if already exists a `MouseArea` at children root
parent
e442609e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
3 deletions
+53
-3
InvertedMouseArea.qml
tests/ui/modules/Common/InvertedMouseArea.qml
+14
-2
Message.qml
tests/ui/modules/Linphone/Chat/Message.qml
+0
-1
utils.js
tests/ui/scripts/Utils/utils.js
+39
-0
No files found.
tests/ui/modules/Common/InvertedMouseArea.qml
View file @
ba804f5d
...
...
@@ -11,18 +11,30 @@ Item {
id
:
item
property
bool
_mouseAlwaysOutside
property
var
_mouseArea
property
var
_mouseArea
:
null
// When emitted, returns a function to test if the click
// is on a specific item. It takes only a item parameter.
signal
pressed
(
var
pointIsInItem
)
function
_createMouseArea
()
{
var
parent
=
Utils
.
getTopParent
(
item
,
true
)
var
mouseArea
=
Utils
.
find
(
parent
.
children
,
function
(
element
)
{
return
Utils
.
qmlTypeof
(
element
,
'
QQuickMouseArea
'
)
})
Utils
.
assert
(
_mouseArea
===
mouseArea
,
'
It already exists a different `MouseArea` at window root. (
'
+
'
`local mouse area`=
'
+
_mouseArea
+
'
, `root mouse area`=
'
+
mouseArea
+
'
)
'
)
if
(
_mouseArea
==
null
)
{
_mouseArea
=
builder
.
createObject
()
}
_mouseArea
.
parent
=
Utils
.
getTopParent
(
item
,
true
)
_mouseArea
.
parent
=
parent
_mouseAlwaysOutside
=
_mouseArea
.
parent
!==
Utils
.
getTopParent
(
item
)
}
...
...
tests/ui/modules/Linphone/Chat/Message.qml
View file @
ba804f5d
...
...
@@ -22,7 +22,6 @@ Item {
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
'
))
{
...
...
tests/ui/scripts/Utils/utils.js
View file @
ba804f5d
...
...
@@ -2,6 +2,8 @@
// Contains many common helpers.
// ===================================================================
.
pragma
library
.
import
'
uri-tools.js
'
as
UriTools
// ===================================================================
...
...
@@ -354,3 +356,40 @@ function includes (obj, value, startIndex) {
return
false
}
// -------------------------------------------------------------------
function
_indexFinder
(
array
,
cb
,
context
)
{
var
length
=
array
.
length
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
if
(
cb
(
array
[
index
],
index
,
array
))
{
return
i
}
}
return
-
1
}
function
_keyFinder
(
obj
,
cb
,
context
)
{
var
keys
=
Object
.
keys
(
obj
)
var
length
=
keys
.
length
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
var
key
=
keys
[
i
]
if
(
cb
(
obj
[
key
],
key
,
obj
))
{
return
key
}
}
}
// Get the first matching value in a array or object.
// The matching value is obtained if `cb` returns true.
function
find
(
obj
,
cb
,
context
)
{
cb
=
_computeOptimizedCb
(
cb
,
context
)
var
finder
=
isArray
(
obj
)
?
_indexFinder
:
_keyFinder
var
key
=
finder
(
obj
,
cb
,
context
)
return
key
!=
null
&&
key
!==
-
1
?
obj
[
key
]
:
null
}
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