QGIS API Documentation 3.41.0-Master (af5edcb665c)
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 <QDockWidget>
21#include "qgis_gui.h"
22#include "qgis_sip.h"
23
30class GUI_EXPORT QgsDockWidget : public QDockWidget
31{
32 Q_OBJECT
33
34 public:
40 explicit QgsDockWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
41
48 explicit QgsDockWidget( const QString &title, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
49
56 bool isUserVisible() const;
57
65 void setToggleVisibilityAction( QAction *action );
66
73 QAction *toggleVisibilityAction();
74
75 public slots:
76
93 void setUserVisible( bool visible );
94
104 void toggleUserVisible();
105
106 protected:
107 void closeEvent( QCloseEvent * ) override;
108 void showEvent( QShowEvent *event ) override;
109
110 signals:
111
117 void closed();
118
125 void closedStateChanged( bool wasClosed );
126
132 void opened();
133
140 void openedStateChanged( bool wasOpened );
141
142 private slots:
143
144 void handleVisibilityChanged( bool visible );
145
146 private:
147 bool mVisibleAndActive = false;
148
149 QAction *mAction = nullptr;
150};
151#endif //QGSDOCKWIDGET_H
QgsDockWidget subclass with more fine-grained control over how the widget is closed or opened.
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).
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53