|
|||||||||
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.QFrame
com.trolltech.qt.gui.QAbstractScrollArea
com.trolltech.qt.gui.QMdiArea
public class QMdiArea
The QMdiArea widget provides an area in which MDI windows are displayed.
QMdiArea functions, essentially, like a window manager for MDI windows. For instance, it draws the windows it manages on itself and arranges them in a cascading or tile pattern. QMdiArea is commonly used as the center widget in a QMainWindow to create MDI applications, but can also be placed in any layout. The following code adds an area to a main window:
QMainWindow *mainWindow = new QMainWindow; mainWindow->setCentralWidget(mdiArea);
Unlike the window managers for top-level windows, all window flags (Qt::WindowFlags) are supported by QMdiArea as long as the flags are supported by the current widget style. If a specific flag is not supported by the style (e.g., the WindowShadeButtonHint), you can still shade the window with showShaded().
Subwindows in QMdiArea are instances of QMdiSubWindow. They are added to an MDI area with addSubWindow. It is common to pass a QWidget, which is set as the internal widget, to this function, but it is also possible to pass a QMdiSubWindow directly.The class inherits QWidget, and you can use the same API as with a normal top-level window when programming. QMdiSubWindow also has behavior that is specific to MDI windows. See the QMdiSubWindow class description for more details.
A subwindow becomes active when it gets the keyboard focus, or when setFocus is called. The user activates a window by moving focus in the usual ways. The MDI area emits the subWindowActivated signal when the active window changes, and the activeSubWindow function returns the active subwindow.
The convenience function subWindowList returns a list of all subwindows. This information could be used in a popup menu containing a list of windows, for example.
QMdiArea provides two built-in layout strategies for subwindows: cascadeSubWindows and tileSubWindows. Both are slots and are easily connected to menu entries.
If you want your users to be able to work with child windows larger than the visible MDI area, set the scrollBarsEnabled property to true.
Nested Class Summary | |
---|---|
static class |
QMdiArea.AreaOption
This enum describes options that customize the behavior of the QMdiArea. |
static class |
QMdiArea.AreaOptions
This QFlag class provides flags for the int enum. |
static class |
QMdiArea.WindowOrder
Specifies the order in which child windows are returned from subWindowList. |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QFrame |
---|
QFrame.Shadow, QFrame.Shape, QFrame.StyleMask |
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<QMdiSubWindow> |
subWindowActivated
QMdiArea emits this signal after arg__1 has been activated. |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QMdiArea()
Equivalent to QMdiArea(0). |
|
QMdiArea(QWidget parent)
Constructs an empty mdi area. |
Method Summary | |
---|---|
void |
activateNextSubWindow()
Gives the keyboard focus to the next window in the list of child windows. |
void |
activatePreviousSubWindow()
Gives the keyboard focus to the previous window in the list of child windows. |
QMdiSubWindow |
activeSubWindow()
Returns a pointer to the current active subwindow. |
QMdiSubWindow |
addSubWindow(QWidget widget)
Equivalent to addSubWindow(widget, 0). |
QMdiSubWindow |
addSubWindow(QWidget widget,
Qt.WindowFlags flags)
Adds widget as a new subwindow to the MDI area. |
QMdiSubWindow |
addSubWindow(QWidget widget,
Qt.WindowType... flags)
Adds widget as a new subwindow to the MDI area. |
QBrush |
background()
Returns the background brush for the workspace. |
void |
cascadeSubWindows()
Arranges all the child windows in a cascade pattern. |
protected void |
childEvent(QChildEvent childEvent)
This function is reimplemented for internal reasons. |
void |
closeActiveSubWindow()
Closes the active subwindow. |
void |
closeAllSubWindows()
Closes all subwindows by sending a QCloseEvent to each window. |
QMdiSubWindow |
currentSubWindow()
Returns a pointer to the current subwindow, or 0 if there is no current subwindow. |
boolean |
event(QEvent event)
This function is reimplemented for internal reasons. |
boolean |
eventFilter(QObject object,
QEvent event)
This function is reimplemented for internal reasons. |
static QMdiArea |
fromNativePointer(QNativePointer nativePointer)
This function returns the QMdiArea instance pointed to by nativePointer |
QSize |
minimumSizeHint()
This function is reimplemented for internal reasons. |
protected void |
paintEvent(QPaintEvent paintEvent)
This function is reimplemented for internal reasons. |
void |
removeSubWindow(QWidget widget)
Removes widget from the MDI area. |
protected void |
resizeEvent(QResizeEvent resizeEvent)
This function is reimplemented for internal reasons. |
protected void |
scrollContentsBy(int dx,
int dy)
This function is reimplemented for internal reasons. |
void |
setActiveSubWindow(QMdiSubWindow window)
Activates the subwindow window. |
void |
setBackground(QBrush background)
Sets the background brush for the workspace to background. |
void |
setOption(QMdiArea.AreaOption option)
Equivalent to setOption(option, true). |
void |
setOption(QMdiArea.AreaOption option,
boolean on)
If on is true, option is enabled on the MDI area; otherwise it is disabled. |
protected void |
setupViewport(QWidget viewport)
This slot is called by QAbstractScrollArea after setViewport has been called. |
protected void |
showEvent(QShowEvent showEvent)
This function is reimplemented for internal reasons. |
QSize |
sizeHint()
This function is reimplemented for internal reasons. |
java.util.List<QMdiSubWindow> |
subWindowList()
Returns a list of all subwindows in the MDI area. |
java.util.List<QMdiSubWindow> |
subWindowList(QMdiArea.WindowOrder order)
Returns a list of all subwindows in the MDI area. |
boolean |
testOption(QMdiArea.AreaOption opton)
Returns true if opton is enabled; otherwise returns false. |
void |
tileSubWindows()
Arranges all child windows in a tile pattern. |
protected void |
timerEvent(QTimerEvent timerEvent)
This function is reimplemented for internal reasons. |
protected boolean |
viewportEvent(QEvent event)
This function is reimplemented for internal reasons. |
Methods inherited from class com.trolltech.qt.gui.QFrame |
---|
changeEvent, drawFrame, frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth |
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 |
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<QMdiSubWindow> subWindowActivated
QMdiArea emits this signal after arg__1 has been activated. When arg__1 is 0, QMdiArea has just deactivated its last active window, and there are no active windows on the workspace.
Constructor Detail |
---|
public QMdiArea()
Equivalent to QMdiArea(0).
public QMdiArea(QWidget parent)
Constructs an empty mdi area. parent is passed to QWidget's constructor.
Method Detail |
---|
public final void activateNextSubWindow()
Gives the keyboard focus to the next window in the list of child windows. The windows are activated in the order in which they are created (CreationOrder).
public final void activatePreviousSubWindow()
Gives the keyboard focus to the previous window in the list of child windows. The windows are activated in the order in which they are created (CreationOrder).
public final QMdiSubWindow activeSubWindow()
Returns a pointer to the current active subwindow. If no window is currently active, 0 is returned.
Subwindows are treated as top-level windows with respect to window state, i.e., if a widget outside the MDI area is the active window, no subwindow will be active. Note that if a widget in the window in which the MDI area lives gains focus, the window will be activated.
public final QMdiSubWindow addSubWindow(QWidget widget, Qt.WindowType... flags)
Adds widget as a new subwindow to the MDI area. If flags are non-zero, they will override the flags set on the widget.
The widget can be either a QMdiSubWindow or another QWidget (in which case the MDI area will create a subwindow and set the widget as the internal widget).
QMdiArea mdiArea; QMdiSubWindow *subWindow1 = new QMdiSubWindow; subWindow1->setWidget(internalWidget1); subWindow1->setAttribute(Qt::WA_DeleteOnClose); mdiArea.addSubWindow(subWindow1); QMdiSubWindow *subWindow2 = mdiArea.addSubWindow(internalWidget2);
When you create your own subwindow, you must set the Qt::WA_DeleteOnClose widget attribute if you want the window to be deleted when closed in the MDI area. If not, the window will be hidden and the MDI area will not activate the next subwindow.
Returns the QMdiSubWindow that is added to the MDI area.
public final QMdiSubWindow addSubWindow(QWidget widget)
Equivalent to addSubWindow(widget, 0).
public final QMdiSubWindow addSubWindow(QWidget widget, Qt.WindowFlags flags)
Adds widget as a new subwindow to the MDI area. If flags are non-zero, they will override the flags set on the widget.
The widget can be either a QMdiSubWindow or another QWidget (in which case the MDI area will create a subwindow and set the widget as the internal widget).
QMdiArea mdiArea; QMdiSubWindow *subWindow1 = new QMdiSubWindow; subWindow1->setWidget(internalWidget1); subWindow1->setAttribute(Qt::WA_DeleteOnClose); mdiArea.addSubWindow(subWindow1); QMdiSubWindow *subWindow2 = mdiArea.addSubWindow(internalWidget2);
When you create your own subwindow, you must set the Qt::WA_DeleteOnClose widget attribute if you want the window to be deleted when closed in the MDI area. If not, the window will be hidden and the MDI area will not activate the next subwindow.
Returns the QMdiSubWindow that is added to the MDI area.
public final QBrush background()
Returns the background brush for the workspace.
This property sets the background brush for the workspace area itself. By default, it is a gray color, but can be any brush (e.g., colors, gradients or pixmaps).
public final void cascadeSubWindows()
Arranges all the child windows in a cascade pattern.
public final void closeActiveSubWindow()
Closes the active subwindow.
public final void closeAllSubWindows()
Closes all subwindows by sending a QCloseEvent to each window. You may recieve subWindowActivated signals from subwindows before they are closed (if the MDI area activates the subwindow when another is closing).
Subwindows that ignore the close event will remain open.
public final QMdiSubWindow currentSubWindow()
Returns a pointer to the current subwindow, or 0 if there is no current subwindow.
This function will return the same as activeSubWindow if the QApplication containing QMdiArea is active.
public final void removeSubWindow(QWidget widget)
Removes widget from the MDI area. The widget must be either a QMdiSubWindow or a widget that is the internal widget of a subwindow. Note that the subwindow is not deleted by QMdiArea and that its parent is set to 0.
public final void setActiveSubWindow(QMdiSubWindow window)
Activates the subwindow window. If window is 0, any current active window is deactivated.
public final void setBackground(QBrush background)
Sets the background brush for the workspace to background.
This property sets the background brush for the workspace area itself. By default, it is a gray color, but can be any brush (e.g., colors, gradients or pixmaps).
public final void setOption(QMdiArea.AreaOption option)
Equivalent to setOption(option, true).
public final void setOption(QMdiArea.AreaOption option, boolean on)
If on is true, option is enabled on the MDI area; otherwise it is disabled. See AreaOption for the effect of each option.
protected final void setupViewport(QWidget viewport)
This slot is called by QAbstractScrollArea after setViewport has been called. Reimplement this function in a subclass of QMdiArea to initialize the new viewport before it is used.
setupViewport
in class QAbstractScrollArea
public final java.util.List<QMdiSubWindow> subWindowList()
public final java.util.List<QMdiSubWindow> subWindowList(QMdiArea.WindowOrder order)
Returns a list of all subwindows in the MDI area. If order is CreationOrder (the default), the windows are sorted 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.
public final boolean testOption(QMdiArea.AreaOption opton)
Returns true if opton is enabled; otherwise returns false.
public final void tileSubWindows()
Arranges all child windows in a tile pattern.
protected void childEvent(QChildEvent childEvent)
This function is reimplemented for internal reasons.
childEvent
in class QObject
public boolean event(QEvent event)
This function is reimplemented for internal reasons.
event
in class QAbstractScrollArea
public boolean eventFilter(QObject object, QEvent event)
This function is reimplemented for internal reasons.
eventFilter
in class QObject
public QSize minimumSizeHint()
This function is reimplemented for internal reasons.
minimumSizeHint
in class QAbstractScrollArea
protected void paintEvent(QPaintEvent paintEvent)
This function is reimplemented for internal reasons.
paintEvent
in class QAbstractScrollArea
protected void resizeEvent(QResizeEvent resizeEvent)
This function is reimplemented for internal reasons.
resizeEvent
in class QAbstractScrollArea
protected void scrollContentsBy(int dx, int dy)
This function is reimplemented for internal reasons.
scrollContentsBy
in class QAbstractScrollArea
protected void showEvent(QShowEvent showEvent)
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 QAbstractScrollArea
protected void timerEvent(QTimerEvent timerEvent)
This function is reimplemented for internal reasons.
timerEvent
in class QObject
protected boolean viewportEvent(QEvent event)
This function is reimplemented for internal reasons.
viewportEvent
in class QAbstractScrollArea
public static QMdiArea 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 |