43 lines
868 B
QML
43 lines
868 B
QML
import QtQuick 2.15
|
|
import QtQuick.Controls 2.15
|
|
|
|
Item {
|
|
id: root
|
|
|
|
signal update()
|
|
|
|
property string text: qsTr("Release to update")
|
|
property real sensivity: 50.0
|
|
property alias enabled: connections.enabled
|
|
|
|
property bool triggered: false
|
|
property bool trigger: parent.contentY < -1 * sensivity
|
|
property bool atStart: parent.contentY === 0
|
|
|
|
Label {
|
|
id: label
|
|
|
|
anchors.horizontalCenter: root.horizontalCenter
|
|
|
|
visible: root.trigger
|
|
text: root.text
|
|
}
|
|
|
|
Connections {
|
|
id: connections
|
|
|
|
target: root.parent
|
|
|
|
function onContentYChanged() {
|
|
if (root.trigger) {
|
|
root.triggered = true
|
|
}
|
|
|
|
if (root.atStart && root.triggered) {
|
|
root.update()
|
|
root.triggered = false
|
|
}
|
|
}
|
|
}
|
|
}
|