QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsDockWidget Class Reference

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

#include <qgsdockwidget.h>

Inheritance diagram for QgsDockWidget:
Inheritance graph
[legend]

Public Slots

void setUserVisible (bool visible)
 Sets the dock widget as visible to a user, ie both shown and raised to the front.
 
void toggleUserVisible ()
 Toggles whether the dock is user visible.
 

Signals

void closed ()
 Emitted when dock widget is closed.
 
void closedStateChanged (bool wasClosed)
 Emitted when dock widget is closed (or opened).
 
void opened ()
 Emitted when dock widget is opened.
 
void openedStateChanged (bool wasOpened)
 Emitted when dock widget is opened (or closed).
 

Public Member Functions

 QgsDockWidget (const QString &title, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
 Constructor for QgsDockWidget.
 
 QgsDockWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
 Constructor for QgsDockWidget.
 
bool isUserVisible () const
 Returns true if the dock is both opened and raised to the front (ie not hidden by any other tabs.
 
void setToggleVisibilityAction (QAction *action)
 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).
 
QAction * toggleVisibilityAction ()
 Returns the action linked to the dock.
 

Protected Member Functions

void closeEvent (QCloseEvent *) override
 
void showEvent (QShowEvent *event) override
 

Detailed Description

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

Definition at line 30 of file qgsdockwidget.h.

Constructor & Destructor Documentation

◆ QgsDockWidget() [1/2]

QgsDockWidget::QgsDockWidget ( QWidget *  parent = nullptr,
Qt::WindowFlags  flags = Qt::WindowFlags() 
)
explicit

Constructor for QgsDockWidget.

Parameters
parentparent widget
flagswindow flags

Definition at line 24 of file qgsdockwidget.cpp.

◆ QgsDockWidget() [2/2]

QgsDockWidget::QgsDockWidget ( const QString &  title,
QWidget *  parent = nullptr,
Qt::WindowFlags  flags = Qt::WindowFlags() 
)
explicit

Constructor for QgsDockWidget.

Parameters
titledock title
parentparent widget
flagswindow flags

Definition at line 30 of file qgsdockwidget.cpp.

Member Function Documentation

◆ closed

void QgsDockWidget::closed ( )
signal

Emitted when dock widget is closed.

See also
closedStateChanged()
opened()

◆ closedStateChanged

void QgsDockWidget::closedStateChanged ( bool  wasClosed)
signal

Emitted when dock widget is closed (or opened).

Parameters
wasClosedwill be true if dock widget was closed, or false if dock widget was opened
See also
closed()
openedStateChanged()

◆ closeEvent()

void QgsDockWidget::closeEvent ( QCloseEvent *  e)
overrideprotected

Definition at line 81 of file qgsdockwidget.cpp.

◆ isUserVisible()

bool QgsDockWidget::isUserVisible ( ) const

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

See also
setUserVisible()
toggleUserVisible()

Definition at line 57 of file qgsdockwidget.cpp.

◆ opened

void QgsDockWidget::opened ( )
signal

Emitted when dock widget is opened.

See also
openedStateChanged()
closed()

◆ openedStateChanged

void QgsDockWidget::openedStateChanged ( bool  wasOpened)
signal

Emitted when dock widget is opened (or closed).

Parameters
wasOpenedwill be true if dock widget was opened, or false if dock widget was closed
See also
closedStateChanged()
opened()

◆ setToggleVisibilityAction()

void QgsDockWidget::setToggleVisibilityAction ( QAction *  action)

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

See also
toggleVisibilityAction()
Since
QGIS 3.4

Definition at line 62 of file qgsdockwidget.cpp.

◆ setUserVisible

void QgsDockWidget::setUserVisible ( bool  visible)
slot

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

Parameters
visibleset 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()
toggleUserVisible()

Definition at line 36 of file qgsdockwidget.cpp.

◆ showEvent()

void QgsDockWidget::showEvent ( QShowEvent *  event)
overrideprotected

Definition at line 89 of file qgsdockwidget.cpp.

◆ toggleUserVisible

void QgsDockWidget::toggleUserVisible ( )
slot

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()
isUserVisible()
Since
QGIS 3.2

Definition at line 52 of file qgsdockwidget.cpp.

◆ toggleVisibilityAction()

QAction * QgsDockWidget::toggleVisibilityAction ( )

Returns the action linked to the dock.

See also
setToggleVisibilityAction()
Since
QGIS 3.4

Definition at line 76 of file qgsdockwidget.cpp.


The documentation for this class was generated from the following files: