|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.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.
The subwindows are sorted by the the current WindowOrder
. This is used for the subWindowList()
and for activateNextSubWindow()
and acivatePreviousSubWindow(). Also, it is used when cascading or tiling the windows with cascadeSubWindows()
and tileSubWindows()
.
QMdiArea provides two built-in layout strategies for subwindows: cascadeSubWindows()
and tileSubWindows()
. Both are slots and are easily connected to menu entries.
![]() | ![]() |
Qt::ScrollBarAlwaysOff
. QMdiSubWindow
.
Nested Class Summary | |
---|---|
static class |
QMdiArea.AreaOption
This enum describes options that customize the behavior of the QMdiArea . |
static class |
QMdiArea.AreaOptions
|
static class |
QMdiArea.ViewMode
This enum describes the view mode of the area; i.e. |
static class |
QMdiArea.WindowOrder
Specifies the criteria to use for ordering the list of child windows returned by 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.AbstractSignal, 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 |
subWindowActivated
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 | |
---|---|
QMdiArea()
Constructs an empty mdi area. |
|
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. |
QMdiArea.WindowOrder |
activationOrder()
This property holds the ordering criteria for subwindow lists. |
QMdiSubWindow |
activeSubWindow()
Returns a pointer to the current active subwindow. |
QMdiSubWindow |
addSubWindow(QWidget widget)
Adds widget as a new subwindow to the MDI area. |
QMdiSubWindow |
addSubWindow(QWidget widget,
Qt.WindowFlags flags)
Adds widget as a new subwindow to the MDI area. |
QMdiSubWindow |
addSubWindow(QWidget widget,
Qt.WindowType[] flags)
|
QBrush |
background()
This property holds the background brush for the workspace. |
void |
cascadeSubWindows()
Arranges all the child windows in a cascade pattern. |
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. |
void |
removeSubWindow(QWidget widget)
Removes widget from the MDI area. |
void |
setActivationOrder(QMdiArea.WindowOrder order)
This property holds the ordering criteria for subwindow lists. |
void |
setActiveSubWindow(QMdiSubWindow window)
Activates the subwindow window. |
void |
setBackground(QBrush background)
This property holds the background brush for the workspace. |
void |
setOption(QMdiArea.AreaOption option)
If on is true, option is enabled on the MDI area; otherwise it is disabled. |
void |
setOption(QMdiArea.AreaOption option,
boolean on)
If on is true, option is enabled on the MDI area; otherwise it is disabled. |
void |
setTabPosition(QTabWidget.TabPosition position)
This property holds the position of the tabs in tabbed view mode. |
void |
setTabShape(QTabWidget.TabShape shape)
This property holds the shape of the tabs in tabbed view mode. |
void |
setViewMode(QMdiArea.ViewMode mode)
This property holds the way sub-windows are displayed in the QMdiArea. |
java.util.List |
subWindowList()
Returns a list of all subwindows in the MDI area. |
java.util.List |
subWindowList(QMdiArea.WindowOrder order)
Returns a list of all subwindows in the MDI area. |
QTabWidget.TabPosition |
tabPosition()
This property holds the position of the tabs in tabbed view mode. |
QTabWidget.TabShape |
tabShape()
This property holds the shape of the tabs in tabbed view mode. |
boolean |
testOption(QMdiArea.AreaOption opton)
Returns true if option is enabled; otherwise returns false. |
void |
tileSubWindows()
Arranges all child windows in a tile pattern. |
QMdiArea.ViewMode |
viewMode()
This property holds the way sub-windows are displayed in the QMdiArea. |
Methods inherited from class com.trolltech.qt.gui.QFrame |
---|
frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth |
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 |
---|
public final QSignalEmitter.Signal1 subWindowActivated
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.QMdiSubWindow(named: window)>:
QMdiArea emits this signal after window has been activated. When window is 0, QMdiArea has just deactivated its last active window, and there are no active windows on the workspace.
QMdiArea::activeSubWindow()
.
Constructor Detail |
---|
public QMdiArea()
QWidget
's constructor.
public QMdiArea(QWidget parent)
QWidget
's constructor.
Method Detail |
---|
public final void activateNextSubWindow()
CreationOrder
). activatePreviousSubWindow()
.
public final void activatePreviousSubWindow()
CreationOrder
). activateNextSubWindow()
.
public final QMdiArea.WindowOrder activationOrder()
subWindowList()
. By default, it is the window creation order. subWindowList()
.
public final QMdiSubWindow activeSubWindow()
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.
setActiveSubWindow()
, and Qt::WindowState
.
public final QMdiSubWindow addSubWindow(QWidget widget, Qt.WindowType[] flags)
public final QMdiSubWindow addSubWindow(QWidget 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).
Note: Once the subwindow has been added, its parent will be the viewport widget of the QMdiArea.
QMdiArea mdiArea = new QMdiArea(); QMdiSubWindow subWindow1 = new QMdiSubWindow(); subWindow1.setWidget(internalWidget1); subWindow1.setAttribute(Qt.WidgetAttribute.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.
removeSubWindow()
.
public final QMdiSubWindow addSubWindow(QWidget widget, Qt.WindowFlags flags)
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).
Note: Once the subwindow has been added, its parent will be the viewport widget of the QMdiArea.
QMdiArea mdiArea = new QMdiArea(); QMdiSubWindow subWindow1 = new QMdiSubWindow(); subWindow1.setWidget(internalWidget1); subWindow1.setAttribute(Qt.WidgetAttribute.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.
removeSubWindow()
.
public final QBrush background()
public final void cascadeSubWindows()
tileSubWindows()
.
public final void closeActiveSubWindow()
closeAllSubWindows()
.
public final void closeAllSubWindows()
QCloseEvent
to each window. You may receive 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.
closeActiveSubWindow()
.
public final QMdiSubWindow currentSubWindow()
This function will return the same as activeSubWindow()
if the QApplication
containing QMdiArea is active.
activeSubWindow()
, and QApplication::activeWindow()
.
public final void removeSubWindow(QWidget widget)
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. addSubWindow()
.
public final void setActivationOrder(QMdiArea.WindowOrder order)
subWindowList()
. By default, it is the window creation order. subWindowList()
.
public final void setActiveSubWindow(QMdiSubWindow window)
activeSubWindow()
.
public final void setBackground(QBrush background)
public final void setOption(QMdiArea.AreaOption option)
AreaOption
for the effect of each option. AreaOption
, and testOption()
.
public final void setOption(QMdiArea.AreaOption option, boolean on)
AreaOption
for the effect of each option. AreaOption
, and testOption()
.
public final void setTabPosition(QTabWidget.TabPosition position)
QTabWidget::TabPosition
enum. QTabWidget::TabPosition
, and setViewMode()
.
public final void setTabShape(QTabWidget.TabShape shape)
QTabWidget::Rounded
(default) or QTabWidget::Triangular
. QTabWidget::tabShape()
, and setViewMode()
.
public final void setViewMode(QMdiArea.ViewMode mode)
SubWindowView
is used to display sub-windows. ViewMode
, setTabShape()
, and setTabPosition()
.
public final java.util.List subWindowList()
public final java.util.List subWindowList(QMdiArea.WindowOrder order)
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. If order is ActivationHistoryOrder
, the windows are listed according to their recent activation history. WindowOrder
.
public final QTabWidget.TabPosition tabPosition()
QTabWidget::TabPosition
enum. QTabWidget::TabPosition
, and setViewMode()
.
public final QTabWidget.TabShape tabShape()
QTabWidget::Rounded
(default) or QTabWidget::Triangular
. QTabWidget::tabShape()
, and setViewMode()
.
public final boolean testOption(QMdiArea.AreaOption opton)
AreaOption
, and setOption()
.
public final void tileSubWindows()
cascadeSubWindows()
.
public final QMdiArea.ViewMode viewMode()
SubWindowView
is used to display sub-windows. ViewMode
, setTabShape()
, and setTabPosition()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |