1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import QtQuick 2.0
import Ubuntu.Components 1.1
QtObject {
id: themeManager
property QtObject theme
property var themes
property string source
property int currentThemeIndex: -1
onSourceChanged: {
var themeComponent = Qt.createComponent(source)
if (themeComponent.status == Component.Ready) {
themeManager.theme = themeComponent.createObject(themeManager)
}
for (var i in themes) {
if (themes[i].source === themeManager.source) {
themeManager.currentThemeIndex = i;
break;
}
}
}
onCurrentThemeIndexChanged: {
themeManager.source = themes[currentThemeIndex].source
}
}
|