File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,28 +17,32 @@ Item {
1717
1818 function setPressed () {
1919 button .down = true ;
20- pressed ();
20+ onButtonPressed ();
2121 }
2222
2323 function setReleased () {
2424 button .down = false ;
25- released ();
25+ onButtonReleased ();
2626 }
2727
28- onPressed: {
28+ function onButtonPressed () {
29+ control .pressed ();
30+
2931 if (! longTimer .running ) {
3032 longTimer .start ();
3133 }
3234
33- if (shortTimer .running ) {
34- shortTimer .stop ();
35+ if (releaseTimer .running ) {
36+ releaseTimer .stop ();
3537 }
3638 }
3739
38- onReleased: {
40+ function onButtonReleased () {
41+ releaseTimer .start ();
42+
3943 if (longTimer .running ) {
4044 longTimer .stop ();
41- shortTimer . start ();
45+ control . shortPress ();
4246 }
4347
4448 if (repeatTimer .running ) {
@@ -60,15 +64,15 @@ Item {
6064 icon .width : 32
6165 icon .height : 32
6266
63- onPressed: control . pressed ()
64- onReleased: control . released ()
67+ onPressed: onButtonPressed ()
68+ onReleased: onButtonReleased ()
6569 }
6670
6771 Timer {
68- id: shortTimer
72+ id: releaseTimer
6973 repeat: false
7074 interval: 1
71- onTriggered: control .shortPress ()
75+ onTriggered: control .released ()
7276 }
7377
7478 Timer {
You can’t perform that action at this time.
0 commit comments