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
eca28cc5
Commit
eca28cc5
authored
Oct 25, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(Popup/DropDownMenu): don't hide menu if launcher button is clicked again
parent
1de6a8bd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
18 deletions
+38
-18
InvertedMouseArea.qml
tests/ui/modules/Common/InvertedMouseArea.qml
+11
-17
DropDownMenu.qml
tests/ui/modules/Common/Popup/DropDownMenu.qml
+7
-1
SearchBox.qml
tests/ui/modules/Common/SearchBox.qml
+1
-0
CallControls.qml
tests/ui/modules/Linphone/Call/CallControls.qml
+1
-0
utils.js
tests/ui/scripts/Utils/utils.js
+18
-0
No files found.
tests/ui/modules/Common/InvertedMouseArea.qml
View file @
eca28cc5
...
...
@@ -4,7 +4,7 @@ import Common 1.0
import
Utils
1.0
// ===================================================================
// Helper to handle button click outside a
component
.
// Helper to handle button click outside a
n item
.
// ===================================================================
Item
{
...
...
@@ -12,7 +12,9 @@ Item {
property
var
_mouseArea
signal
pressed
// 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
()
{
if
(
_mouseArea
==
null
)
{
...
...
@@ -29,15 +31,6 @@ Item {
}
}
function
_isInItem
(
point
)
{
return
(
point
.
x
>=
item
.
x
&&
point
.
y
>=
item
.
y
&&
point
.
x
<
item
.
x
+
item
.
width
&&
point
.
y
<
item
.
y
+
item
.
height
)
}
// It's necessary to use a `enabled` variable.
// See: http://doc.qt.io/qt-5/qml-qtqml-component.html#completed-signal
//
...
...
@@ -70,9 +63,7 @@ Item {
mouse
.
accepted
=
false
// Click is outside or not.
if
(
!
_isInItem
(
mapToItem
(
item
.
parent
,
mouse
.
x
,
mouse
.
y
)
))
{
if
(
!
Utils
.
pointIsInItem
(
this
,
item
,
mouse
))
{
if
(
_timeout
!=
null
)
{
// Remove existing timeout to avoid the creation of
// many children.
...
...
@@ -87,9 +78,12 @@ Item {
// call.
//
// The timeout is destroyed with the `MouseArea` component.
_timeout
=
Utils
.
setTimeout
(
this
,
0
,
item
.
pressed
.
bind
(
this
)
)
_timeout
=
Utils
.
setTimeout
(
this
,
0
,
item
.
pressed
.
bind
(
this
,
(
function
(
point
,
item
)
{
return
Utils
.
pointIsInItem
(
this
,
item
,
point
)
}).
bind
(
this
,
{
x
:
mouse
.
x
,
y
:
mouse
.
y
})
))
}
}
}
...
...
tests/ui/modules/Common/Popup/DropDownMenu.qml
View file @
eca28cc5
...
...
@@ -12,6 +12,7 @@ Rectangle {
property
bool
drawOnRoot
:
false
property
int
entryHeight
// Only with a ListView child.
property
int
maxMenuHeight
// Only with a ListView child.
property
var
launcher
property
var
relativeTo
default
property
alias
_content
:
content
.
data
...
...
@@ -82,6 +83,11 @@ Rectangle {
anchors.fill
:
parent
enabled
:
parent
.
visible
onPressed
:
hideMenu
()
onPressed
:
{
if
(
launcher
!=
null
&&
pointIsInItem
(
launcher
))
{
return
}
hideMenu
()
}
}
}
tests/ui/modules/Common/SearchBox.qml
View file @
eca28cc5
...
...
@@ -67,6 +67,7 @@ Item {
id
:
menu
anchors.top
:
searchField
.
bottom
launcher
:
searchField
width
:
searchField
.
width
onMenuClosed
:
_hideMenu
()
...
...
tests/ui/modules/Linphone/Call/CallControls.qml
View file @
eca28cc5
...
...
@@ -55,6 +55,7 @@ RowLayout {
entryHeight
:
22
height
:
100
width
:
120
launcher
:
button
relativeTo
:
button
Rectangle
{
...
...
tests/ui/scripts/Utils/utils.js
View file @
eca28cc5
...
...
@@ -136,6 +136,24 @@ function qmlTypeof (object, className) {
// -------------------------------------------------------------------
// Test if a point is in a item.
//
// `source` is the item that generated the point.
// `target` is the item to test.
// `point` is the point to test.
function
pointIsInItem
(
source
,
target
,
point
)
{
point
=
source
.
mapToItem
(
target
.
parent
,
point
.
x
,
point
.
y
)
return
(
point
.
x
>=
target
.
x
&&
point
.
y
>=
target
.
y
&&
point
.
x
<
target
.
x
+
target
.
width
&&
point
.
y
<
target
.
y
+
target
.
height
)
}
// -------------------------------------------------------------------
// Invoke a `cb` function with each value of the interval: `[0, n[`.
// Return a mapped array created with the returned values of `cb`.
function
times
(
n
,
cb
,
context
)
{
...
...
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