Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-qt-ui-qml
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
libdap-qt-ui-qml
Merge requests
!14
Features 2603
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Features 2603
features-2603
into
develop
Overview
0
Commits
9
Pipelines
0
Changes
3
Merged
tatiana.novikova
requested to merge
features-2603
into
develop
5 years ago
Overview
0
Commits
9
Pipelines
0
Changes
2
Expand
[*] Update calculating and deleting the unnecessary part of text at comboBox
👍
0
👎
0
Merge request reports
Viewing commit
d1852d4b
Prev
Next
Show latest version
2 files
+
6
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
d1852d4b
[*] Update comments
· d1852d4b
tatiana.novikova
authored
5 years ago
widgets/DapComboBox.qml
+
97
−
43
Options
import
QtQuick
2.
0
import
QtQuick
2.
4
import
QtQuick
.
Controls
2.0
DapComboBoxForm
{
id
:
dapComboBox
delegate
:
ItemDelegate
{
width
:
parent
.
width
delegate
:
ItemDelegate
{
width
:
parent
.
width
//Adjusting the height of the line, taking into account that the second element from the end may be the last
height
:
{
if
(
index
!=
currentIndex
)
{
if
(
index
==
(
count
-
2
))
{
if
(
index
+
1
==
currentIndex
)
return
heightListElement
+
bottomIntervalListElement
else
return
heightListElement
+
intervalListElement
}
if
(
index
==
count
-
1
)
return
heightListElement
+
bottomIntervalListElement
return
heightListElement
+
intervalListElement
}
else
return
0
}
//Adjusting the height of the line, taking into account that the second element from the end may be the last
height
:{
if
(
index
!=
currentIndex
)
{
if
(
index
==
(
count
-
2
))
//Text item
contentItem
:
Text
{
if
(
index
+
1
==
currentIndex
)
return
heightListElement
+
bottomIntervalListElement
else
return
heightListElement
+
intervalListElement
id
:
textDelegateComboBox
anchors.fill
:
parent
anchors.topMargin
:
paddingTopItemDelegate
anchors.leftMargin
:
popup
.
visible
?
sidePaddingActive
:
sidePaddingNormal
anchors.rightMargin
:
popup
.
visible
?
sidePaddingActive
:
sidePaddingNormal
font
:
fontComboBox
//Calculates various properties of a given string of text for a particular font
TextMetrics
{
id
:
tm
font
:
fontComboBox
elide
:
Text
.
ElideRight
text
:
modelData
elideWidth
:
{
if
(
index
!=
currentIndex
)
return
widthPopupComboBoxActive
-
2
*
sidePaddingActive
;
else
return
widthPopupComboBoxNormal
-
indicatorWidth
-
indicatorLeftInterval
;
}
}
FontMetrics
{
id
:
fm
font
:
fontComboBox
}
text
:
{
if
(
index
!=
currentIndex
)
{
if
(
tm
.
elidedText
.
length
<
tm
.
text
.
length
)
return
tm
.
elidedText
.
substring
(
0
,
tm
.
elidedText
.
length
-
1
)
+
((
fm
.
tightBoundingRect
(
tm
.
elidedText
.
substring
(
0
,
tm
.
elidedText
.
length
-
1
)).
width
+
fm
.
tightBoundingRect
(
tm
.
text
.
charAt
(
tm
.
elidedText
.
length
-
1
)
+
'
..
'
).
width
)
<
tm
.
elideWidth
?
(
tm
.
text
.
charAt
(
tm
.
elidedText
.
length
-
1
)
+
'
..
'
)
:
'
..
'
);
return
tm
.
elidedText
.
replace
(
'
…
'
,
'
..
'
);
}
else
{
if
(
tm
.
elidedText
.
length
<
tm
.
text
.
length
)
mainLineText
=
tm
.
elidedText
.
substring
(
0
,
tm
.
elidedText
.
length
-
1
)
+
((
fm
.
tightBoundingRect
(
tm
.
elidedText
.
substring
(
0
,
tm
.
elidedText
.
length
-
1
)).
width
+
fm
.
tightBoundingRect
(
tm
.
text
.
charAt
(
tm
.
elidedText
.
length
-
1
)
+
'
..
'
).
width
)
<
tm
.
elideWidth
?
(
tm
.
text
.
charAt
(
tm
.
elidedText
.
length
-
1
)
+
'
..
'
)
:
'
..
'
);
else
mainLineText
=
tm
.
elidedText
.
replace
(
'
…
'
,
'
..
'
);
return
""
;
}
}
color
:
hovered
?
hilightColorText
:
normalColorText
}
if
(
index
==
count
-
1
)
return
heightListElement
+
bottomIntervalListElement
return
heightListElement
+
intervalListElement
}
else
return
0
}
//Text item
contentItem
:
Text
{
id
:
textDelegateComboBox
anchors.fill
:
parent
anchors.topMargin
:
paddingTopItemDelegate
anchors.leftMargin
:
popup
.
visible
?
sidePaddingActive
:
sidePaddingNormal
font
:
dapComboBox
.
font
text
:
if
(
index
!=
currentIndex
)
return
modelData
;
else
return
""
color
:
hovered
?
hilightColorText
:
normalColorText
}
//Indent from the bottom edge or the next line that will not stand out when you hover over the mouse
background
:
Rectangle
{
anchors.fill
:
parent
anchors.bottomMargin
:
{
if
(
index
==
count
-
2
)
//Indent from the bottom edge or the next line that will not stand out when you hover over the mouse
background
:
Rectangle
{
if
(
index
+
1
==
currentIndex
)
return
bottomIntervalListElement
else
return
intervalListElement
anchors.fill
:
parent
anchors.bottomMargin
:
{
if
(
index
==
count
-
2
)
{
if
(
index
+
1
==
currentIndex
)
return
bottomIntervalListElement
else
return
intervalListElement
}
if
(
index
==
count
-
1
)
return
bottomIntervalListElement
return
intervalListElement
}
color
:
hovered
?
hilightColor
:
normalColor
}
if
(
index
==
count
-
1
)
return
bottomIntervalListElement
return
intervalListElement
}
color
:
hovered
?
hilightColor
:
normalColor
highlighted
:
parent
.
highlightedIndex
===
index
}
highlighted
:
parent
.
highlightedIndex
===
index
}
}
Loading