Class: QgsDockWidget

class qgis.gui.QgsDockWidget(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = 0)

Bases: PyQt5.QtWidgets.QDockWidget

Constructor for QgsDockWidget.

Parameters:
  • parent – parent widget
  • flags – window flags

QgsDockWidget(title: str, parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = 0) Constructor for QgsDockWidget.

Parameters:
  • title – dock title
  • parent – parent widget
  • flags – window flags

QgsDockWidget subclass with more fine-grained control over how the widget is closed or opened.

New in version 2.16: Methods

actionEvent
changeEvent
childEvent
closeEvent
connectNotify
contextMenuEvent
create
customEvent
destroy
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
enterEvent
event
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPreviousChild
hideEvent
initPainter
initStyleOption
inputMethodEvent
isSignalConnected
isUserVisible Returns true if the dock is both opened and raised to the front (ie not hidden by any other tabs.
keyPressEvent
keyReleaseEvent
leaveEvent
metric
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveEvent
nativeEvent
paintEvent
receivers
resizeEvent
sender
senderSignalIndex
setToggleVisibilityAction Links an action to the dock, so that toggling the action will automatically set the dock’s visibility to suit (and changing the dock visibility will update the action’s state).
setUserVisible Sets the dock widget as visible to a user, ie both shown and raised to the front.
sharedPainter
showEvent
tabletEvent
timerEvent
toggleUserVisible Toggles whether the dock is user visible.
toggleVisibilityAction Returns the action linked to the dock.
updateMicroFocus
wheelEvent

Signals

closed Emitted when dock widget is closed.
closedStateChanged Emitted when dock widget is closed (or opened).
opened Emitted when dock widget is opened.
openedStateChanged Emitted when dock widget is opened (or closed).

Attributes

actionEvent()
changeEvent()
childEvent()
closeEvent(self, QCloseEvent)
closed

Emitted when dock widget is closed.

See also

opened() [signal]

closedStateChanged

Emitted when dock widget is closed (or opened).

Parameters:wasClosed – will be true if dock widget was closed, or false if dock widget was opened

See also

closed()

See also

openedStateChanged() [signal]

connectNotify()
contextMenuEvent()
create()
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
initStyleOption()
inputMethodEvent()
isSignalConnected()
isUserVisible(self) → bool

Returns true if the dock is both opened and raised to the front (ie not hidden by any other tabs.

See also

setUserVisible()

keyPressEvent()
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
opened

Emitted when dock widget is opened.

See also

closed() [signal]

openedStateChanged

Emitted when dock widget is opened (or closed).

Parameters:wasOpened – will be true if dock widget was opened, or false if dock widget was closed

See also

opened() [signal]

paintEvent()
receivers()
resizeEvent()
sender()
senderSignalIndex()
setToggleVisibilityAction(self, action: QAction)

Links an action to the dock, so that toggling the action will automatically set the dock’s visibility to suit (and changing the dock visibility will update the action’s state).

New in version 3.4.

setUserVisible(self, visible: bool)

Sets the dock widget as visible to a user, ie both shown and raised to the front.

Parameters:visible – set to true to show the dock to the user, or false to hide the dock. When setting a dock as user visible, the dock will be opened (if it is not already opened) and raised to the front. When setting as hidden, the following logic is used: - hiding a dock which is open but not raised (ie hidden by another tab) will have no effect, and the dock will still be opened and hidden by the other tab - hiding a dock which is open and raised (ie, user visible) will cause the dock to be closed - hiding a dock which is closed has no effect and raises no signals

See also

isUserVisible()

sharedPainter()
showEvent(self, event: QShowEvent)
tabletEvent()
timerEvent()
toggleUserVisible(self)

Toggles whether the dock is user visible. If the dock is not currently user visible (i.e. opened and activated as a tab) then the dock will be opened and raised. If it is currently user visible it will be closed.

See also

setUserVisible()

See also

isUserVisible()

New in version 3.2.

toggleVisibilityAction(self) → QAction

Returns the action linked to the dock.

New in version 3.4.

updateMicroFocus()
wheelEvent()