Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtquickcontrols-nemo
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
NemoMobile
qtquickcontrols-nemo
Commits
0e1a8952
Commit
0e1a8952
authored
Oct 27, 2013
by
Aleksi Suomalainen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slider] Slider as bezier curve
parent
737679a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
2 deletions
+55
-2
SliderStyle.qml
src/styles/SliderStyle.qml
+53
-1
slider-ball.png
src/styles/images/slider-ball.png
+0
-0
styles.pro
src/styles/styles.pro
+2
-1
No files found.
src/styles/SliderStyle.qml
View file @
0e1a8952
...
...
@@ -19,13 +19,65 @@
import
QtQuick
2.1
import
QtQuick
.
Controls
.
Styles
1.0
import
QtQuick
.
Controls
.
Styles
.
Nemo
1.0
SliderStyle
{
GrooveStyle
{
id
:
grooveStyle
}
handle
:
Item
{
}
Image
{
id
:
ball
source
:
"
images/slider-ball.png
"
z
:
1
visible
:
control
.
enabled
}
handle
:
Canvas
{
Connections
{
target
:
control
onValueChanged
:
{
if
(
Math
.
abs
(((
control
.
value
*
1000
)
-
lastValue
))
>
10
)
{
requestPaint
()
lastValue
=
control
.
value
*
1000
}
}
}
id
:
canvas
width
:
125
height
:
50
property
color
strokeStyle
:
Theme
.
groove
.
foreground
property
color
fillStyle
:
Theme
.
groove
.
foreground
property
bool
fill
:
true
property
bool
stroke
:
true
property
real
alpha
:
1.0
property
real
lastValue
:
0
antialiasing
:
true
onPaint
:
{
canvas
.
loadImage
(
"
images/slider-ball.png
"
);
var
ctx
=
canvas
.
getContext
(
'
2d
'
);
ctx
.
save
();
ctx
.
translate
(
0
,
8
);
ctx
.
fillStyle
=
canvas
.
fillStyle
;
ctx
.
beginPath
();
ctx
.
lineWidth
=
1
;
ctx
.
moveTo
(
0
,
38
);
ctx
.
bezierCurveTo
(
0
,
8
,
0
,
8
,
0
,
8
);
ctx
.
bezierCurveTo
(
55
,
8
,
55
,
8
,
55
,
8
);
ctx
.
bezierCurveTo
(
85
,
0
,
85
,
0
,
85
,
0
);
ctx
.
bezierCurveTo
(
85
,
32
,
85
,
32
,
85
,
32
);
ctx
.
bezierCurveTo
(
55
,
25
,
55
,
25
,
55
,
25
);
ctx
.
bezierCurveTo
(
0
,
24
,
0
,
24
,
0
,
24
);
ctx
.
closePath
();
ctx
.
fill
();
ctx
.
drawImage
(
"
images/slider-ball.png
"
,
75
,
-
3
,
45
,
45
);
ctx
.
fillStyle
=
"
white
"
;
ctx
.
font
=
"
Bold 24px
"
;
ctx
.
fillText
(
parseInt
(
control
.
value
*
100
),
84
,
27
);
ctx
.
restore
();
}
}
groove
:
grooveStyle
;
}
src/styles/images/slider-ball.png
0 → 100644
View file @
0e1a8952
1.88 KB
src/styles/styles.pro
View file @
0e1a8952
...
...
@@ -50,7 +50,8 @@ QML_FILES += \
images
/
arrow
-
right
.
png
\
images
/
arrow
-
right
@
2
x
.
png
\
images
/
disabled
-
overlay
.
png
\
images
/
switch
-
ball
.
png
images
/
switch
-
ball
.
png
\
images
/
slider
-
ball
.
png
OTHER_FILES
+=
qmldir
\
themes
/
Theme1
.
js
\
...
...
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