QStackedWidget closeEvent

i have a qstackedwidget where i added a few widgets. in one of the widgets i wanna read settings from ini file. and in the widget's closeevent function i call the function to write the settings. however it isn't called (this is somewhat expected cause it's a child widget). however, if i get the widget from the class where i add the qstackedwidget, and call the widget's write settings function, closeevent is received.