The MDI host is generally the main window. The MDI server is usually a qmdiTabWidget. The MDI clients are any widget you define, these are the widgets inserted into the MDI server.
When a new client is selected on the MDI server (for example a users selects a new tab), the MDI server (qmdiTabWidget or qmdiWorkspace) will try and merge the menus and toolbars in the MDI client (the widget inside the tab widget) into the MDI host (the main window). The MDI server will also un-merge the last MDI client from the MDI host. It also does a few other things behind the scenes, but you don't have to worry about it.
There are a few steps you should follow to use the library on your application:
class myWindow: public QMainWindow, public qmdiHost { ... };
myWindow *w = new myWindow; qmdiTabWidget *tab = new qmdiTabWidget(w); w->setCentralWidget( tab );
class myWidget: public QWidget, public qmdiClient { ... }; tab->insert( new myWidget );
QAction *fileNew = new QAction( this, "New" ); menus["&File"]->addAction( fileNew ); toolbars["File"]->addAction( fileNew );
myWindow::myWindow( QWidget *parent ):QMainWindow(parent) { // some initializations ... // generate some QActions ... updateGUI( this ); }
There are some full examples available, please read the code on these examples to get a full examples.
Go to the Main page