Unsolved Deployment of different QML files
-
I have two QML files of same project. The UI apperance of two files are different based on mobile and desktop machine. If i select the desktop deployment, the one QML file will be deployed. If I choose Android deployment, the another file will be loaded in the loader. How i can choose QML file based on the deployment of target platform?
-
-
@eswar you can also use QQmlFileSelector
-
-
hi @eswar
To implement it in your main.cpp file, you just need to create a new instance of QQmlFileSelector.
new QQmlFileSelector(QQmlEngine);
Then, your data directory should be like this:
qml/+android/File.qml //this file will be called if you are compiling in Android qml/File.qml //this is your base file which will be used when in Desktop
In your qml files, you just have to call File{}, qml will automatically call the correct file to instantiate.
Please be reminded that both files should have the same properties, even if it is not being used by the other.hope this will help.