Home · All Classes · Modules

QDockWidget Class Reference
[QtGui 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.

Types

Methods

Qt Signals


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 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 dependent on the style in use.

See also QMainWindow.


Type Documentation

QDockWidget.DockWidgetFeature

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 is a typedef for QFlags<DockWidgetFeature>. It stores an OR combination of DockWidgetFeature values.


Method Documentation

QDockWidget.__init__ (self, QString title, QWidget parent = None, Qt.WindowFlags flags = 0)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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.__init__ (self, QWidget parent = None, Qt.WindowFlags flags = 0)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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

Qt.DockWidgetAreas QDockWidget.allowedAreas (self)

QDockWidget.changeEvent (self, QEvent event)

QDockWidget.closeEvent (self, QCloseEvent event)

bool QDockWidget.event (self, QEvent event)

DockWidgetFeatures QDockWidget.features (self)

bool QDockWidget.isAreaAllowed (self, Qt.DockWidgetArea area)

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

bool QDockWidget.isFloating (self)

QDockWidget.paintEvent (self, QPaintEvent event)

QDockWidget.setAllowedAreas (self, Qt.DockWidgetAreas areas)

QDockWidget.setFeatures (self, DockWidgetFeatures features)

QDockWidget.setFloating (self, bool floating)

QDockWidget.setWidget (self, QWidget widget)

Sets the widget for the dock widget to widget.

See also widget().

QAction QDockWidget.toggleViewAction (self)

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.

QWidget QDockWidget.widget (self)

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

See also setWidget().


Qt Signal Documentation

void allowedAreasChanged (Qt::DockWidgetAreas)

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

void featuresChanged (QDockWidget::DockWidgetFeatures)

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

void topLevelChanged (bool)

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().


PyQt 4.0.1 for X11Copyright © Riverbank Computing Ltd and Trolltech AS 2006Qt 4.1.4