Inheritance diagram for qmdiWorkspace:
Public Slots | |
bool | eventFilter (QObject *obj, QEvent *event) |
event filter for the tabbar | |
void | workspaceChanged (QWidget *w) |
called when the active window in the workspace is changed [SLOT] | |
void | tabBarChanged (int index) |
called when the a new tab bar changed [SLOT] | |
void | windowDeleted (QObject *o) |
called when a window is closed [SLOT] | |
void | on_middleMouse_pressed (int, QPoint) |
mouse middle button click callback | |
void | on_rightMouse_pressed (int, QPoint) |
mouse right button click callback | |
Public Member Functions | |
qmdiWorkspace (QWidget *parent=NULL, qmdiHost *host=NULL) | |
default constructor | |
void | addTab (QWidget *widget, QString name) |
add a new MDI client to the workspace | |
QWidget * | currentWidget () |
returns the current widget | |
const QWidget * | cornerWidget (Qt::Corner corner=Qt::TopRightCorner) |
return the widget found in a corner | |
void | setCornerWidget (QWidget *widget, Qt::Corner corner=Qt::TopRightCorner) |
set the widget at a corner of the widget | |
QWidget * | widget (int i) |
return a widget by number | |
int | currentIndex () |
returns the index of the current active window | |
int | count () |
return the number of widgets available on the workspace | |
virtual void | addClient (qmdiClient *client) |
add a new MDI client to the workspace | |
virtual int | getClientsCount () |
return the number of sub clients in this server | |
virtual qmdiClient * | getClient (int i) |
return the number of sub clients in this server |
This class is a new MDI server, based on top of QWorkspace. It is built with a similar API to qmdiTabWidget and QTabWidget. Since the API is similar this means you can switch applications from QTabWidget to qmdiWorkspace in very small modifications to your code.
This class is also a valid qmdiServer, which means it will dynamically modify the main window menus and toolbars when a new child is selected.
The relations are:
When a new widget is selected on the qmdiServer (the user changes), the old widget is removed from the qmdiHost, and only then the new MDI client is added to the qmdiHost.
To use this class properly, insert it into a QMainWindow which also derives qmdiHost, and insert into it QWidgets which also derive qmdiClient.
qmdiWorkspace::qmdiWorkspace | ( | QWidget * | parent = NULL , |
|
qmdiHost * | host = NULL | |||
) |
default constructor
parent | the parent of this widget | |
host | the MDI host to connect to |
The constructor also creates the tab bar, to make this widget look like a QTabWidget
void qmdiWorkspace::addTab | ( | QWidget * | widget, | |
QString | name | |||
) |
add a new MDI client to the workspace
widget | the widget to be added to the workspace | |
name | the name to be associated with this widget |
Since this class is API compatible to QTabWidget, is takes the same arguments.
QWidget * qmdiWorkspace::currentWidget | ( | ) |
returns the current widget
QTabWidget::currentWidget()
const QWidget * qmdiWorkspace::cornerWidget | ( | Qt::Corner | corner = Qt::TopRightCorner |
) |
return the widget found in a corner
corner | corner to be queried |
void qmdiWorkspace::setCornerWidget | ( | QWidget * | widget, | |
Qt::Corner | corner = Qt::TopRightCorner | |||
) |
set the widget at a corner of the widget
widget | the widget to be stored | |
corner | the corner in which the widget should be stored |
QWidget * qmdiWorkspace::widget | ( | int | i | ) |
return a widget by number
i | the number of the widget to search |
int qmdiWorkspace::currentIndex | ( | ) |
returns the index of the current active window
int qmdiWorkspace::count | ( | ) |
return the number of widgets available on the workspace
Returns the number of widgets (or windows) available. The number should be the same as the number of tabs seen on screen.
void qmdiWorkspace::addClient | ( | qmdiClient * | client | ) | [virtual] |
add a new MDI client to the workspace
client | the client to be added to the workspace |
Implements qmdiServer.
int qmdiWorkspace::getClientsCount | ( | ) | [virtual] |
return the number of sub clients in this server
Return the number of sub-widgets in this server. Please note that this function can return also non-mdi clients.
This function return the value or QTabWidget::count()
Implements qmdiServer.
qmdiClient * qmdiWorkspace::getClient | ( | int | i | ) | [virtual] |
return the number of sub clients in this server
i | the number of sub widget to return |
This function return the value or QTabWidget::widget(i)
Implements qmdiServer.
bool qmdiWorkspace::eventFilter | ( | QObject * | obj, | |
QEvent * | event | |||
) | [slot] |
event filter for the tabbar
obj | the object which created the event | |
event | the event to be processed |
The function will call the functions:
Future implementations might also re-order the tabs.
For more information read the documentation of QObject::installEventFilter.
void qmdiWorkspace::workspaceChanged | ( | QWidget * | w | ) | [slot] |
called when the active window in the workspace is changed [SLOT]
w | the new window which has been focused |
This slot is connected at the constructor.
void qmdiWorkspace::tabBarChanged | ( | int | index | ) | [slot] |
called when the a new tab bar changed [SLOT]
index | the index of the client which was focused |
This slot is connected at the constructor.
void qmdiWorkspace::windowDeleted | ( | QObject * | o | ) | [slot] |
called when a window is closed [SLOT]
o | the window which has been deleted from the workspace |
This slot is connected when a window is added to the workspace.
void qmdiWorkspace::on_middleMouse_pressed | ( | int | i, | |
QPoint | ||||
) | [slot] |
mouse middle button click callback
i | number of client pressed |
void qmdiWorkspace::on_rightMouse_pressed | ( | int | i, | |
QPoint | p | |||
) | [slot] |
mouse right button click callback
i | number of client pressed | |
p | coordinate of the click event |