app/resources/qml/Components/DataListView.qml
2020-11-05 19:37:13 +01:00

111 lines
2.5 KiB
QML

/*
blueROCK - for digital rock
Copyright (C) 2019 Dorian Zedler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Controls 2.4
ListView {
id: control
property int status: -1
property bool loading: false
property var listData
property var emptyProperties: []
property bool useBuiltInPullRefresher: true
signal refresh()
anchors {
leftMargin: 10
rightMargin: 14
}
clip: true
//enabled: status === 200 || status === 902
//opacity: enabled ? 1:0
ScrollBar.vertical: ScrollBar {
parent: control.parent
anchors {
top: control.top
left: control.right
margins: 10
leftMargin: 3
bottom: control.bottom
}
width: 8
visible: control.model.length > 0
active: true
}
header: Item {
id: topSpacerItm
width: parent.width
height: 10
}
footer: Item {
id: bottomSpacerItm
width: parent.width
height: 10
}
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
InfoArea {
id: infoArea
anchors {
left: control.left
right: control.right
top: control.top
margins: app.landscape() ? control.width * 0.4:control.width * 0.3
topMargin: control.height*( status === 901 ? 0.6:0.5) - height * 0.8
}
excludedCodes: [200, 902, 905]
errorCode: control.status
}
PullRefresher {
target: control
visible: control.useBuiltInPullRefresher
postRefreshDelay: 0
busyIndicator: FancyBusyIndicator {}
refreshPosition: height * 1.3
onRefreshRequested: {
if(control.useBuiltInPullRefresher) {
control.refresh()
}
}
}
}