com.trolltech.qt.gui
Class QWorkspace

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QObject
                  extended by com.trolltech.qt.gui.QWidget
                      extended by com.trolltech.qt.gui.QWorkspace
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QWorkspace
extends QWidget

The QWorkspace widget provides a workspace window that can be used in an MDI application. This class is deprecated. Use QMdiArea instead.

Multiple Document Interface (MDI) applications are typically composed of a main window containing a menu bar, a toolbar, and a central QWorkspace 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. Workspaces can be placed in any layout, but are typically given as the central widget in a QMainWindow:

    public MainWindow()
    {
        workspace = new QWorkspace();
        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 Solution.

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





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.

See also:
QDockWidget, and MDI Example.


Nested Class Summary
static class QWorkspace.WindowOrder
          Specifies the order in which child windows are returned from windowList().
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 QSignalEmitter.Signal1 windowActivated
          This signal takes 1 generic argument(s).
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QWorkspace()
          Constructs a workspace with the given parent.
QWorkspace(QWidget parent)
          Constructs a workspace with the given parent.
 
Method Summary
 void activateNextWindow()
          Gives the input focus to the next window in the list of child windows.
 void activatePreviousWindow()
          Gives the input focus to the previous window in the list of child windows.
 QWidget activeWindow()
          Returns a pointer to the widget corresponding to the active child window, or 0 if no window is active.
 QWidget addWindow(QWidget w)
          Adds widget w as new sub window to the workspace.
 QWidget addWindow(QWidget w, Qt.WindowFlags flags)
          Adds widget w as new sub window to the workspace.
 QWidget addWindow(QWidget w, Qt.WindowType[] flags)
          This is an overloaded method provided for convenience.
 void arrangeIcons()
          Arranges all iconified windows at the bottom of the workspace.
 QBrush background()
          This property holds the workspace's background.
 void cascade()
          Arranges all the child windows in a cascade pattern.
 void closeActiveWindow()
          Closes the child window that is currently active.
 void closeAllWindows()
          Closes all child windows.
 boolean scrollBarsEnabled()
          This property holds whether the workspace provides scroll bars.
 void setActiveWindow(QWidget w)
          Makes the child window that contains w the active child window.
 void setBackground(QBrush background)
          This property holds the workspace's background.
 void setScrollBarsEnabled(boolean enable)
          This property holds whether the workspace provides scroll bars.
 void tile()
          Arranges all child windows in a tile pattern.
 java.util.List windowList()
          Returns a list of all visible or minimized child windows.
 java.util.List windowList(QWorkspace.WindowOrder order)
          Returns a list of all visible or minimized child windows.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, graphicsProxyWidget, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

windowActivated

public final QSignalEmitter.Signal1 windowActivated

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QWidget(named: w)>:

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().

Constructor Detail

QWorkspace

public QWorkspace()
Constructs a workspace with the given parent.


QWorkspace

public QWorkspace(QWidget parent)
Constructs a workspace with the given parent.

Method Detail

activateNextWindow

public final void activateNextWindow()
Gives the input focus to the next window in the list of child windows.

See also:
activatePreviousWindow().


activatePreviousWindow

public final void activatePreviousWindow()
Gives the input focus to the previous window in the list of child windows.

See also:
activateNextWindow().


activeWindow

public final QWidget activeWindow()
Returns a pointer to the widget corresponding to the active child window, or 0 if no window is active.

See also:
setActiveWindow().


addWindow

public final QWidget addWindow(QWidget w,
                               Qt.WindowType[] flags)
This is an overloaded method provided for convenience.


addWindow

public final QWidget addWindow(QWidget w)
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 widget used for the window frame.

To remove the widget w from the workspace, simply call setParent() with the new parent (or 0 to make it a stand-alone window).


addWindow

public final QWidget addWindow(QWidget w,
                               Qt.WindowFlags flags)
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 widget used for the window frame.

To remove the widget w from the workspace, simply call setParent() with the new parent (or 0 to make it a stand-alone window).


arrangeIcons

public final void arrangeIcons()
Arranges all iconified windows at the bottom of the workspace.

See also:
cascade(), and tile().


background

public final QBrush background()
This property holds the workspace's background.


cascade

public final void cascade()
Arranges all the child windows in a cascade pattern.

See also:
tile(), and arrangeIcons().


closeActiveWindow

public final void closeActiveWindow()
Closes the child window that is currently active.

See also:
closeAllWindows().


closeAllWindows

public final void closeAllWindows()
Closes all child windows.

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

See also:
closeActiveWindow().


scrollBarsEnabled

public final boolean scrollBarsEnabled()
This property holds whether the workspace provides scroll bars. If this property is true, the workspace will provide scroll bars 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.


setActiveWindow

public final void setActiveWindow(QWidget w)
Makes the child window that contains w the active child window.

See also:
activeWindow().


setBackground

public final void setBackground(QBrush background)
This property holds the workspace's background.


setScrollBarsEnabled

public final void setScrollBarsEnabled(boolean enable)
This property holds whether the workspace provides scroll bars. If this property is true, the workspace will provide scroll bars 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.


tile

public final void tile()
Arranges all child windows in a tile pattern.

See also:
cascade(), and arrangeIcons().


windowList

public final java.util.List windowList()
Returns a list of all visible or minimized child windows.


windowList

public final java.util.List windowList(QWorkspace.WindowOrder order)
Returns a list of all visible or minimized 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.