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
732d143d
Commit
732d143d
authored
Oct 26, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Popup/AbstractDropDownMenu): add transitions
parent
fcb1b2a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
10 deletions
+78
-10
AbstractDropDownMenu.qml
tests/ui/modules/Common/Popup/AbstractDropDownMenu.qml
+78
-10
No files found.
tests/ui/modules/Common/Popup/AbstractDropDownMenu.qml
View file @
732d143d
...
@@ -9,6 +9,8 @@ import Utils 1.0
...
@@ -9,6 +9,8 @@ import Utils 1.0
// ===================================================================
// ===================================================================
Item
{
Item
{
id
:
menu
// Optionnal parameter, if defined and if a click is detected
// Optionnal parameter, if defined and if a click is detected
// on it, menu is not closed.
// on it, menu is not closed.
property
var
launcher
property
var
launcher
...
@@ -20,6 +22,7 @@ Item {
...
@@ -20,6 +22,7 @@ Item {
property
int
relativeY
:
0
property
int
relativeY
:
0
default
property
alias
_content
:
content
.
data
default
property
alias
_content
:
content
.
data
property
bool
_isOpen
:
false
signal
menuClosed
signal
menuClosed
signal
menuOpened
signal
menuOpened
...
@@ -27,11 +30,11 @@ Item {
...
@@ -27,11 +30,11 @@ Item {
// -----------------------------------------------------------------
// -----------------------------------------------------------------
function
isOpen
()
{
function
isOpen
()
{
return
visible
return
_isOpen
}
}
function
showMenu
()
{
function
showMenu
()
{
if
(
visible
)
{
if
(
_isOpen
)
{
return
return
}
}
...
@@ -40,20 +43,15 @@ Item {
...
@@ -40,20 +43,15 @@ Item {
this
.
y
=
relativeTo
.
mapToItem
(
null
,
relativeX
,
relativeY
).
y
this
.
y
=
relativeTo
.
mapToItem
(
null
,
relativeX
,
relativeY
).
y
}
}
visible
=
true
_isOpen
=
true
menuOpened
()
// Necessary to use `Keys.onEscapePressed`.
focus
=
true
}
}
function
hideMenu
()
{
function
hideMenu
()
{
if
(
!
visible
)
{
if
(
!
_isOpen
)
{
return
return
}
}
visible
=
false
_isOpen
=
false
menuClosed
()
}
}
function
_computeHeight
()
{
function
_computeHeight
()
{
...
@@ -63,6 +61,7 @@ Item {
...
@@ -63,6 +61,7 @@ Item {
// -----------------------------------------------------------------
// -----------------------------------------------------------------
implicitHeight
:
_computeHeight
()
implicitHeight
:
_computeHeight
()
opacity
:
0
visible
:
false
visible
:
false
z
:
Constants
.
zPopup
z
:
Constants
.
zPopup
...
@@ -100,4 +99,73 @@ Item {
...
@@ -100,4 +99,73 @@ Item {
hideMenu
()
hideMenu
()
}
}
}
}
// -----------------------------------------------------------------
states
:
[
State
{
name
:
'
Opened
'
when
:
_isOpen
PropertyChanges
{
focus
:
true
// Necessary to use `Keys.onEscapePressed`.
opacity
:
1
target
:
menu
visible
:
true
}
}
]
transitions
:
[
Transition
{
from
:
''
to
:
'
Opened
'
NumberAnimation
{
duration
:
250
easing.type
:
Easing
.
InOutQuad
property
:
'
opacity
'
target
:
menu
}
SequentialAnimation
{
PauseAnimation
{
duration
:
250
}
ScriptAction
{
script
:
menuOpened
()
}
}
},
Transition
{
from
:
'
Opened
'
to
:
''
NumberAnimation
{
duration
:
250
easing.type
:
Easing
.
InOutQuad
property
:
'
opacity
'
target
:
menu
}
NumberAnimation
{
duration
:
250
easing.type
:
Easing
.
InOutQuad
property
:
'
visible
'
// Ugly, use `NumberAnimation` on bool.
target
:
menu
}
SequentialAnimation
{
PauseAnimation
{
duration
:
250
}
ScriptAction
{
script
:
menuClosed
()
}
}
}
]
}
}
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