QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsdockwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsdockwidget.h
3 ---------------
4 begin : June 2016
5 copyright : (C) 2016 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSDOCKWIDGET_H
18#define QGSDOCKWIDGET_H
19
20#include "qgis_gui.h"
21#include "qgis_sip.h"
22
23#include <QDockWidget>
24
30
31class GUI_EXPORT QgsDockWidget : public QDockWidget
32{
33 Q_OBJECT
34
35 public:
36
42 explicit QgsDockWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
43
50 explicit QgsDockWidget( const QString &title, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
51
58 bool isUserVisible() const;
59
67 void setToggleVisibilityAction( QAction *action );
68
75 QAction *toggleVisibilityAction();
76
77 public slots:
78
95 void setUserVisible( bool visible );
96
106 void toggleUserVisible();
107
108 protected:
109 void closeEvent( QCloseEvent * ) override;
110 void showEvent( QShowEvent *event ) override;
111
112 signals:
113
119 void closed();
120
127 void closedStateChanged( bool wasClosed );
128
134 void opened();
135
142 void openedStateChanged( bool wasOpened );
143
144 private slots:
145
146 void handleVisibilityChanged( bool visible );
147
148 private:
149 bool mVisibleAndActive = false;
150
151 QAction *mAction = nullptr;
152};
153#endif //QGSDOCKWIDGET_H
void closed()
Emitted when dock widget is closed.
QAction * toggleVisibilityAction()
Returns the action linked to the dock.
void closedStateChanged(bool wasClosed)
Emitted when dock widget is closed (or opened).
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 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.
void closeEvent(QCloseEvent *) override
void opened()
Emitted when dock widget is opened.
void showEvent(QShowEvent *event) override
void setToggleVisibilityAction(QAction *action)
Links an action to the dock, so that toggling the action will automatically set the dock's visibility...
void openedStateChanged(bool wasOpened)
Emitted when dock widget is opened (or closed).
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53