77 lines
1.4 KiB
QML
77 lines
1.4 KiB
QML
import QtQuick 2.9
|
|
import QtQuick.Controls 2.4
|
|
|
|
Item {
|
|
id: control
|
|
|
|
property var loadData
|
|
property var listData: ({})
|
|
property Component delegate
|
|
|
|
property int status: -1
|
|
|
|
signal refresh()
|
|
|
|
Component.onCompleted: {
|
|
|
|
}
|
|
|
|
ListView {
|
|
id: listView
|
|
|
|
model: control.listData.length
|
|
|
|
anchors.fill: parent
|
|
|
|
//enabled: status === 200 || status === 902
|
|
//opacity: enabled ? 1:0
|
|
|
|
boundsBehavior: ListView.StopAtBounds
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|