Passing Information from a (sub)page to the calling page

Hi,

i would like to pass information from my settings page to the page from which i was calling the settings page. Specifically, if a special settings entry has changed, i need to reload the overview page after closing the settings page (settings page is opened from the overview page). what is the preferred way to notify the overview page that is has to reload the data. i do not want to remember the state of the last settings entry in the overview page - a notification would be nice. So what is the best way to implement this “notification” ?

Thanks in advance,
Cheers,
Andreas

1 Like

I don’t know if it’s the preferred way but I use a signal:

Opening the settings:

settingsPage = pageStack.push(Qt.resolvedUrl('Settings.qml'),
                              {someVar: someValue})
settingsPage.someValueSelected.connect(doSomething)

function doSomething(value) {
}

In Settings.qml:

signal someValueSelected(var value)

Then just call somValueSelected(value) and do what you need to do in doSomething().

In use here:


here:

and here:
2 Likes

The {someVar: someValue} in pageStack.push() is of course only needed if you need to pass arguments to the settings page.

1 Like

Looks goods. I will try this. Thanks a lot.