More fixes
This commit is contained in:
parent
004836fc8f
commit
8c815146e6
6 changed files with 53 additions and 48 deletions
|
|
@ -7,8 +7,8 @@ import qs.Commons
|
|||
Singleton {
|
||||
id: root
|
||||
|
||||
// Bar position property
|
||||
property string position: Settings.data.bar.position
|
||||
// Bar position property - initialize safely
|
||||
property string position: "top"
|
||||
|
||||
// Signal emitted when bar position changes
|
||||
signal barPositionChanged(string newPosition)
|
||||
|
|
@ -17,7 +17,7 @@ Singleton {
|
|||
Connections {
|
||||
target: Settings
|
||||
function onDataChanged() {
|
||||
if (Settings.data.bar.position !== root.position) {
|
||||
if (Settings.data && Settings.data.bar && Settings.data.bar.position !== root.position) {
|
||||
root.position = Settings.data.bar.position
|
||||
root.barPositionChanged(root.position)
|
||||
}
|
||||
|
|
@ -31,6 +31,15 @@ Singleton {
|
|||
|
||||
// Function to change bar position
|
||||
function setPosition(newPosition) {
|
||||
Settings.data.bar.position = newPosition
|
||||
if (Settings.data && Settings.data.bar) {
|
||||
Settings.data.bar.position = newPosition
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize position after component is completed
|
||||
Component.onCompleted: {
|
||||
if (Settings.data && Settings.data.bar) {
|
||||
position = Settings.data.bar.position
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue