create ThemeComboBox
This commit is contained in:
parent
7a04cccf0c
commit
c03d24de15
2 changed files with 22 additions and 8 deletions
20
components/composite/ThemeComboBox.qml
Normal file
20
components/composite/ThemeComboBox.qml
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
import qs.components
|
||||||
|
import qs.config
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
StyledComboBox {
|
||||||
|
id: control
|
||||||
|
|
||||||
|
currentIndex: Theme.themes.indexOf(Theme.currentTheme)
|
||||||
|
model: Theme.themes
|
||||||
|
onActivated: index => {
|
||||||
|
Theme.currentTheme = Theme.themes[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
control.currentIndex = Theme.themes.indexOf(Theme.currentTheme);
|
||||||
|
Theme.onCurrentThemeChanged = () => {
|
||||||
|
Theme.themes.indexOf(Theme.currentTheme);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import qs.components
|
import qs.components
|
||||||
|
import qs.components.composite
|
||||||
import qs.config
|
import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
@ -10,16 +11,9 @@ StyledPane {
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "Theme"
|
text: "Theme"
|
||||||
// font.bold: true
|
|
||||||
font.pixelSize: Styling.typography.textSize.lg
|
font.pixelSize: Styling.typography.textSize.lg
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledComboBox {
|
ThemeComboBox {}
|
||||||
currentIndex: Theme.themes.indexOf(Theme.currentTheme)
|
|
||||||
model: Theme.themes
|
|
||||||
onActivated: index => {
|
|
||||||
Theme.currentTheme = Theme.themes[index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue