|  | Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions |

# QDockWidget Class Reference

The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-level window on the desktop. More...

    #include <QDockWidget>

Part of the QtGui module.

Inherits QWidget.

- List of all members, including inherited members

### Public Types

- enum DockWidgetFeature { DockWidgetClosable, DockWidgetMovable, DockWidgetFloatable, AllDockWidgetFeatures, NoDockWidgetFeatures }
- flags DockWidgetFeatures

### Properties

- allowedAreas : Qt::DockWidgetAreas
- features : DockWidgetFeatures
- floating : bool

- 51 properties inherited from QWidget
- 1 property inherited from QObject

### Public Functions

- QDockWidget ( const QString & title, QWidget * parent = 0, Qt::WFlags flags = 0 )
- QDockWidget ( QWidget * parent = 0, Qt::WFlags flags = 0 )
- ~QDockWidget ()
- Qt::DockWidgetAreas allowedAreas () const
- DockWidgetFeatures features () const
- bool isAreaAllowed ( Qt::DockWidgetArea area ) const
- bool isFloating () const
- void setAllowedAreas ( Qt::DockWidgetAreas areas )
- void setFeatures ( DockWidgetFeatures features )
- void setFloating ( bool floating )
- void setWidget ( QWidget * widget )
- QAction * toggleViewAction () const
- QWidget * widget () const

- 182 public functions inherited from QWidget
- 28 public functions inherited from QObject
- 11 public functions inherited from QPaintDevice

### Signals

- void allowedAreasChanged ( Qt::DockWidgetAreas allowedAreas )
- void featuresChanged ( DockWidgetFeatures features )
- void topLevelChanged ( bool topLevel )

- 1 signal inherited from QWidget
- 1 signal inherited from QObject

### Additional Inherited Members

- 17 public slots inherited from QWidget
- 1 public slot inherited from QObject
- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject
- 37 protected functions inherited from QWidget
- 7 protected functions inherited from QObject

## Detailed Description

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 center widget in a QMainWindow.

### mainwindow diagram showing the various areas of the mainwindow should go here - see below

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 titlebar 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 style dependent.

### screenshot of QDockWidget in a few styles should go here

### Behavior

- behaviour of QDockWidget while docked in QMainWindow:
- behaviour of QDockWidget while floated:
- behaviour while dragging QDockWidget:
  - to an unoccupied dock widget area:
  - to an occupied dock widget area:
  - to top-level:

See also QMainWindow.

## Member Type Documentation

### enum QDockWidget::DockWidgetFeature
flags QDockWidget::DockWidgetFeatures

Constant | Value | Description
--- | --- | ---
`QDockWidget::DockWidgetClosable` | `0x01` | The dock widget can be closed.
`QDockWidget::DockWidgetMovable` | `0x02` | The dock widget can be moved between docks by the user.
`QDockWidget::DockWidgetFloatable` | `0x04` | The dock widget can be detached from the main window, and floated as an independent window.
`QDockWidget::AllDockWidgetFeatures` | `DockWidgetFeatureMask` | The dock widget can be closed, moved, and floated.
`QDockWidget::NoDockWidgetFeatures` | `0x00` | The dock widget cannot be closed, moved, or floated.

The `DockWidgetFeatures` type stores an OR combination of `DockWidgetFeature` values.

## Property Documentation

### allowedAreas : Qt::DockWidgetAreas

This property holds areas where the dock widget may be placed.

The default is `Qt::AllDockWidgetAreas`.

Access functions:

- Qt::DockWidgetAreas allowedAreas () const
- void setAllowedAreas ( Qt::DockWidgetAreas areas )

See also QDockWidget::area.

### features : DockWidgetFeatures

This property holds whether the dock widget is movable, closable, and floatable.

Access functions:

- DockWidgetFeatures features () const
- void setFeatures ( DockWidgetFeatures features )

See also DockWidgetFeature.

### floating : bool

Access functions:

- bool isFloating () const
- void setFloating ( bool floating )

## Member Function Documentation

### QDockWidget::QDockWidget ( const QString & title, QWidget * parent = 0, Qt::WFlags flags = 0 )

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::QDockWidget ( QWidget * parent = 0, Qt::WFlags flags = 0 )

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

### QDockWidget::~QDockWidget ()

Destroys the dock widget.

### void QDockWidget::allowedAreasChanged ( Qt::DockWidgetAreas allowedAreas ) `[signal]`

### void QDockWidget::featuresChanged ( DockWidgetFeatures features ) `[signal]`

### bool QDockWidget::isAreaAllowed ( Qt::DockWidgetArea area ) const

Returns true if this dock widget can be placed in the given area; otherwise returns false.

### void QDockWidget::setWidget ( QWidget * widget )

Sets the widget for the dock widget to widget.

See also widget().

### QAction * QDockWidget::toggleViewAction () const

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.

### void QDockWidget::topLevelChanged ( bool topLevel ) `[signal]`

### QWidget * QDockWidget::widget () const

Returns the widget for the dock widget. This function returns zero if the widget has not been set.

See also setWidget().