Refresh your apps automactically when there are changes on QML file.
No need to rebuild the whole project in debug mode.
use QML Loader Type to serve the previous main.cpp(which is renamed to MainWindow.qml in my project to be used as a component)
Loader can load qrc:..filename which is compiled by rcc, but in debug mode we can let it directly read qml from localfile, which is also possible.
From C++ aspect, monitor a directory's change by using the QT lib called QSystemFileWathcer. After file changed, a signal emitted and use a function in a class to receive it called reloadApp().
In the function, just update the Loader's source and That's ok. If there is syntax error in the file, redirect it to a ErrorPage to prevent the app from exiting.
Later, considering more flexibility, we decide to use two Loader in the ApplicationWindow to load two component.
Use Binding and the currentIndex and the tabbar and swipeview can communicate each other.
- re-structure and delete all not related file content and especially dir
- set the function only enabled in debug mode (no need because it will reduce the functionality)
- search what's qDebug()(can display QString or something else), why it can be executed after engine.load,(all the code except cout can be executed immediately) and will it automatically disappear in release mode (no)
- the problem of path. currently we specify the aboulute path. Can it be substituted by cMakeLists.txt
- keep the window at the same position
- bugs: syntax error will lead to the program down.
- questions: how about add some image file and use it in the component, you add it to the qrc but rcc didn't compile it until its been re-build (not a question in develop mode)
https://github.com/Mogara/GameHall
we will focus on develop this project later. Welcome to watch and join us.