QGIS API Documentation 4.3.0-Master (0cfde48c85b)
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#include "qgis_sip.h"
20
21#include <QKeyEvent>
22#include <QStack>
23#include <QWidget>
24
25class QMenu;
26
31class GUI_EXPORT QgsPanelWidget : public QWidget
32{
33 Q_OBJECT
34 public:
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
166 Q_DECL_DEPRECATED void widgetChanged() SIP_DEPRECATED;
167
176 void changed();
177
178 public slots:
179
190 void openPanel( QgsPanelWidget *panel );
191
196 void acceptPanel();
197
198 protected:
203 void keyPressEvent( QKeyEvent *event ) override;
204
205 private:
206 bool mAutoDelete = true;
207 QString mPanelTitle;
208 bool mDockMode = false;
209 bool mForwardChangedSignal = false;
210};
211
212
221class GUI_EXPORT QgsPanelWidgetWrapper : public QgsPanelWidget
222{
223 Q_OBJECT
224 public:
231 QgsPanelWidgetWrapper( QWidget *widget, QWidget *parent = nullptr );
232
237 QWidget *widget() { return mWidget; }
238
239 private:
240 QWidget *mWidget = nullptr;
241};
242
243#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 changed()
Emitted when the widget state changes.
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 acceptPanel()
Accept the panel.
void keyPressEvent(QKeyEvent *event) override
Overridden key press event to handle the esc event on the widget.
Q_DECL_DEPRECATED void widgetChanged()
Emitted when the widget state changes.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
#define SIP_DEPRECATED
Definition qgis_sip.h:113