QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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
23class QMenu;
24
29class GUI_EXPORT QgsPanelWidget : public QWidget
30{
31 Q_OBJECT
32 public:
37 QgsPanelWidget( QWidget *parent = nullptr );
38
43 void setPanelTitle( const QString &panelTitle ) { mPanelTitle = panelTitle; }
44
49 QString panelTitle() { return mPanelTitle; }
50
58 void connectChildPanels( const QList<QgsPanelWidget *> &panels );
59
67 void connectChildPanel( QgsPanelWidget *panel );
68
74 virtual void setDockMode( bool dockMode );
75
84 virtual bool applySizeConstraintsToStack() const;
85
92 bool dockMode() { return mDockMode; }
93
100 void setAutoDelete( bool autoDelete ) { mAutoDelete = autoDelete; }
101
108 bool autoDelete() { return mAutoDelete; }
109
116 static QgsPanelWidget *findParentPanel( QWidget *widget );
117
125 virtual QString menuButtonTooltip() const;
126
133 virtual QMenu *menuButtonMenu();
134
135 signals:
136
147
154 void showPanel( QgsPanelWidget *panel );
155
163
164 public slots:
165
176 void openPanel( QgsPanelWidget *panel );
177
182 void acceptPanel();
183
184 protected:
189 void keyPressEvent( QKeyEvent *event ) override;
190
191 private:
192 bool mAutoDelete = true;
193 QString mPanelTitle;
194 bool mDockMode = false;
195};
196
197
206class GUI_EXPORT QgsPanelWidgetWrapper : public QgsPanelWidget
207{
208 Q_OBJECT
209 public:
216 QgsPanelWidgetWrapper( QWidget *widget, QWidget *parent = nullptr );
217
222 QWidget *widget() { return mWidget; }
223
224 private:
225 QWidget *mWidget = nullptr;
226};
227
228#endif // QGSPANELWIDGET_H
Wrapper widget for existing widgets which can't have the inheritance tree changed,...
QWidget * widget()
Returns the internal widget that is wrapped in this panel.
Base class for any widget that can be shown as a inline panel.
void showPanel(QgsPanelWidget *panel)
Emit when you require a panel to be show in the interface.
QString panelTitle()
The title of the panel.
void panelAccepted(QgsPanelWidget *panel)
Emitted when the panel is accepted by the user.
bool autoDelete()
The the auto delete property on the widget.
void setAutoDelete(bool autoDelete)
The the auto delete property on the widget.
void widgetChanged()
Emitted when the widget state changes.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
bool dockMode()
Returns the dock mode state.