com.trolltech.qt.gui
Class QDockWidget

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.QDockWidget
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QDockWidget
extends QWidget

The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-level window on the desktop. QDockWidget provides the concept of dock widgets, also know as tool palettes or utility windows. Dock windows are secondary windows placed in the dock widget area around the central widget in a QMainWindow.


Dock windows can be moved inside their current area, moved into new areas and floated (e.g., undocked) by the end-user. The QDockWidget API allows the programmer to restrict the dock widgets ability to move, float and close, as well as the areas in which they can be placed.

Appearance

A QDockWidget consists of a title bar and the content area. The title bar displays the dock widgets
window title, a float button and a close button. Depending on the state of the QDockWidget, the float and close buttons may be either disabled or not shown at all.

The visual appearance of the title bar and buttons is dependent on the style in use.

A QDockWidget acts as a wrapper for its child widget, set with setWidget(). Custom size hints, minimum and maximum sizes and size policies should be implemented in the child widget. QDockWidget will respect them, adjusting its own constraints to include the frame and title. Size constraints should not be set on the QDockWidget itself, because they change depending on whether it is docked; a docked QDockWidget has no frame and a smaller title bar.

See also:
QMainWindow, and Dock Widgets Example.


Nested Class Summary
static class QDockWidget.DockWidgetFeature
           
static class QDockWidget.DockWidgetFeatures
           
 
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 allowedAreasChanged
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 dockLocationChanged
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 featuresChanged
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 topLevelChanged
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 visibilityChanged
          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
QDockWidget()
          Constructs a QDockWidget with parent parent and window flags flags.
QDockWidget(QWidget parent)
          Constructs a QDockWidget with parent parent and window flags flags.
QDockWidget(QWidget parent, Qt.WindowFlags flags)
          Constructs a QDockWidget with parent parent and window flags flags.
QDockWidget(QWidget parent, Qt.WindowType[] flags)
          This is an overloaded method provided for convenience.
QDockWidget(java.lang.String title)
          Constructs a QDockWidget with parent parent and window flags flags.
QDockWidget(java.lang.String title, QWidget parent)
          Constructs a QDockWidget with parent parent and window flags flags.
QDockWidget(java.lang.String title, QWidget parent, Qt.WindowFlags flags)
          Constructs a QDockWidget with parent parent and window flags flags.
QDockWidget(java.lang.String title, QWidget parent, Qt.WindowType[] flags)
          This is an overloaded method provided for convenience.
 
Method Summary
 Qt.DockWidgetAreas allowedAreas()
          This property holds areas where the dock widget may be placed.
 QDockWidget.DockWidgetFeatures features()
          This property holds whether the dock widget is movable, closable, and floatable.
protected  void initStyleOption(QStyleOptionDockWidget option)
          Initialize option with the values from this QDockWidget.
 boolean isAreaAllowed(Qt.DockWidgetArea area)
          Returns true if this dock widget can be placed in the given area; otherwise returns false.
 boolean isFloating()
          This property holds whether the dock widget is floating.
 void setAllowedAreas(Qt.DockWidgetArea[] areas)
          This is an overloaded method provided for convenience.
 void setAllowedAreas(Qt.DockWidgetAreas areas)
          This property holds areas where the dock widget may be placed.
 void setFeatures(QDockWidget.DockWidgetFeature[] features)
          This is an overloaded method provided for convenience.
 void setFeatures(QDockWidget.DockWidgetFeatures features)
          This property holds whether the dock widget is movable, closable, and floatable.
 void setFloating(boolean floating)
          This property holds whether the dock widget is floating.
 void setTitleBarWidget(QWidget widget)
          Sets an arbitrary widget as the dock widget's title bar.
 void setWidget(QWidget widget)
          Sets the widget for the dock widget to widget.
 QWidget titleBarWidget()
          Returns the custom title bar widget set on the QDockWidget, or 0 if no custom title bar has been set.
 QAction toggleViewAction()
          Returns a checkable action that can be used to show or close this dock widget.
 QWidget widget()
          Returns the widget for the dock widget.
 
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

allowedAreasChanged

public final QSignalEmitter.Signal1 allowedAreasChanged

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.core.Qt$DockWidgetAreas(named: allowedAreas)>:

This signal is emitted when the allowedAreas property changes. The allowedAreas parameter gives the new value of the property.


dockLocationChanged

public final QSignalEmitter.Signal1 dockLocationChanged

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.core.Qt$DockWidgetArea(named: area)>:

This signal is emitted when the dock widget is moved to another dock area, or is moved to a different location in its current dock area. This happens when the dock widget is moved programmatically or is dragged to a new location by the user.


featuresChanged

public final QSignalEmitter.Signal1 featuresChanged

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.QDockWidget$DockWidgetFeatures(named: features)>:

This signal is emitted when the features property changes. The features parameter gives the new value of the property.


topLevelChanged

public final QSignalEmitter.Signal1 topLevelChanged

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Boolean(named: topLevel)>:

This signal is emitted when the floating property changes. The topLevel parameter is true if the dock widget is now floating; otherwise it is false.

See also:
isWindow().


visibilityChanged

public final QSignalEmitter.Signal1 visibilityChanged

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Boolean(named: visible)>:

This signal is emitted when the dock widget becomes visible (or invisible). This happens when the widget is hidden or shown, as well as when it is docked in a tabbed dock area and its tab becomes selected or unselected.

Constructor Detail

QDockWidget

public QDockWidget(QWidget parent,
                   Qt.WindowType[] flags)
This is an overloaded method provided for convenience.


QDockWidget

public QDockWidget(QWidget parent)
Constructs a QDockWidget with parent parent and window flags flags. The dock widget will be placed in the left dock widget area.


QDockWidget

public QDockWidget()
Constructs a QDockWidget with parent parent and window flags flags. The dock widget will be placed in the left dock widget area.


QDockWidget

public QDockWidget(QWidget parent,
                   Qt.WindowFlags flags)
Constructs a QDockWidget with parent parent and window flags flags. The dock widget will be placed in the left dock widget area.


QDockWidget

public QDockWidget(java.lang.String title,
                   QWidget parent,
                   Qt.WindowType[] flags)
This is an overloaded method provided for convenience.


QDockWidget

public QDockWidget(java.lang.String title,
                   QWidget parent)
Constructs a QDockWidget with parent parent and window flags flags. The dock widget will be placed in the left dock widget area.

The window title is set to title. This title is used when the QDockWidget is docked and undocked. It is also used in the context menu provided by QMainWindow.

See also:
setWindowTitle().


QDockWidget

public QDockWidget(java.lang.String title)
Constructs a QDockWidget with parent parent and window flags flags. The dock widget will be placed in the left dock widget area.

The window title is set to title. This title is used when the QDockWidget is docked and undocked. It is also used in the context menu provided by QMainWindow.

See also:
setWindowTitle().


QDockWidget

public QDockWidget(java.lang.String title,
                   QWidget parent,
                   Qt.WindowFlags flags)
Constructs a QDockWidget with parent parent and window flags flags. The dock widget will be placed in the left dock widget area.

The window title is set to title. This title is used when the QDockWidget is docked and undocked. It is also used in the context menu provided by QMainWindow.

See also:
setWindowTitle().

Method Detail

allowedAreas

public final Qt.DockWidgetAreas allowedAreas()
This property holds areas where the dock widget may be placed. The default is Qt::AllDockWidgetAreas .

See also:
Qt::DockWidgetArea .


features

public final QDockWidget.DockWidgetFeatures features()
This property holds whether the dock widget is movable, closable, and floatable. By default, this property is set to a combination of DockWidgetClosable , DockWidgetMovable and DockWidgetFloatable .

See also:
DockWidgetFeature .


isAreaAllowed

public final boolean isAreaAllowed(Qt.DockWidgetArea area)
Returns true if this dock widget can be placed in the given area; otherwise returns false.


isFloating

public final boolean isFloating()
This property holds whether the dock widget is floating. A floating dock widget is presented to the user as an independent window "on top" of its parent QMainWindow, instead of being docked in the QMainWindow.

By default, this property is true.

See also:
isWindow().


setAllowedAreas

public final void setAllowedAreas(Qt.DockWidgetArea[] areas)
This is an overloaded method provided for convenience.


setAllowedAreas

public final void setAllowedAreas(Qt.DockWidgetAreas areas)
This property holds areas where the dock widget may be placed. The default is Qt::AllDockWidgetAreas .

See also:
Qt::DockWidgetArea .


setFeatures

public final void setFeatures(QDockWidget.DockWidgetFeature[] features)
This is an overloaded method provided for convenience.


setFeatures

public final void setFeatures(QDockWidget.DockWidgetFeatures features)
This property holds whether the dock widget is movable, closable, and floatable. By default, this property is set to a combination of DockWidgetClosable , DockWidgetMovable and DockWidgetFloatable .

See also:
DockWidgetFeature .


setFloating

public final void setFloating(boolean floating)
This property holds whether the dock widget is floating. A floating dock widget is presented to the user as an independent window "on top" of its parent QMainWindow, instead of being docked in the QMainWindow.

By default, this property is true.

See also:
isWindow().


setTitleBarWidget

public final void setTitleBarWidget(QWidget widget)
Sets an arbitrary widget as the dock widget's title bar. If widget is 0, the title bar widget is removed, but not deleted.

If a title bar widget is set, QDockWidget will not use native window decorations when it is floated.

Here are some tips for implementing custom title bars:

Using qobject_cast as shown above, the title bar widget has full access to its parent QDockWidget. Hence it can perform such operations as docking and hiding in response to user actions.

See also:
titleBarWidget(), and DockWidgetVerticalTitleBar .


setWidget

public final void setWidget(QWidget widget)
Sets the widget for the dock widget to widget.

If the dock widget is visible when widget is added, you must show() it explicitly.

Note that you must add the layout of the widget before you call this function; if not, the widget will not be visible.

See also:
widget().


titleBarWidget

public final QWidget titleBarWidget()
Returns the custom title bar widget set on the QDockWidget, or 0 if no custom title bar has been set.

See also:
setTitleBarWidget().


toggleViewAction

public final QAction toggleViewAction()
Returns a checkable action that can be used to show or close this dock widget.

The action's text is set to the dock widget's window title.

See also:
QAction::text, and QWidget::windowTitle.


widget

public final QWidget widget()
Returns the widget for the dock widget. This function returns zero if the widget has not been set.

See also:
setWidget().


initStyleOption

protected final void initStyleOption(QStyleOptionDockWidget option)
Initialize option with the values from this QDockWidget. This method is useful for subclasses when they need a QStyleOption, but don't want to fill in all the information themselves.