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
46a9e88c
Commit
46a9e88c
authored
Oct 06, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(Paned): better transition usage
parent
0bc612c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
29 deletions
+51
-29
Paned.qml
tests/ui/modules/Linphone/Paned.qml
+49
-29
PanedStyle.qml
tests/ui/modules/Linphone/Styles/PanedStyle.qml
+2
-0
No files found.
tests/ui/modules/Linphone/Paned.qml
View file @
46a9e88c
...
...
@@ -11,6 +11,9 @@ import Utils 1.0
// Each area can have a fixed or dynamic minimum width.
// See `minimumLeftLimit` and `minimumRightLimit` attributes.
//
// Note: Paned supports too `maximumLeftLimit` and
// `maximumRightLimit`.
//
// To create a dynamic minimum width, it's necessary to give
// a percentage to `minmimumLeftLimit` or `minimumRightLimit` like:
// `minimumLeftLimit: '66%'`.
...
...
@@ -41,6 +44,8 @@ Item {
property
var
_minimumLeftLimit
property
var
_minimumRightLimit
// -----------------------------------------------------------------
function
_getLimitValue
(
limit
)
{
if
(
limit
==
null
)
{
return
...
...
@@ -104,6 +109,8 @@ Item {
}
}
// -----------------------------------------------------------------
function
_applyLimitsOnUserMove
(
offset
)
{
var
minimumRightLimit
=
_getLimitValue
(
_minimumRightLimit
)
var
minimumLeftLimit
=
_getLimitValue
(
_minimumLeftLimit
)
...
...
@@ -112,11 +119,11 @@ Item {
if
(
_isClosed
)
{
if
(
closingEdge
===
Qt
.
LeftEdge
)
{
if
(
offset
>
minimumLeftLimit
/
2
)
{
_
updateClosing
()
_
open
()
}
}
else
{
if
(
-
offset
>
minimumRightLimit
/
2
)
{
_
updateClosing
()
_
open
()
}
}
...
...
@@ -134,7 +141,11 @@ Item {
contentA
.
width
=
minimumLeftLimit
if
(
closingEdge
===
Qt
.
LeftEdge
&&
-
offset
>
minimumLeftLimit
/
2
)
{
_updateClosing
()
if
(
_isClosed
)
{
_open
()
}
else
{
_close
()
}
}
}
// width(A) > maximum width(A).
...
...
@@ -146,7 +157,11 @@ Item {
contentA
.
width
=
container
.
width
-
handle
.
width
-
minimumRightLimit
if
(
closingEdge
===
Qt
.
RightEdge
&&
offset
>
minimumRightLimit
/
2
)
{
_updateClosing
()
if
(
_isClosed
)
{
_open
()
}
else
{
_close
()
}
}
}
// width(B) > maximum width(B).
...
...
@@ -159,28 +174,31 @@ Item {
}
}
function
_updateClosing
()
{
// Save state and close.
if
(
!
_isClosed
)
{
_isClosed
=
true
_savedContentAWidth
=
contentA
.
width
if
(
closingEdge
===
Qt
.
LeftEdge
)
{
closingTransitionA
.
running
=
true
}
else
{
closingTransitionB
.
running
=
true
}
return
}
// -----------------------------------------------------------------
// Restore old state.
function
_open
()
{
_isClosed
=
false
contentA
.
width
=
_savedContentAWidth
_applyLimits
()
}
function
_close
()
{
_isClosed
=
true
_savedContentAWidth
=
contentA
.
width
closingTransition
.
running
=
true
}
function
_inverseClosingState
()
{
if
(
!
_isClosed
)
{
// Save state and close.
_close
()
}
else
{
// Restore old state.
openingTransition
.
running
=
true
}
}
// -----------------------------------------------------------------
onWidthChanged
:
_applyLimits
()
Component.onCompleted
:
{
...
...
@@ -211,7 +229,7 @@ Item {
hoverEnabled
:
true
width
:
PanedStyle
.
handle
.
width
onDoubleClicked
:
_
updateClosing
()
onDoubleClicked
:
_
inverseClosingState
()
onMouseXChanged
:
pressed
&&
_applyLimitsOnUserMove
(
handle
.
mouseX
-
_mouseStart
)
...
...
@@ -237,20 +255,22 @@ Item {
}
PropertyAnimation
{
id
:
closingTransitionA
id
:
openingTransition
target
:
contentA
duration
:
PanedStyle
.
transitionDuration
property
:
'
width
'
to
:
0
duration
:
200
target
:
contentA
to
:
_savedContentAWidth
onRunningChanged
:
!
running
&&
_open
()
}
PropertyAnimation
{
id
:
closingTransition
B
id
:
closingTransition
duration
:
200
duration
:
PanedStyle
.
transitionDuration
property
:
'
width
'
target
:
contentA
to
:
container
.
width
-
handle
.
width
to
:
c
losingEdge
===
Qt
.
LeftEdge
?
0
:
c
ontainer
.
width
-
handle
.
width
}
}
tests/ui/modules/Linphone/Styles/PanedStyle.qml
View file @
46a9e88c
...
...
@@ -4,6 +4,8 @@ import QtQuick 2.7
import
Linphone
1.0
QtObject
{
property
int
transitionDuration
:
200
property
QtObject
handle
:
QtObject
{
property
int
width
:
10
...
...
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