Public Member Functions | |
virtual bool | closeClient () |
close the MDI client | |
virtual bool | canCloseClient () |
check if the MDI client is valid for closing | |
Public Attributes | |
QString | name |
The name of the MDI client. | |
QString | fileName |
The file opened by this MDI client. | |
qmdiActionGroupList | menus |
The list of menus defined by this MDI client. | |
qmdiActionGroupList | toolbars |
The list of toolbars defined by this MDI client. | |
qmdiServer * | mdiServer |
A pointer to the MDI server in which this client is inserted. |
If you want to use qmdilib, every one of your widgets must inherit qmdiClient and define their own menus using this class. Any widget which will be inserted into a qmdiServer and does not inherit qmdiClient will not show special menus and toolbars.
On the documentation of qmdilib, any widget inserted into a qmdiServer that inherits qmdiClient will be called MDI client. In the following example the class newclient is a MDI client.
class newclient: public QTextEdit, public qmdiClient { ... };
Defining menus and toolbars is easy:
newclient::newclient() { // some code ... menus["&File"]->addAction( actionNew ); menus["&File"]->addSeparator(); menus["&File"]->addAction( actionQuit ); toolbars["General"]->addAction( actionNew ); }
You will have also to insert this MDI client into an MDI server (for example qmdiTabWidget). The menus and toolbars will be merged automatically for you every time you widget is selected on the qmdiServer.
bool qmdiClient::closeClient | ( | ) | [virtual] |
close the MDI client
By default this function does:
This means that for read only clients you can leave the default. On R/W clients which derive QObject, you will have to override canCloseClient(). If your derived class does not derive QObject, you will need to overide this function as well.
TODO update documentation
QObject::deleteLater()
bool qmdiClient::canCloseClient | ( | ) | [virtual] |
check if the MDI client is valid for closing
You can define your own logic by re-implementing this function in your derived classes.
The name of the MDI client.
This property defines the name of the MDI client. The name is used by qmdiTabWidget for setting the tab name, when inserting the widget into the tab widget.
The file opened by this MDI client.
This property defines the file name which is opened by the MDI client. The file name is not really used inside qmdilib , but it's left for usage outside of library. The name property should reflect this property, but it's not really needed.
The list of menus defined by this MDI client.
The list of menus this MDI client defines, and will be merged each time the MDI client is showed on screen.
The syntax for defining menus is:
menus->addAction( actionNew ); menus->addAction( actionOpen ); menus->addAction( actionSave ); menus->addSeparator(); menus->addAction( actionQuit );
The list of toolbars defined by this MDI client.
The list of toolbars this MDI client defines, and will be merged each time the MDI client is showed on screen.
The syntax for defining toolbars is:
toolbars->addAction( actionNew ); toolbars->addSeparator(); toolbars->addAction( actionOpen ); toolbars->addAction( actionSave );
A pointer to the MDI server in which this client is inserted.
When the MDI client is inserted into a MDI server, this property is set to point to the corresponding MDI server. This property is read only, and you should not assign value to it.
You can use this property to insert new clients into the server, from this client.