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
6574cc8b
Commit
6574cc8b
authored
Mar 15, 2017
by
Wescoeur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Common/Form/ComboBox): supports icon on selected entry + create logic file
parent
d648e10c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
15 deletions
+60
-15
ComboBox.js
linphone-desktop/ui/modules/Common/Form/ComboBox.js
+32
-0
ComboBox.qml
linphone-desktop/ui/modules/Common/Form/ComboBox.qml
+25
-15
ComboBoxStyle.qml
...e-desktop/ui/modules/Common/Styles/Form/ComboBoxStyle.qml
+3
-0
No files found.
linphone-desktop/ui/modules/Common/Form/ComboBox.js
0 → 100644
View file @
6574cc8b
// =============================================================================
// `ComboBox.qml` Logic.
// =============================================================================
function
getSelectedEntryIcon
()
{
var
iconRole
=
comboBox
.
iconRole
if
(
iconRole
.
length
===
0
)
{
return
''
}
var
currentIndex
=
comboBox
.
currentIndex
if
(
currentIndex
<
0
)
{
return
''
}
var
model
=
comboBox
.
model
return
(
Utils
.
isArray
(
model
)
?
model
[
currentIndex
][
iconRole
]
:
model
.
get
(
currentIndex
)[
iconRole
]
)
||
''
}
function
getEntryIcon
()
{
var
iconRole
=
comboBox
.
iconRole
return
(
iconRole
.
length
&&
item
.
flattenedModel
[
iconRole
])
||
''
}
function
getFlattenedModel
()
{
return
comboBox
.
textRole
.
length
&&
(
typeof
modelData
!==
'
undefined
'
?
modelData
:
model
)
}
linphone-desktop/ui/modules/Common/Form/ComboBox.qml
View file @
6574cc8b
...
...
@@ -5,6 +5,10 @@ import QtQuick.Layouts 1.3
import
Common
1.0
import
Common
.
Styles
1.0
import
Utils
1.0
import
'
ComboBox.js
'
as
Logic
// =============================================================================
ComboBox
{
...
...
@@ -31,16 +35,28 @@ ComboBox {
// ---------------------------------------------------------------------------
contentItem
:
Text
{
color
:
ComboBoxStyle
.
contentItem
.
text
.
color
elide
:
Text
.
ElideRight
contentItem
:
RowLayout
{
spacing
:
ComboBoxStyle
.
contentItem
.
spacing
width
:
comboBox
.
width
Icon
{
icon
:
Logic
.
getSelectedEntryIcon
()
iconSize
:
ComboBoxStyle
.
contentItem
.
iconSize
visible
:
icon
.
length
>
0
}
Text
{
Layout.fillWidth
:
true
font.pointSize
:
ComboBoxStyle
.
contentItem
.
text
.
fontSize
color
:
ComboBoxStyle
.
contentItem
.
text
.
color
elide
:
Text
.
ElideRight
rightPadding
:
comboBox
.
indicator
.
width
+
comboBox
.
spacing
verticalAlignment
:
Text
.
AlignVCenter
font.pointSize
:
ComboBoxStyle
.
contentItem
.
text
.
fontSize
rightPadding
:
comboBox
.
indicator
.
width
+
comboBox
.
spacing
text
:
comboBox
.
displayText
text
:
comboBox
.
displayText
}
}
// ---------------------------------------------------------------------------
...
...
@@ -58,8 +74,7 @@ ComboBox {
delegate
:
ItemDelegate
{
id
:
item
readonly
property
var
flattenedModel
:
textRole
.
length
&&
(
typeof
modelData
!==
'
undefined
'
?
modelData
:
model
)
readonly
property
var
flattenedModel
:
Logic
.
getFlattenedModel
()
hoverEnabled
:
true
width
:
comboBox
.
width
...
...
@@ -95,12 +110,7 @@ ComboBox {
width
:
item
.
width
Icon
{
Layout.alignment
:
Qt
.
AlignVCenter
icon
:
{
var
iconRole
=
comboBox
.
iconRole
return
(
iconRole
.
length
&&
item
.
flattenedModel
[
iconRole
])
||
''
}
icon
:
Logic
.
getEntryIcon
()
iconSize
:
ComboBoxStyle
.
delegate
.
contentItem
.
iconSize
visible
:
icon
.
length
>
0
...
...
linphone-desktop/ui/modules/Common/Styles/Form/ComboBoxStyle.qml
View file @
6574cc8b
...
...
@@ -20,6 +20,9 @@ QtObject {
}
property
QtObject
contentItem
:
QtObject
{
property
int
iconSize
:
20
property
int
spacing
:
5
property
QtObject
text
:
QtObject
{
property
color
color
:
Colors
.
d
property
int
fontSize
:
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