Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Q3Workspace Class Reference

The Q3Workspace widget provides a workspace window that be used in an MDI application. More...

    #include <Q3Workspace>

This class is part of the Qt 3 compatibility library. It is provided to keep old source code working. We strongly advise against using it in new code. See the Porting Guide for more information.

Inherits QWidget.

- List of all members, including inherited members

### Public Types

- enum WindowOrder { CreationOrder, StackingOrder }

### Writable Properties

- scrollBarsEnabled : bool

- 33 writable properties inherited from QWidget
- 1 writable property inherited from QObject

### Read-Only Properties

- 20 read-only properties inherited from QWidget

### Public Functions

- Q3Workspace ( QWidget * parent = 0 )
- Q3Workspace ( QWidget * parent, const char * name )
- ~Q3Workspace ()
- QWidget * activeWindow () const
- QWidget * addWindow ( QWidget * w, Qt::WFlags flags = 0 )
- void setPaletteBackgroundColor ( const QColor & c )
- void setPaletteBackgroundPixmap ( const QPixmap & pm )
- QWidgetList windowList ( WindowOrder order = CreationOrder ) const

- 92 public functions inherited from QWidget
- 26 public functions inherited from QObject
- 10 public functions inherited from QPaintDevice

### Public Slots

- void activateNextWindow ()
- void activatePreviousWindow ()
- void cascade ()
- void closeActiveWindow ()
- void closeAllWindows ()
- void tile ()

- 16 public slots inherited from QWidget
- 1 public slot inherited from QObject

### Signals

- void windowActivated ( QWidget * w )

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject

### Protected Functions

- 42 protected functions inherited from QWidget
- 7 protected functions inherited from QObject

## Detailed Description

The Q3Workspace widget provides a workspace window that be used in an MDI application.

Multiple Document Interface (MDI) applications are typically composed of a main window containing a menu bar, a toolbar, and a central Q3Workspace widget. The workspace itself is used to display a number of child windows, each of which is a widget.

The workspace itself is an ordinary Qt widget. It has a standard constructor that takes a parent widget and an object name. Workspaces can be placed in any layout, but are typically given as the central widget in a QMainWindow:

        MainWindow::MainWindow()
        {
            workspace = new Q3Workspace(this);
            setCentralWidget(workspace);
            ...
        }

Child windows (MDI windows) are standard Qt widgets that are inserted into the workspace with addWindow(). As with top-level widgets, you can call functions such as show(), hide(), showMaximized(), and setWindowTitle() on a child window to change its appearance within the workspace. You can also provide widget flags to determine the layout of the decoration or the behavior of the widget itself.

To change or retrieve the geometry of a child window, you must operate on its parentWidget(). The parentWidget() provides access to the decorated frame that contains the child window widget. When a child window is maximised, its decorated frame is hidden. If the top-level widget contains a menu bar, it will display the maximised window's operations menu to the left of the menu entries, and the window's controls to the right.

A child window becomes active when it gets the keyboard focus, or when setFocus() is called. The user can activate a window by moving focus in the usual ways, for example by clicking a window or by pressing Tab. The workspace emits a signal windowActivated() when the active window changes, and the function activeWindow() returns a pointer to the active child window, or 0 if no window is active.

The convenience function windowList() returns a list of all child windows. This information could be used in a popup menu containing a list of windows, for example. This feature is also available as part of the Window Menu Qt Solution.

Q3Workspace provides two built-in layout strategies for child windows: cascade() and tile(). Both are slots so you can easily connect menu entries to them.

[Missing image qworkspace-arrange.png]

If you want your users to be able to work with child windows larger than the visible workspace area, set the scrollBarsEnabled property to true.

## Member Type Documentation

### enum Q3Workspace::WindowOrder

Specifies the order in which child windows are returned from windowList().

`Q3Workspace::CreationOrder` | The windows are returned in the order of their creation
`Q3Workspace::StackingOrder` | The windows are returned in the order of their stacking

## Property Documentation

### scrollBarsEnabled : bool

This property holds whether the workspace provides scrollbars.

If this property is true, the workspace will provide scrollbars if any of the child windows extend beyond the edges of the visible workspace. The workspace area will automatically increase to contain child windows if they are resized beyond the right or bottom edges of the visible area.

If this property is false (the default), resizing child windows out of the visible area of the workspace is not permitted, although it is still possible to position them partially outside the visible area.

Access functions:

- bool scrollBarsEnabled () const
- void setScrollBarsEnabled ( bool enable )

## Member Function Documentation

### Q3Workspace::Q3Workspace ( QWidget * parent = 0 )

Constructs a workspace with the given parent.

### Q3Workspace::Q3Workspace ( QWidget * parent, const char * name )

Use one of the constructors that doesn't take the name argument and then use setObjectName() instead.

### Q3Workspace::~Q3Workspace ()

Destroys the workspace and frees any allocated resources.

### void Q3Workspace::activateNextWindow () `[slot]`

Gives the input focus to the next window in the list of child windows.

See also activatePreviousWindow().

### void Q3Workspace::activatePreviousWindow () `[slot]`

Gives the input focus to the previous window in the list of child windows.

See also activateNextWindow().

### QWidget * Q3Workspace::activeWindow () const

Returns a pointer to the widget corresponding to the active child window, or 0 if no window is active.

### QWidget * Q3Workspace::addWindow ( QWidget * w, Qt::WFlags flags = 0 )

Adds widget w as new sub window to the workspace. If flags are non-zero, they will override the flags set on the widget.

Returns the window frame.

### void Q3Workspace::cascade () `[slot]`

Arranges all the child windows in a cascade pattern.

See also tile().

### void Q3Workspace::closeActiveWindow () `[slot]`

Closes the child window that is currently active.

See also closeAllWindows().

### void Q3Workspace::closeAllWindows () `[slot]`

Closes all child windows.

If any child window fails to accept the close event, the remaining windows will remain open.

See also closeActiveWindow().

### void Q3Workspace::setPaletteBackgroundColor ( const QColor & c )

Sets the palette background color to c.

See also setPaletteBackgroundPixmap().

### void Q3Workspace::setPaletteBackgroundPixmap ( const QPixmap & pm )

Sets the palette background pixmap to pm.

See also setPaletteBackgroundColor().

### void Q3Workspace::tile () `[slot]`

Arranges all child windows in a tile pattern.

See also cascade().

### void Q3Workspace::windowActivated ( QWidget * w ) `[signal]`

This signal is emitted when the child window w becomes active. Note that w can be 0, and that more than one signal may be emitted for a single activation event.

See also activeWindow() and windowList().

### QWidgetList Q3Workspace::windowList ( WindowOrder order = CreationOrder ) const

Returns a list of all child windows. If order is CreationOrder (the default), the windows are listed in the order in which they were inserted into the workspace. If order is StackingOrder, the windows are listed in their stacking order, with the topmost window as the last item in the list.