|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QWorkspace
public class QWorkspace
The QWorkspace widget provides a workspace window that can 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 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:
MainWindow::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.
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.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Field Summary | |
---|---|
QSignalEmitter.Signal1<QWidget> |
windowActivated
This signal is emitted when the child window w becomes active. |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QWorkspace()
Equivalent to QWorkspace(0). |
|
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)
Equivalent to addWindow(w, 0). |
QWidget |
addWindow(QWidget w,
Qt.WindowFlags flags)
Adds widget w as new sub window to the workspace. |
QWidget |
addWindow(QWidget w,
Qt.WindowType... flags)
Adds widget w as new sub window to the workspace. |
void |
arrangeIcons()
Arranges all iconified windows at the bottom of the workspace. |
QBrush |
background()
Returns the workspace's background. |
void |
cascade()
Arranges all the child windows in a cascade pattern. |
protected void |
changeEvent(QEvent arg__1)
This function is reimplemented for internal reasons. |
protected void |
childEvent(QChildEvent arg__1)
This function is reimplemented for internal reasons. |
void |
closeActiveWindow()
Closes the child window that is currently active. |
void |
closeAllWindows()
Closes all child windows. |
boolean |
event(QEvent e)
This function is reimplemented for internal reasons. |
boolean |
eventFilter(QObject arg__1,
QEvent arg__2)
This function is reimplemented for internal reasons. |
static QWorkspace |
fromNativePointer(QNativePointer nativePointer)
This function returns the QWorkspace instance pointed to by nativePointer |
protected void |
hideEvent(QHideEvent e)
This function is reimplemented for internal reasons. |
protected void |
paintEvent(QPaintEvent e)
This function is reimplemented for internal reasons. |
protected void |
resizeEvent(QResizeEvent arg__1)
This function is reimplemented for internal reasons. |
boolean |
scrollBarsEnabled()
Returns 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)
Sets the workspace's background to background. |
void |
setScrollBarsEnabled(boolean enable)
Sets whether the workspace provides scroll bars to enable. |
protected void |
showEvent(QShowEvent e)
This function is reimplemented for internal reasons. |
QSize |
sizeHint()
This function is reimplemented for internal reasons. |
void |
tile()
Arranges all child windows in a tile pattern. |
protected void |
wheelEvent(QWheelEvent e)
This function is reimplemented for internal reasons. |
java.util.List<QWidget> |
windowList()
Returns a list of all visible or minimized child windows. |
java.util.List<QWidget> |
windowList(QWorkspace.WindowOrder order)
Returns a list of all visible or minimized child windows. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
disconnect, disconnect, signalSender |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1<QWidget> windowActivated
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.
Constructor Detail |
---|
public QWorkspace()
Equivalent to QWorkspace(0).
public QWorkspace(QWidget parent)
Constructs a workspace with the given parent.
Method Detail |
---|
public final void activateNextWindow()
Gives the input focus to the next window in the list of child windows.
public final void activatePreviousWindow()
Gives the input focus to the previous window in the list of child windows.
public final QWidget activeWindow()
Returns a pointer to the widget corresponding to the active child window, or 0 if no window is active.
public final QWidget addWindow(QWidget w, Qt.WindowType... 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).
public final QWidget addWindow(QWidget w)
Equivalent to addWindow(w, 0).
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).
public final void arrangeIcons()
Arranges all iconified windows at the bottom of the workspace.
public final QBrush background()
Returns the workspace's background.
public final void cascade()
Arranges all the child windows in a cascade pattern.
public final void closeActiveWindow()
Closes the child window that is currently active.
public final void closeAllWindows()
Closes all child windows.
If any child window fails to accept the close event, the remaining windows will remain open.
public final boolean scrollBarsEnabled()
Returns 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.
public final void setActiveWindow(QWidget w)
Makes the child window that contains w the active child window.
public final void setBackground(QBrush background)
Sets the workspace's background to background.
public final void setScrollBarsEnabled(boolean enable)
Sets whether the workspace provides scroll bars to enable.
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.
public final void tile()
Arranges all child windows in a tile pattern.
public final java.util.List<QWidget> windowList()
public final java.util.List<QWidget> 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.
protected void changeEvent(QEvent arg__1)
This function is reimplemented for internal reasons.
changeEvent
in class QWidget
protected void childEvent(QChildEvent arg__1)
This function is reimplemented for internal reasons.
childEvent
in class QObject
public boolean event(QEvent e)
This function is reimplemented for internal reasons.
event
in class QWidget
public boolean eventFilter(QObject arg__1, QEvent arg__2)
This function is reimplemented for internal reasons.
eventFilter
in class QObject
protected void hideEvent(QHideEvent e)
This function is reimplemented for internal reasons.
hideEvent
in class QWidget
visible
,
event,
QHideEventprotected void paintEvent(QPaintEvent e)
This function is reimplemented for internal reasons.
paintEvent
in class QWidget
protected void resizeEvent(QResizeEvent arg__1)
This function is reimplemented for internal reasons.
resizeEvent
in class QWidget
Example
protected void showEvent(QShowEvent e)
This function is reimplemented for internal reasons.
showEvent
in class QWidget
visible
,
event,
QShowEventpublic QSize sizeHint()
This function is reimplemented for internal reasons.
sizeHint
in class QWidget
protected void wheelEvent(QWheelEvent e)
This function is reimplemented for internal reasons.
wheelEvent
in class QWidget
public static QWorkspace fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |