QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
23 class QMenu;
24 
29 class GUI_EXPORT QgsPanelWidget : public QWidget
30 {
31  Q_OBJECT
32  public:
33 
38  QgsPanelWidget( QWidget *parent = nullptr );
39 
44  void setPanelTitle( const QString &panelTitle ) { mPanelTitle = panelTitle; }
45 
50  QString panelTitle() { return mPanelTitle; }
51 
59  void connectChildPanels( const QList<QgsPanelWidget *> &panels );
60 
68  void connectChildPanel( QgsPanelWidget *panel );
69 
75  virtual void setDockMode( bool dockMode );
76 
83  bool dockMode() { return mDockMode; }
84 
91  void setAutoDelete( bool autoDelete ) { mAutoDelete = autoDelete; }
92 
99  bool autoDelete() { return mAutoDelete; }
100 
108  static QgsPanelWidget *findParentPanel( QWidget *widget );
109 
117  virtual QString menuButtonTooltip() const;
118 
125  virtual QMenu *menuButtonMenu();
126 
127  signals:
128 
138  void panelAccepted( QgsPanelWidget *panel );
139 
146  void showPanel( QgsPanelWidget *panel );
147 
154  void widgetChanged();
155 
156  public slots:
157 
168  void openPanel( QgsPanelWidget *panel );
169 
174  void acceptPanel();
175 
176  protected:
177 
182  void keyPressEvent( QKeyEvent *event ) override;
183 
184  private:
185  bool mAutoDelete = true;
186  QString mPanelTitle;
187  bool mDockMode = false;
188 
189 };
190 
191 
200 class GUI_EXPORT QgsPanelWidgetWrapper: public QgsPanelWidget
201 {
202  Q_OBJECT
203  public:
204 
211  QgsPanelWidgetWrapper( QWidget *widget, QWidget *parent = nullptr );
212 
217  QWidget *widget() { return mWidget; }
218 
219  private:
220  QWidget *mWidget = nullptr;
221 
222 };
223 
224 #endif // QGSPANELWIDGET_H
QgsPanelWidget::autoDelete
bool autoDelete()
The the auto delete property on the widget.
Definition: qgspanelwidget.h:99
QgsPanelWidget::dockMode
bool dockMode()
Returns the dock mode state.
Definition: qgspanelwidget.h:83
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsPanelWidgetWrapper::widget
QWidget * widget()
Returns the internal widget that is wrapped in this panel.
Definition: qgspanelwidget.h:217
QgsPanelWidget::setAutoDelete
void setAutoDelete(bool autoDelete)
The the auto delete property on the widget.
Definition: qgspanelwidget.h:91
QgsPanelWidget::panelTitle
QString panelTitle()
The title of the panel.
Definition: qgspanelwidget.h:50
QgsPanelWidget::setPanelTitle
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
Definition: qgspanelwidget.h:44
QgsPanelWidgetWrapper
Wrapper widget for existing widgets which can't have the inheritance tree changed,...
Definition: qgspanelwidget.h:200