finished up pull to refresh at the event and foodplan form
This commit is contained in:
parent
8400d2db1c
commit
e2e83ba5ea
4 changed files with 52 additions and 13 deletions
|
@ -15,7 +15,7 @@ ListView {
|
|||
}
|
||||
|
||||
onContentYChanged: {
|
||||
if(contentY < -150){
|
||||
if(contentY < -125){
|
||||
eventList.refresh()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,17 @@ import QtQuick.Controls 2.4
|
|||
ListView {
|
||||
id: foodList
|
||||
|
||||
signal refresh()
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
|
||||
onContentYChanged: {
|
||||
if(contentY < -125){
|
||||
foodList.refresh()
|
||||
}
|
||||
}
|
||||
|
||||
model: FoodPlanModel {
|
||||
id: foodPlanModel
|
||||
}
|
||||
|
|
|
@ -51,21 +51,21 @@ Page {
|
|||
|
||||
NumberAnimation {
|
||||
id: newItemAnimation
|
||||
target: pageLoader
|
||||
target: pageLoader.item
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 100
|
||||
duration: 500
|
||||
to: 1
|
||||
duration: 200
|
||||
easing.type: Easing.InExpo
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: oldItemAnimation
|
||||
target: pageLoader
|
||||
target: pageLoader.item
|
||||
property: "opacity"
|
||||
from: 100
|
||||
from: 1
|
||||
to: 0
|
||||
duration: 500
|
||||
duration: 200
|
||||
easing.type: Easing.InExpo
|
||||
|
||||
onRunningChanged: {
|
||||
|
@ -82,7 +82,6 @@ Page {
|
|||
loadTimer.start()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
|
|
|
@ -38,29 +38,61 @@ 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
|
||||
id: newItemAnimation
|
||||
target: pageLoader.item
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 100
|
||||
duration: 500
|
||||
to: 1
|
||||
duration: 200
|
||||
easing.type: Easing.InExpo
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: oldItemAnimation
|
||||
target: pageLoader.item
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: 0
|
||||
duration: 200
|
||||
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: {
|
||||
root.status = serverConn.getFoodPlan()
|
||||
pageLoader.source = "../Components/FoodPlanView.qml"
|
||||
pageLoader.newSource = "../Components/FoodPlanView.qml"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue