This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/qml/components/RemoteDataListView.qml

86 lines
1.7 KiB
QML

import QtQuick 2.10
import QtQuick.Controls 2.4
Item {
id: control
property var loadData
property var listData: ({})
property Component delegate
property alias view: listView
property int status: -1
property alias contentY: listView.contentY
property alias model: listView.model
signal refresh()
Component.onCompleted: {
}
ListView {
id: listView
model: control.listData === undefined ? 0:control.listData.length
anchors.fill: parent
boundsBehavior: Flickable.DragOverBounds
boundsMovement: Flickable.StopAtBounds
anchors.margins: 1
anchors.rightMargin: 14
clip: true
//enabled: status === 200 || status === 902
//opacity: enabled ? 1:0
ScrollBar.vertical: ScrollBar {
parent: listView.parent
anchors {
top: listView.top
left: listView.right
margins: 10
leftMargin: 3
bottom: listView.bottom
}
width: 8
visible: listView.model > 0
active: true
}
delegate: control.delegate
onContentYChanged: {
/*
if(contentY < -listView.height * 0.3 && control.status !== 905){
contentY = 0
control.refresh()
}*/
}
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
}
FancyBusyIndicator {
anchors.centerIn: parent
opacity: !(status === 200 || status === 902) ? 1:0
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
}
}