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
7b08e105
Commit
7b08e105
authored
Oct 25, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Popup): create `DropDownDynamixMenu` and `DropDownMenu`
parent
3566f3fd
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
118 additions
and
112 deletions
+118
-112
resources.qrc
tests/resources.qrc
+2
-0
AbstractDropDownMenu.qml
tests/ui/modules/Common/Popup/AbstractDropDownMenu.qml
+100
-0
DropDownDynamicMenu.qml
tests/ui/modules/Common/Popup/DropDownDynamicMenu.qml
+12
-0
DropDownMenu.qml
tests/ui/modules/Common/Popup/DropDownMenu.qml
+2
-110
SearchBox.qml
tests/ui/modules/Common/SearchBox.qml
+1
-1
qmldir
tests/ui/modules/Common/qmldir
+1
-0
CallControls.qml
tests/ui/modules/Linphone/Call/CallControls.qml
+0
-1
No files found.
tests/resources.qrc
View file @
7b08e105
...
@@ -51,6 +51,8 @@
...
@@ -51,6 +51,8 @@
<file>
ui/modules/Common/InvertedMouseArea.qml
</file>
<file>
ui/modules/Common/InvertedMouseArea.qml
</file>
<file>
ui/modules/Common/Menu.qml
</file>
<file>
ui/modules/Common/Menu.qml
</file>
<file>
ui/modules/Common/Paned.qml
</file>
<file>
ui/modules/Common/Paned.qml
</file>
<file>
ui/modules/Common/Popup/AbstractDropDownMenu.qml
</file>
<file>
ui/modules/Common/Popup/DropDownDynamicMenu.qml
</file>
<file>
ui/modules/Common/Popup/DropDownMenu.qml
</file>
<file>
ui/modules/Common/Popup/DropDownMenu.qml
</file>
<file>
ui/modules/Common/Popup/PopupShadow.qml
</file>
<file>
ui/modules/Common/Popup/PopupShadow.qml
</file>
<file>
ui/modules/Common/qmldir
</file>
<file>
ui/modules/Common/qmldir
</file>
...
...
tests/ui/modules/Common/Popup/AbstractDropDownMenu.qml
0 → 100644
View file @
7b08e105
import
QtQuick
2.7
import
Common
1.0
import
Common
.
Styles
1.0
import
Utils
1.0
// ===================================================================
// Low component to display a list/menu in a popup.
// ===================================================================
Item
{
// Optionnal parameter, if defined and if a click is detected
// on it, menu is not closed.
property
var
launcher
// Optionnal parameters, set the position of Menu relative
// to this item.
property
var
relativeTo
property
int
relativeX
:
0
property
int
relativeY
:
0
default
property
alias
_content
:
content
.
data
signal
menuClosed
signal
menuOpened
// -----------------------------------------------------------------
function
isOpen
()
{
return
visible
}
function
showMenu
()
{
if
(
visible
)
{
return
}
if
(
relativeTo
!=
null
)
{
this
.
x
=
relativeTo
.
mapToItem
(
null
,
relativeX
,
relativeY
).
x
this
.
y
=
relativeTo
.
mapToItem
(
null
,
relativeX
,
relativeY
).
y
}
visible
=
true
menuOpened
()
}
function
hideMenu
()
{
if
(
!
visible
)
{
return
}
visible
=
false
menuClosed
()
}
function
_computeHeight
()
{
console
.
exception
(
'
Virtual method must be implemented.
'
)
}
// -----------------------------------------------------------------
implicitHeight
:
_computeHeight
()
visible
:
false
z
:
Constants
.
zPopup
Keys.onEscapePressed
:
hideMenu
()
// Set parent menu to root.
Component.onCompleted
:
{
if
(
relativeTo
!=
null
)
{
parent
=
Utils
.
getTopParent
(
this
)
}
}
// Menu content.
Rectangle
{
id
:
content
anchors.fill
:
parent
color
:
PopupStyle
.
backgroundColor
layer
{
enabled
:
true
effect
:
PopupShadow
{}
}
}
// Inverted mouse area to detect click outside menu.
InvertedMouseArea
{
anchors.fill
:
parent
enabled
:
parent
.
visible
onPressed
:
{
if
(
launcher
!=
null
&&
pointIsInItem
(
launcher
))
{
return
}
hideMenu
()
}
}
}
tests/ui/modules/Common/Popup/DropDownDynamicMenu.qml
0 → 100644
View file @
7b08e105
AbstractDropDownMenu
{
property
int
entryHeight
property
int
maxMenuHeight
function
_computeHeight
()
{
var
model
=
_content
[
0
].
model
var
height
=
model
.
count
*
entryHeight
return
(
maxMenuHeight
!==
undefined
&&
height
>
maxMenuHeight
)
?
maxMenuHeight
:
height
}
}
tests/ui/modules/Common/Popup/DropDownMenu.qml
View file @
7b08e105
import
QtQuick
2.7
AbstractDropDownMenu
{
import
Common
1.0
import
Common
.
Styles
1.0
import
Utils
1.0
// ===================================================================
// Low component to display a list/menu in a popup.
// ===================================================================
Rectangle
{
// Attributes used only with a ListView child.
property
int
entryHeight
property
int
maxMenuHeight
// Optionnal parameter, if defined and if a click is detected
// on it, menu is not closed.
property
var
launcher
// Optionnal parameters, set the position of Menu relative
// to this item.
property
var
relativeTo
property
int
relativeX
:
0
property
int
relativeY
:
0
default
property
alias
_content
:
content
.
data
signal
menuClosed
signal
menuOpened
function
isOpen
()
{
return
visible
}
function
showMenu
()
{
if
(
visible
)
{
return
}
if
(
relativeTo
!=
null
)
{
this
.
x
=
relativeTo
.
mapToItem
(
null
,
relativeX
,
relativeY
).
x
this
.
y
=
relativeTo
.
mapToItem
(
null
,
relativeX
,
relativeY
).
y
}
visible
=
true
menuOpened
()
}
function
hideMenu
()
{
if
(
!
visible
)
{
return
}
visible
=
false
menuClosed
()
}
function
_computeHeight
()
{
function
_computeHeight
()
{
var
model
=
_content
[
0
].
model
if
(
model
==
null
||
!
Utils
.
qmlTypeof
(
model
,
'
QQmlListModel
'
))
{
return
content
.
height
return
content
.
height
}
}
console
.
assert
(
entryHeight
!=
null
,
'
`entryHeight` must be defined when used with `ListView`.
'
)
var
height
=
model
.
count
*
entryHeight
return
(
maxMenuHeight
!==
undefined
&&
height
>
maxMenuHeight
)
?
maxMenuHeight
:
height
}
implicitHeight
:
_computeHeight
()
visible
:
false
z
:
Constants
.
zPopup
Keys.onEscapePressed
:
hideMenu
()
// Set parent menu to root.
Component.onCompleted
:
{
if
(
relativeTo
!=
null
)
{
parent
=
Utils
.
getTopParent
(
this
)
}
}
// Menu content.
Rectangle
{
id
:
content
anchors.fill
:
parent
color
:
PopupStyle
.
backgroundColor
layer
{
enabled
:
true
effect
:
PopupShadow
{}
}
}
// Inverted mouse area to detect click outside menu.
InvertedMouseArea
{
anchors.fill
:
parent
enabled
:
parent
.
visible
onPressed
:
{
if
(
launcher
!=
null
&&
pointIsInItem
(
launcher
))
{
return
}
hideMenu
()
}
}
}
}
tests/ui/modules/Common/SearchBox.qml
View file @
7b08e105
...
@@ -63,7 +63,7 @@ Item {
...
@@ -63,7 +63,7 @@ Item {
}
}
}
}
DropDownMenu
{
DropDown
Dynamic
Menu
{
id
:
menu
id
:
menu
anchors.top
:
searchField
.
bottom
anchors.top
:
searchField
.
bottom
...
...
tests/ui/modules/Common/qmldir
View file @
7b08e105
...
@@ -55,6 +55,7 @@ Menu 1.0 Menu.qml
...
@@ -55,6 +55,7 @@ Menu 1.0 Menu.qml
Paned 1.0 Paned.qml
Paned 1.0 Paned.qml
# Popup
# Popup
DropDownDynamicMenu 1.0 Popup/DropDownDynamicMenu.qml
DropDownMenu 1.0 Popup/DropDownMenu.qml
DropDownMenu 1.0 Popup/DropDownMenu.qml
PopupShadow 1.0 Popup/PopupShadow.qml
PopupShadow 1.0 Popup/PopupShadow.qml
...
...
tests/ui/modules/Linphone/Call/CallControls.qml
View file @
7b08e105
...
@@ -52,7 +52,6 @@ RowLayout {
...
@@ -52,7 +52,6 @@ RowLayout {
DropDownMenu
{
DropDownMenu
{
id
:
menu
id
:
menu
entryHeight
:
22
implicitHeight
:
toto
.
height
implicitHeight
:
toto
.
height
launcher
:
button
launcher
:
button
relativeTo
:
button
relativeTo
:
button
...
...
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