qmdiClient Class Reference

Interface for menus and toolbars. More...

List of all members.

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.
qmdiServermdiServer
 A pointer to the MDI server in which this client is inserted.


Detailed Description

Interface for menus and toolbars.

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.

See also:
qmdiActionGroupList

qmdiTabWidget


Member Function Documentation

bool qmdiClient::closeClient (  )  [virtual]

close the MDI client

Returns:
true if the widget is closed after this call
If you want to delete MDI clients from your MDI server, sometimes just deleting this client is not the smart move. For example if the client contains an user editable document, the user should be asked to save his changes, and maybe even abort.

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

See also:
canCloseClient()

QObject::deleteLater()

bool qmdiClient::canCloseClient (  )  [virtual]

check if the MDI client is valid for closing

Returns:
true is it is OK to destruct the MDI client
This function should return true if the MDI client is safe for removal from the MDI client. Clients are valid for removal usually if no changes have been made, or the user accepted to save then.

You can define your own logic by re-implementing this function in your derived classes.

See also:
closeClient()


Member Data Documentation

qmdiClient::name

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.

qmdiClient::fileName

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.

qmdiClient::menus

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 );

See also:
qmdiClient::toolbars

qmdiClient::toolbars

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 );

See also:
qmdiClient::menus

qmdiClient::mdiServer

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.

See also:
qmdiServer


The documentation for this class was generated from the following files:
Generated on Fri Jun 29 21:56:34 2007 for qmdilib by  doxygen 1.5.1