QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgspanelwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspanelwidget.h
3  ---------------------
4  begin : June 2016
5  copyright : (C) 2016 by Nathan Woodrow
6  email :
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSPANELWIDGET_H
16 #define QGSPANELWIDGET_H
17 
18 #include <QWidget>
19 #include <QKeyEvent>
20 #include <QStack>
21 #include "qgis_gui.h"
22 
27 class GUI_EXPORT QgsPanelWidget : public QWidget
28 {
29  Q_OBJECT
30  public:
31 
36  QgsPanelWidget( QWidget *parent = nullptr );
37 
42  void setPanelTitle( const QString &panelTitle ) { mPanelTitle = panelTitle; }
43 
48  QString panelTitle() { return mPanelTitle; }
49 
57  void connectChildPanels( const QList<QgsPanelWidget *> &panels );
58 
66  void connectChildPanel( QgsPanelWidget *panel );
67 
73  virtual void setDockMode( bool dockMode );
74 
81  bool dockMode() { return mDockMode; }
82 
89  void setAutoDelete( bool autoDelete ) { mAutoDelete = autoDelete; }
90 
97  bool autoDelete() { return mAutoDelete; }
98 
106  static QgsPanelWidget *findParentPanel( QWidget *widget );
107 
108  signals:
109 
119  void panelAccepted( QgsPanelWidget *panel );
120 
127  void showPanel( QgsPanelWidget *panel );
128 
135  void widgetChanged();
136 
137  public slots:
138 
149  void openPanel( QgsPanelWidget *panel );
150 
155  void acceptPanel();
156 
157  protected:
158 
163  void keyPressEvent( QKeyEvent *event ) override;
164 
165  private:
166  bool mAutoDelete = true;
167  QString mPanelTitle;
168  bool mDockMode = false;
169 
170 };
171 
172 
181 class GUI_EXPORT QgsPanelWidgetWrapper: public QgsPanelWidget
182 {
183  Q_OBJECT
184  public:
185 
192  QgsPanelWidgetWrapper( QWidget *widget, QWidget *parent = nullptr );
193 
198  QWidget *widget() { return mWidget; }
199 
200  private:
201  QWidget *mWidget = nullptr;
202 
203 };
204 
205 #endif // QGSPANELWIDGET_H
QWidget * widget()
Returns the internal widget that is wrapped in this panel.
bool dockMode()
Returns the dock mode state.
bool autoDelete()
The the auto delete property on the widget.
Base class for any widget that can be shown as a inline panel.
void setAutoDelete(bool autoDelete)
The the auto delete property on the widget.
QString panelTitle()
The title of the panel.
Wrapper widget for existing widgets which can&#39;t have the inheritance tree changed, e.g dialogs.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.