Question: I would like to ask about QStackedLayout.
Now, I have a several widgets added to the QStackedLayout
And I want to do sth like that:
When user switch to Page X, refresh Page X.

How can I do that?
I have a custom code that I want to run when it refreshes
Thank You very much

Answer: 
Based on your comment to mine, it seems like you are looking for a signal that is generated when the current page changes so that you can update the underlying data for the screen. In that case, you would want to hook a slot up to [void QStackedWidget::currentChanged(int index)](http://doc.qt.nokia.com/latest/qstackedwidget.html#currentChanged)
In my opinion, the best way to handle this situation is through inheritance. Create a class that derives from `QWidget` that has a virtual update function. Use that as a base class for every page of your stacked widget. In your class that contains the stacked widget, connect a slot to the [`currentChanged(int index)`](http://doc.qt.nokia.com/latest/qstackedwidget.html#currentChanged) signal of the stacked widget. In that slot, get the current widget, [`qobject_cast`](http://doc.qt.nokia.com/latest/qobject.html#qobject_cast) it to your base type, and (if successful) call the update function on it.

Each class that is a page in your stacked widget should then override the update function and use it to update its information as necessary.