Added an editable item delegate. Only Factor plus/minus button are working for now. (based on https://doc.qt.io/qt-6/qtquick-views-example.html as well)
This commit is contained in:
45
controls/PressAndHoldButton.qml
Normal file
45
controls/PressAndHoldButton.qml
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2017 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
import QtQuick
|
||||
|
||||
Image {
|
||||
id: container
|
||||
|
||||
property int repeatDelay: 300
|
||||
property int repeatDuration: 75
|
||||
property bool pressed
|
||||
|
||||
signal clicked
|
||||
|
||||
scale: pressed ? 0.9 : 1
|
||||
|
||||
function release() {
|
||||
autoRepeatClicks.stop()
|
||||
container.pressed = false
|
||||
}
|
||||
|
||||
SequentialAnimation on pressed {
|
||||
id: autoRepeatClicks
|
||||
running: false
|
||||
|
||||
PropertyAction { target: container; property: "pressed"; value: true }
|
||||
ScriptAction { script: container.clicked() }
|
||||
PauseAnimation { duration: container.repeatDelay }
|
||||
|
||||
SequentialAnimation {
|
||||
loops: Animation.Infinite
|
||||
ScriptAction { script: container.clicked() }
|
||||
PauseAnimation { duration: container.repeatDuration }
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
onPressed: autoRepeatClicks.start()
|
||||
onReleased: container.release()
|
||||
onCanceled: container.release()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user