Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QDockWidget

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.gui.QWidget
                      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 wether it is docked; a docked `QDockWidget` has no frame and a smaller title bar.

See Also:
  `QMainWindow`, `Widgets Example`

Nested Class Summary
`static class` | `QDockWidget.DockWidgetFeature` Press link for info on QDockWidget.DockWidgetFeature
`static class` | `QDockWidget.DockWidgetFeatures` This QFlag class provides flags for the int enum.

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<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<Qt.DockWidgetAreas>` | `allowedAreasChanged` This signal is emitted when the `allowedAreas` property changes.
`QSignalEmitter.Signal1<Qt.DockWidgetArea>` | `dockLocationChanged` 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.
`QSignalEmitter.Signal1<QDockWidget.DockWidgetFeatures>` | `featuresChanged` This signal is emitted when the features property changes.
`QSignalEmitter.Signal1<java.lang.Boolean>` | `topLevelChanged` This signal is emitted when the floating property changes.
`QSignalEmitter.Signal1<java.lang.Boolean>` | `visibilityChanged` This signal is emitted when the dock widget becomes `visible` (or invisible).

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Constructor Summary
`QDockWidget()` Equivalent to `QDockWidget`(0, 0).
`QDockWidget(QWidget parent)` Equivalent to `QDockWidget`(`parent`, 0).
`QDockWidget(QWidget parent, Qt.WindowFlags flags)` Constructs a `QDockWidget` with parent `parent` and window flags `flags`.
`QDockWidget(java.lang.String title)` Equivalent to `QDockWidget`(`title`, 0, 0).
`QDockWidget(java.lang.String title, QWidget parent)` Equivalent to `QDockWidget`(`title`, `parent`, 0).
`QDockWidget(java.lang.String title, QWidget parent, Qt.WindowFlags flags)` Constructs a `QDockWidget` with parent `parent` and window flags `flags`.

Method Summary
`Qt.DockWidgetAreas` | `allowedAreas()` Returns areas where the dock widget may be placed.
`protected void` | `changeEvent(QEvent event)` This function is reimplemented for internal reasons.
`protected void` | `closeEvent(QCloseEvent event)` This function is reimplemented for internal reasons.
`boolean` | `event(QEvent event)` This function is reimplemented for internal reasons.
`QDockWidget.DockWidgetFeatures` | `features()` Returns whether the dock widget is movable, closable, and floatable.
`static QDockWidget` | `fromNativePointer(QNativePointer nativePointer)` This function returns the QDockWidget instance pointed to by nativePointer
`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()` Returns whether the dock widget is floating.
`protected void` | `paintEvent(QPaintEvent event)` This function is reimplemented for internal reasons.
`void` | `setAllowedAreas(Qt.DockWidgetArea... areas)` Sets areas where the dock widget may be placed to `areas`.
`void` | `setAllowedAreas(Qt.DockWidgetAreas areas)` Sets areas where the dock widget may be placed to `areas`.
`void` | `setFeatures(QDockWidget.DockWidgetFeature... features)` Sets whether the dock widget is movable, closable, and floatable to `features`.
`void` | `setFeatures(QDockWidget.DockWidgetFeatures features)` Sets whether the dock widget is movable, closable, and floatable to `features`.
`void` | `setFloating(boolean floating)` Sets whether the dock widget is floating to `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, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, contentsRect, contextMenuEvent, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, 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, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, 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, 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, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, 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

### allowedAreasChanged

    public final QSignalEmitter.Signal1<Qt.DockWidgetAreas> allowedAreasChanged

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

  Compatible Slot Signatures:
    `void mySlot(com.trolltech.qt.core.Qt.DockWidgetAreas allowedAreas)`
    `void mySlot()`

### dockLocationChanged

    public final QSignalEmitter.Signal1<Qt.DockWidgetArea> dockLocationChanged

  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.

  Compatible Slot Signatures:
    `void mySlot(com.trolltech.qt.core.Qt.DockWidgetArea area)`
    `void mySlot()`

### featuresChanged

    public final QSignalEmitter.Signal1<QDockWidget.DockWidgetFeatures> featuresChanged

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

  Compatible Slot Signatures:
    `void mySlot(com.trolltech.qt.gui.QDockWidget.DockWidgetFeatures features)`
    `void mySlot()`

### topLevelChanged

    public final QSignalEmitter.Signal1<java.lang.Boolean> topLevelChanged

  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.

  Compatible Slot Signatures:
    `void mySlot(boolean topLevel)`
    `void mySlot()`
  See Also:
    `isWindow`

### visibilityChanged

    public final QSignalEmitter.Signal1<java.lang.Boolean> visibilityChanged

  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.

  Compatible Slot Signatures:
    `void mySlot(boolean visible)`
    `void mySlot()`

Constructor Detail

### QDockWidget

    public QDockWidget(java.lang.String title,
                       QWidget parent)

  Equivalent to `QDockWidget`(`title`, `parent`, 0).

### QDockWidget

    public QDockWidget(java.lang.String title)

  Equivalent to `QDockWidget`(`title`, 0, 0).

### 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`

### QDockWidget

    public QDockWidget(QWidget parent)

  Equivalent to `QDockWidget`(`parent`, 0).

### QDockWidget

    public QDockWidget()

  Equivalent to `QDockWidget`(0, 0).

### 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.

Method Detail

### allowedAreas

    public final Qt.DockWidgetAreas allowedAreas()

  Returns areas where the dock widget may be placed.

  The default is Qt::AllDockWidgetAreas.

  See Also:
    `setAllowedAreas`, `Qt::DockWidgetArea`

### features

    public final QDockWidget.DockWidgetFeatures features()

  Returns whether the dock widget is movable, closable, and floatable.

  See Also:
    `setFeatures`, `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()

  Returns 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`.

  See Also:
    `isWindow`

### setAllowedAreas

    public final void setAllowedAreas(Qt.DockWidgetArea... areas)

  Sets areas where the dock widget may be placed to `areas`.

  The default is Qt::AllDockWidgetAreas.

  See Also:
    `allowedAreas`, `Qt::DockWidgetArea`

### setAllowedAreas

    public final void setAllowedAreas(Qt.DockWidgetAreas areas)

  Sets areas where the dock widget may be placed to `areas`.

  The default is Qt::AllDockWidgetAreas.

  See Also:
    `allowedAreas`, `Qt::DockWidgetArea`

### setFeatures

    public final void setFeatures(QDockWidget.DockWidgetFeature... features)

  Sets whether the dock widget is movable, closable, and floatable to `features`.

  See Also:
    `features`, `DockWidgetFeature`

### setFeatures

    public final void setFeatures(QDockWidget.DockWidgetFeatures features)

  Sets whether the dock widget is movable, closable, and floatable to `features`.

  See Also:
    `features`, `DockWidgetFeature`

### setFloating

    public final void setFloating(boolean floating)

  Sets whether the dock widget is floating to `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`.

  See Also:
    `isFloating`, `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:

  - Mouse events that are not explicitly handled by the title bar widget must be ignored by calling QMouseEvent::ignore(). These events then propagate to the `QDockWidget` parent, which handles them in the usual manner, moving when the title bar is dragged, docking and undocking when it is double-clicked, etc.
  - When `DockWidgetVerticalTitleBar` is set on `QDockWidget`, the title bar widget is repositioned accordingly. In `resizeEvent`, the title bar should check what orientation it should assume:

            QDockWidget *dockWidget = qobject_cast<QDockWidget*>(parentWidget());
            if (dockWidget->features() & QDockWidget::DockWidgetVerticalTitleBar) {
                // I need to be vertical
            } else {
                // I need to be horizontal
            }

  - The title bar widget must have a valid QWidget::sizeHint() and QWidget::minimumSizeHint(). These functions should take into account the current orientation of the title bar.

  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`, `DockWidgetVerticalTitleBar`

### setWidget

    public final void setWidget(QWidget widget)

  Sets the widget for the dock widget to `widget`.

  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`, `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`

### changeEvent

    protected void changeEvent(QEvent event)

  This function is reimplemented for internal reasons.

  Overrides:
    `changeEvent` in class `QWidget`

### closeEvent

    protected void closeEvent(QCloseEvent event)

  This function is reimplemented for internal reasons.

  Overrides:
    `closeEvent` in class `QWidget`
  See Also:
    `event`, `hide`, `close`, `QCloseEvent`, Application Example

### event

    public boolean event(QEvent event)

  This function is reimplemented for internal reasons.

  Overrides:
    `event` in class `QWidget`
  See Also:
    `closeEvent`, `focusInEvent`, `focusOutEvent`, `enterEvent`, `keyPressEvent`, `keyReleaseEvent`, `leaveEvent`, `mouseDoubleClickEvent`, `mouseMoveEvent`, `mousePressEvent`, `mouseReleaseEvent`, `moveEvent`, `paintEvent`, `resizeEvent`, `QObject::event`, `QObject::timerEvent`

### paintEvent

    protected void paintEvent(QPaintEvent event)

  This function is reimplemented for internal reasons.

  Overrides:
    `paintEvent` in class `QWidget`
  See Also:
    `event`, `repaint`, `update`, `QPainter`, `QPixmap`, `QPaintEvent`, Analog Clock Example

### fromNativePointer

    public static QDockWidget fromNativePointer(QNativePointer nativePointer)

  This function returns the QDockWidget instance pointed to by nativePointer

  Parameters:
    `nativePointer` - the QNativePointer of which object should be returned.

### 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.

Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD