I created this code for my project:
void MainWindow::slot_menuEditZoomOut() {
WindowAreaManagerInterface::instance()->
LambaOnCurrentCustomWindow<CAbstractZoomAction>([](CAbstractZoomAction *zoom){ zoom->zoomOut(); });
}
Where the WindowAreaManagerInterface is
class WindowAreaManagerInterface : public QMdiArea {
Q_OBJECT
public:
static WindowAreaManagerInterface *instance();
template<class T>
T *currentCustomWindow() {
QWidget *widget = 0;
QMdiSubWindow *subWindow = currentSubWindow();
if (subWindow) widget = subWindow->widget();
return dynamic_cast<T *> (widget);
}
template<class T, typename Func>
void LambaOnCurrentCustomWindow(Func F) {
T *window = currentCustomWindow<T>();
if (window)
F(window);
}
//other methods follow..
}
Hope this help.