Notification, when leaving (settings) page

I have a problem regarding the leaving of the settings page in my application.
When leaving the settings page i would like to send a signal to another page, so that the
other page can reload the data according to the new configuration. The problem is
that it is not working with

onStatusChanged: if (status === PageStatus.Deactivating) {}

because the statusChanged event is not only triggered when i go back to the previous page (which
is ok), however it is also triggered, when the ComboBox on my settings page is selected.
The comboBox has a lot of entries, so the the ?Silica Framework? decides to display the selection
in a new page. When opening the new page for the selection - the statusChanged event is triggered
for the SettingsPage, which is not intended in this situation.

Any ideas how to prevent this situation. i only want to get a notification when actually leaving
the settings page (when finished).

Huh. Interesting phenomenon.

You could make your Settings page a Dialog instead of a Page, and then react on the accepted() signal instead of page status.

Or use a custom signal (needRefresh() or so) in your Settings page.

Or, not use any page stuff at all and have something like

ApplicationWindow { id: app
  property bool needRefresh: false

  ...

}

SettingsPage {

   onMySettingChanged: app.needRefresh = true

}

ContentPage {

//Bindings { 
Connections { 
    target: app
    onNeedRefreshChanged: { 
       if (app.needRefresh) refreshData()
       app.needRefresh = false
       
    }
}

}
1 Like

Thanks for the hints - i will try.

1 Like

There was an error in my example above. Bindings should be Connections.

1 Like