Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
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
Valentin Platzgummer
qgroundcontrol
Commits
1e2005b6
Commit
1e2005b6
authored
Feb 08, 2020
by
DoinLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
956f4a86
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
QGCComboBox.qml
src/QmlControls/QGCComboBox.qml
+23
-7
No files found.
src/QmlControls/QGCComboBox.qml
View file @
1e2005b6
...
@@ -36,15 +36,24 @@ T.ComboBox {
...
@@ -36,15 +36,24 @@ T.ComboBox {
property
var
_qgcPal
:
QGCPalette
{
colorGroupEnabled
:
enabled
}
property
var
_qgcPal
:
QGCPalette
{
colorGroupEnabled
:
enabled
}
property
real
_largestTextWidth
:
0
property
real
_largestTextWidth
:
0
property
real
_popupWidth
:
sizeToContents
?
_largestTextWidth
+
leftPadding
+
rightPadding
:
control
.
width
property
real
_popupWidth
:
sizeToContents
?
_largestTextWidth
+
itemDelegateMetrics
.
leftPadding
+
itemDelegateMetrics
.
rightPadding
:
control
.
width
property
bool
_onCompleted
:
false
TextMetrics
{
TextMetrics
{
id
:
textMetrics
id
:
textMetrics
font
:
control
.
font
font.family
:
control
.
font
.
family
font.pointSize
:
control
.
font
.
pointSize
}
ItemDelegate
{
id
:
itemDelegateMetrics
visible
:
false
font.family
:
control
.
font
.
family
font.pointSize
:
control
.
font
.
pointSize
}
}
onModelChanged
:
{
function
_adjustSizeToContents
()
{
if
(
sizeToContents
)
{
if
(
_onCompleted
&&
sizeToContents
)
{
_largestTextWidth
=
0
_largestTextWidth
=
0
for
(
var
i
=
0
;
i
<
model
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
model
.
length
;
i
++
){
textMetrics
.
text
=
model
[
i
]
textMetrics
.
text
=
model
[
i
]
...
@@ -53,6 +62,13 @@ T.ComboBox {
...
@@ -53,6 +62,13 @@ T.ComboBox {
}
}
}
}
onModelChanged
:
_adjustSizeToContents
()
Component.onCompleted
:
{
_onCompleted
=
true
_adjustSizeToContents
()
}
// The items in the popup
// The items in the popup
delegate
:
ItemDelegate
{
delegate
:
ItemDelegate
{
width
:
_popupWidth
width
:
_popupWidth
...
...
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