added basic pull to refresh on event form
This commit is contained in:
parent
74b9233a9e
commit
8400d2db1c
4 changed files with 65 additions and 21 deletions
|
@ -5,6 +5,8 @@ import QtQuick.Controls 2.4
|
|||
ListView {
|
||||
id: eventList
|
||||
|
||||
signal refresh()
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
|
||||
|
@ -12,6 +14,12 @@ ListView {
|
|||
id: foodPlanModel
|
||||
}
|
||||
|
||||
onContentYChanged: {
|
||||
if(contentY < -150){
|
||||
eventList.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Button {
|
||||
id: delegate
|
||||
|
||||
|
|
|
@ -37,29 +37,62 @@ Page {
|
|||
|
||||
Loader {
|
||||
id: pageLoader
|
||||
|
||||
property string newSource: ""
|
||||
|
||||
onNewSourceChanged: {
|
||||
oldItemAnimation.start()
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
source: "./LoadingForm.qml"
|
||||
|
||||
onSourceChanged: animation.start()
|
||||
onSourceChanged: newItemAnimation.start()
|
||||
|
||||
NumberAnimation {
|
||||
id: animation
|
||||
target: pageLoader.item
|
||||
id: newItemAnimation
|
||||
target: pageLoader
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 100
|
||||
duration: 500
|
||||
easing.type: Easing.InExpo
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: oldItemAnimation
|
||||
target: pageLoader
|
||||
property: "opacity"
|
||||
from: 100
|
||||
to: 0
|
||||
duration: 500
|
||||
easing.type: Easing.InExpo
|
||||
|
||||
onRunningChanged: {
|
||||
if(!running){
|
||||
pageLoader.source = pageLoader.newSource
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: pageLoader.item
|
||||
onRefresh: {
|
||||
pageLoader.newSource = "./LoadingForm.qml"
|
||||
loadTimer.start()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: loadTimer
|
||||
interval: 500
|
||||
running: true
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
status = serverConn.getEvents(day)
|
||||
pageLoader.source = "../Components/EventView.qml"
|
||||
pageLoader.newSource = "../Components/EventView.qml"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import QtQuick.Controls 2.4
|
|||
Page {
|
||||
id: root
|
||||
|
||||
signal refresh()
|
||||
|
||||
BusyIndicator {
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
|
|
@ -415,6 +415,7 @@ int ServerConn::getEvents(QString day){
|
|||
|
||||
if(blocksOK != 3) {
|
||||
// if there are more or less than 3 filled blocks, the data is invalid
|
||||
this->m_events.clear();
|
||||
return(900);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue