I have Theme1.js which has the property variables related to Theme 1 styling, Similarly like this I have for Theme 2, Theme2.jsNow in main.qml, If I click on the MouseArea, The Theme should toggle between Theme1 to Theme2. I found that conditional import Statements doesn't exist in QML. Is there any other way for this.?
Theme1.js
var color="red";var textString="This is Theme1"
Theme2.js
var color="green";var textString="This is Theme2"
main.qml
import QtQuick 2.3import QtQuick.Window 2.2import "Theme1.js" as Theme //default Theme Window { visible: true color:Theme.color MouseArea { anchors.fill: parent onClicked: { //Change Theme 1 to Theme 2. Basically Toggle Theme here } } Text { text: Theme.textString anchors.centerIn: parent }}