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
287b2be5
Commit
287b2be5
authored
Mar 11, 2017
by
Don Gagne
Committed by
GitHub
Mar 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4746 from DonLakeFlyer/SliderTouch
Guided bar confirm: Better usability with touch
parents
5e9e8b81
3bb66583
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
18 deletions
+24
-18
SliderSwitch.qml
src/QmlControls/SliderSwitch.qml
+24
-18
No files found.
src/QmlControls/SliderSwitch.qml
View file @
287b2be5
...
...
@@ -9,7 +9,7 @@ import QGroundControl.Palette 1.0
Rectangle
{
id
:
_root
width
:
label
.
contentWidth
+
(
_diameter
*
2.5
)
+
(
_border
*
4
)
height
:
label
.
height
*
2.5
height
:
Math
.
max
(
ScreenTools
.
isMobile
?
ScreenTools
.
minTouchPixels
:
0
,
label
.
height
*
2.5
)
radius
:
height
/
2
color
:
qgcPal
.
window
...
...
@@ -49,31 +49,37 @@ Rectangle {
fillMode
:
Image
.
PreserveAspectFit
smooth
:
false
mipmap
:
false
color
:
qgcPal
.
text
cache
:
false
source
:
"
/res/ArrowRight.svg
"
}
MouseArea
{
id
:
sliderDragArea
anchors.fill
:
parent
drag.target
:
slider
drag.axis
:
Drag
.
XAxis
drag.minimumX
:
_border
drag.maximumX
:
_maxXDrag
}
MouseArea
{
id
:
sliderDragArea
anchors.leftMargin
:
-
ScreenTools
.
defaultFontPixelWidth
*
15
anchors.fill
:
slider
drag.target
:
slider
drag.axis
:
Drag
.
XAxis
drag.minimumX
:
_border
drag.maximumX
:
_maxXDrag
preventStealing
:
true
property
real
_maxXDrag
:
_root
.
width
-
(
_diameter
+
_border
)
property
bool
dragActive
:
drag
.
active
property
real
_dragOffset
:
1
property
real
_maxXDrag
:
_root
.
width
-
(
_diameter
+
_border
)
property
bool
dragActive
:
drag
.
active
onPressed
:
{
mouse
.
x
}
onDragActiveChanged
:
{
if
(
!
sliderDragArea
.
drag
.
active
)
{
if
(
slider
.
x
>
_maxXDrag
-
_border
)
{
_root
.
accept
()
}
slider
.
x
=
_border
onDragActiveChanged
:
{
if
(
!
sliderDragArea
.
drag
.
active
)
{
if
(
slider
.
x
>
_maxXDrag
-
_border
)
{
_root
.
accept
()
}
slider
.
x
=
_border
}
}
}
...
...
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