Hi,
As shown below. In my MainWeatherLayout { } I am calling some yahoo weather json data. When my app starts everything loads very fast but the weather json takes some time to load. The Weather panels starts empty and when I complete the json data it loads data into my main weather panel.
I am thinking to get these data via Main.qml onInitTheme. Am I doing right, or should I load xml and json data via C++ and then load the main.qml.
I don’t know what is the best way to do it.
So, what is the best way to load heavy json or xml data before App starts?
Main.qml
import Felgo 3.0
import QtQuick 2.0
App {
id: app
onInitTheme: {
Theme.platform = "ios"
uiScale: 1 // 1 for Mobiles 2 for Desktops
screenWidth: 0
Theme.colors.statusBarStyle = Theme.colors.statusBarStyleHidden
}
FontLoader {
id: normalFont;
source: "../assets/fonts/Lato-Light.ttf"
}
Page {
id: mainPage
// (1): Layout: Photo Slide
MainPhotoSlideLayout {
id: myPhtoSlide
anchors.fill: parent
}
// (2): Layout: Star Background
MainBackgroundLayout {
id: myStarBackground
anchors.fill: parent
}
// (3): Layout: Top Bar
MainTopLayout {
id: myTop
anchors.top: parent.top
//anchors.topMargin: dp(5)
}
// (4): Layout: Logo
MainLogoLayout {
id: myLogo
anchors.top: myTop.bottom
anchors.topMargin: dp(10)
}
// (5): Layout: User Photo
MainUserPhotoLayout {
id: myUserPhoto
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: myLogo.bottom
anchors.topMargin: dp(50)
width: parent.width
}
// (6) Layout: Login
MainLoginLayout {
id: myLogin
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: myUserPhoto.bottom
anchors.topMargin: dp(120)
width: parent.width
}
// (7) Layout: Currency
MainDailyExcganeRateLayout {
id: myExcgange
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: myLogin.bottom
anchors.topMargin: dp(80)
width: parent.width - dp(40)
}
// (8) Layout: Weather
MainWeatherLayout {
id: myWeather
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: myExcgange.bottom
anchors.topMargin: dp(10)
width: parent.width - dp(40)
}
} // PAGE
} // APP