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
Commits
103c3d10
Commit
103c3d10
authored
5 years ago
by
littletux89@gmail.com
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into features-3005
parents
f067fa0c
82ecdc8e
No related branches found
No related tags found
2 merge requests
!50
Features 3819
,
!33
Master
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libdap-qt-ui-qml.qrc
+2
-0
2 additions, 0 deletions
libdap-qt-ui-qml.qrc
widgets/DapText.qml
+61
-0
61 additions, 0 deletions
widgets/DapText.qml
widgets/DapTextForm.ui.qml
+43
-0
43 additions, 0 deletions
widgets/DapTextForm.ui.qml
with
106 additions
and
0 deletions
libdap-qt-ui-qml.qrc
+
2
−
0
View file @
103c3d10
...
...
@@ -22,6 +22,8 @@
<file>widgets/DapRadioButtonForm.ui.qml</file>
<file>widgets/DapScrollView.qml</file>
<file>widgets/DapScrollViewForm.ui.qml</file>
<file>widgets/DapText.qml</file>
<file>widgets/DapTextForm.ui.qml</file>
<file>widgets/DapScrollViewHandling.qml</file>
</qresource>
</RCC>
This diff is collapsed.
Click to expand it.
widgets/DapText.qml
0 → 100644
+
61
−
0
View file @
103c3d10
import
QtQuick
2.4
DapTextForm
{
onTextChanged
:
{
elidedText
=
(
width
>
2
)
?
elideByWidth
(
width
)
:
(
maxSymbolCapacity
>
2
)
?
elideByCapacity
(
maxSymbolCapacity
)
:
text
width
=
_metrics
.
boundingRect
(
elidedText
).
width
height
=
_metrics
.
boundingRect
(
elidedText
).
height
}
// "Copy Button" handler
function
copy
()
{
_fullText
.
selectAll
()
_fullText
.
copy
()
}
// Elides text by number of symbols
function
elideByCapacity
(
maxSymbols
)
{
var
res
=
""
if
(
text
.
length
>
maxSymbols
)
{
switch
(
elide
)
{
case
Qt.ElideLeft
:
res
=
"
..
"
+
text
.
slice
(
-
maxSymbols
,
text
.
length
-
1
)
break
case
Qt.ElideMiddle
:
res
=
text
.
slice
(
0
,
Math
.
floor
(
maxSymbols
/
2
))
+
"
..
"
+
text
.
slice
(
Math
.
floor
(
maxSymbols
/
2
)
+
1
,
text
.
length
-
1
)
break
case
Qt.ElideRight
:
res
=
text
.
slice
(
0
,
maxSymbols
)
+
"
..
"
break
default
:
res
=
text
break
}
}
else
{
res
=
text
}
return
res
}
// Elides text by width
function
elideByWidth
(
maxWidth
)
{
if
(
_metrics
.
advanceWidth
(
text
)
>
maxWidth
)
{
var
symbolsNum
=
(
maxWidth
/
_metrics
.
averageCharacterWidth
)
return
elideByCapacity
(
Math
.
floor
(
symbolsNum
))
}
else
{
return
text
}
}
}
This diff is collapsed.
Click to expand it.
widgets/DapTextForm.ui.qml
0 → 100644
+
43
−
0
View file @
103c3d10
import
QtQuick
2.4
import
QtQuick
.
Controls
2.2
Item
{
id
:
dapText
///@details Text.
property
alias
text
:
fullText
.
text
///@details Text color.
property
alias
color
:
elidedText
.
color
///@details Font.
property
alias
font
:
elidedText
.
font
///@details Elide style.
property
int
elide
:
Qt
.
ElideRight
///@details The number of symbols to display.
property
int
maxSymbolCapacity
:
0
///@details Text to display.
property
alias
elidedText
:
elidedText
.
text
property
alias
_fullText
:
fullText
property
alias
_metrics
:
metrics
// Displays the text
Text
{
id
:
elidedText
}
// Calculates elide
FontMetrics
{
id
:
metrics
font
:
parent
.
font
}
// Stores full string to copy
TextInput
{
id
:
fullText
visible
:
false
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment