79 lines
1.5 KiB
QML
79 lines
1.5 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
|
|
|
|
signal refresh()
|
|
|
|
Component.onCompleted: {
|
|
|
|
}
|
|
|
|
ListView {
|
|
id: listView
|
|
|
|
model: control.listData.length
|
|
|
|
anchors.fill: parent
|
|
|
|
boundsBehavior: Flickable.DragOverBounds
|
|
boundsMovement: Flickable.StopAtBounds
|
|
|
|
//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
|
|
}
|
|
}
|
|
}
|
|
}
|