QGIS API Documentation 3.99.0-Master (26c88405ac0)
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 "qgis_gui.h"
19
20#include <QKeyEvent>
21#include <QStack>
22#include <QWidget>
23
24class QMenu;
25
30class GUI_EXPORT QgsPanelWidget : public QWidget
31{
32 Q_OBJECT
33 public:
34
39 QgsPanelWidget( QWidget *parent = nullptr );
40
45 void setPanelTitle( const QString &panelTitle ) { mPanelTitle = panelTitle; }
46
51 QString panelTitle() const { return mPanelTitle; }
52
60 void connectChildPanels( const QList<QgsPanelWidget *> &panels );
61
69 void connectChildPanel( QgsPanelWidget *panel );
70
76 virtual void setDockMode( bool dockMode );
77
86 virtual bool applySizeConstraintsToStack() const;
87
94 bool dockMode() const { return mDockMode; }
95
102 void setAutoDelete( bool autoDelete ) { mAutoDelete = autoDelete; }
103
110 bool autoDelete() const { return mAutoDelete; }
111
118 static QgsPanelWidget *findParentPanel( QWidget *widget );
119
127 virtual QString menuButtonTooltip() const;
128
135 virtual QMenu *menuButtonMenu();
136
137 signals:
138
149
156 void showPanel( QgsPanelWidget *panel );
157
165
166 public slots:
167
178 void openPanel( QgsPanelWidget *panel );
179
184 void acceptPanel();
185
186 protected:
187
192 void keyPressEvent( QKeyEvent *event ) override;
193
194 private:
195 bool mAutoDelete = true;
196 QString mPanelTitle;
197 bool mDockMode = false;
198};
199
200
209class GUI_EXPORT QgsPanelWidgetWrapper : public QgsPanelWidget
210{
211 Q_OBJECT
212 public:
213
220 QgsPanelWidgetWrapper( QWidget *widget, QWidget *parent = nullptr );
221
226 QWidget *widget() { return mWidget; }
227
228 private:
229 QWidget *mWidget = nullptr;
230};
231
232#endif // QGSPANELWIDGET_H
QWidget * widget()
Returns the internal widget that is wrapped in this panel.
QgsPanelWidgetWrapper(QWidget *widget, QWidget *parent=nullptr)
Wrapper widget for existing widgets which can't have the inheritance tree changed,...
Base class for any widget that can be shown as an inline panel.
bool autoDelete() const
The the auto delete property on the widget.
QString panelTitle() const
The title of the panel.
void showPanel(QgsPanelWidget *panel)
Emit when you require a panel to be show in the interface.
void openPanel(QgsPanelWidget *panel)
Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the ...
bool dockMode() const
Returns the dock mode state.
void panelAccepted(QgsPanelWidget *panel)
Emitted when the panel is accepted by the user.
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
void setAutoDelete(bool autoDelete)
The the auto delete property on the widget.
void widgetChanged()
Emitted when the widget state changes.
void acceptPanel()
Accept the panel.
void keyPressEvent(QKeyEvent *event) override
Overridden key press event to handle the esc event on the widget.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.