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: {
|
onContentYChanged: {
|
||||||
if(contentY < -150){
|
if(contentY < -125){
|
||||||
eventList.refresh()
|
eventList.refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,17 @@ import QtQuick.Controls 2.4
|
||||||
ListView {
|
ListView {
|
||||||
id: foodList
|
id: foodList
|
||||||
|
|
||||||
|
signal refresh()
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 10
|
anchors.margins: 10
|
||||||
|
|
||||||
|
onContentYChanged: {
|
||||||
|
if(contentY < -125){
|
||||||
|
foodList.refresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
model: FoodPlanModel {
|
model: FoodPlanModel {
|
||||||
id: foodPlanModel
|
id: foodPlanModel
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,21 +51,21 @@ Page {
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id: newItemAnimation
|
id: newItemAnimation
|
||||||
target: pageLoader
|
target: pageLoader.item
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
from: 0
|
from: 0
|
||||||
to: 100
|
to: 1
|
||||||
duration: 500
|
duration: 200
|
||||||
easing.type: Easing.InExpo
|
easing.type: Easing.InExpo
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id: oldItemAnimation
|
id: oldItemAnimation
|
||||||
target: pageLoader
|
target: pageLoader.item
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
from: 100
|
from: 1
|
||||||
to: 0
|
to: 0
|
||||||
duration: 500
|
duration: 200
|
||||||
easing.type: Easing.InExpo
|
easing.type: Easing.InExpo
|
||||||
|
|
||||||
onRunningChanged: {
|
onRunningChanged: {
|
||||||
|
@ -82,7 +82,6 @@ Page {
|
||||||
loadTimer.start()
|
loadTimer.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
|
|
|
@ -38,29 +38,61 @@ Page {
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: pageLoader
|
id: pageLoader
|
||||||
|
|
||||||
|
property string newSource: ""
|
||||||
|
|
||||||
|
onNewSourceChanged: {
|
||||||
|
oldItemAnimation.start()
|
||||||
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: "./LoadingForm.qml"
|
source: "./LoadingForm.qml"
|
||||||
|
|
||||||
onSourceChanged: animation.start()
|
onSourceChanged: newItemAnimation.start()
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id: animation
|
id: newItemAnimation
|
||||||
target: pageLoader.item
|
target: pageLoader.item
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
from: 0
|
from: 0
|
||||||
to: 100
|
to: 1
|
||||||
duration: 500
|
duration: 200
|
||||||
easing.type: Easing.InExpo
|
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 {
|
Timer {
|
||||||
|
id: loadTimer
|
||||||
interval: 500
|
interval: 500
|
||||||
running: true
|
running: true
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
root.status = serverConn.getFoodPlan()
|
root.status = serverConn.getFoodPlan()
|
||||||
pageLoader.source = "../Components/FoodPlanView.qml"
|
pageLoader.newSource = "../Components/FoodPlanView.qml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue