Good design for workspace and signals connected to sub windows
I would like to ask for design rules regarding a workspace with sub windows. I have an example application using Qt 4 with a kind of multiple document interface (with QWorkspace handling the sub windows) . In the main window there are actions added to the menu bar, for example an action to save the current document as soon as the user activates this action. There is a document class which has to be told to save the document. Unfortunately the current document may change, if the user selects another sub window. Therefore it is not easy to use the signal-slot-mechanism. I don't know to which document instance I should connect the signal to.
The example application here connects the signal to a dummy slot in the main window and this slot redirects the request to the respective method in the document class, by querying the current document and calling the corresponding method of that instance. This causes a lot of boilerplate code.
As an alternative I could listen to the windowActivated(QWidget*) signal of QWorkspace and there reconnect the menu bar actions the the new document window. Is this a good solution? Or are there better ones? How do the experts handle this issue?
Thank you very much for any help!