|  | Home · Overviews · Examples |

# QDockWidget Class Reference
[com.trolltech.qt.gui module]

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

Inherits `QWidget`.

## 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 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` and Dock Widgets Example.