Hello,
I’m sorry if this is a really simply question but I haven’t been able to find anything online, or I have but didn’t recognize it as a solution.
I have a page that has a Rectangle{} that has ‘visible’ set to true or false depending on a user setting. However, if I first load the page with the rectangle then go to the page with the settings (using NavigationStack) and change the setting then finally return to the page with the rectangle, the visibility doesn’t change. In order to get the visibility to change, I have to quit and reload the app. Below is my structure:
Box Page:
NavigationItem {
title: "Box"
icon: IconType.list
NavigationStack {
Page {
title: "Red Box"
id: box_page
Item {
id: user_settings
property bool show_box
Component.onCompleted: {
// Load show_box setting
user_settings.show_box = Qt.binding(function(){ return myLocalStorage.getValue("show_box").value })
}
}
Column {
width: parent.width - dp(50)
anchors.centerIn: parent
spacing: dp(12)
Rectangle {
visible: (user_settings.show_box === true) ? true : false
height: dp(100)
width: dp(100)
color: "red"
}
}
}
}
}
In short, here are the steps and what I see vs. what I want to see:
- Navigate to ‘Box Page’ (I see the red box)
- Navigate to the user settings page
- Change the ‘show_box’ setting from true to false
- Navigate back to ‘Box Page’ (I see the red box but it shouldn’t be visible)
What am I missing? Can I set a page to always load as if it were the first load after closing the app?
Thank you,
Eric