QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsdevtoolwidgetfactory.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdevtoolwidgetfactory.h
3  ------------------------
4  Date : March 2020
5  Copyright : (C) 2020 Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
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 
16 #ifndef QGSDEVTOOLWIDGETFACTORY_H
17 #define QGSDEVTOOLWIDGETFACTORY_H
18 
19 #include "qgis_gui.h"
20 #include "qgis_sip.h"
21 #include <QString>
22 #include <QIcon>
23 
24 class QgsDevToolWidget;
25 class QWidget;
26 
33 class GUI_EXPORT QgsDevToolWidgetFactory
34 {
35  public:
36 
40  QgsDevToolWidgetFactory( const QString &title = QString(), const QIcon &icon = QIcon() );
41 
42  virtual ~QgsDevToolWidgetFactory() = default;
43 
48  virtual QIcon icon() const { return mIcon; }
49 
54  void setIcon( const QIcon &icon ) { mIcon = icon; }
55 
60  virtual QString title() const { return mTitle; }
61 
65  void setTitle( const QString &title ) { mTitle = title; }
66 
72  virtual QgsDevToolWidget *createWidget( QWidget *parent = nullptr ) const = 0 SIP_FACTORY;
73 
74  private:
75  QIcon mIcon;
76  QString mTitle;
77 };
78 
79 #endif // QGSDEVTOOLWIDGETFACTORY_H
Factory class for creating custom developer/debugging tool pages.
virtual ~QgsDevToolWidgetFactory()=default
virtual QgsDevToolWidget * createWidget(QWidget *parent=nullptr) const =0
Factory function to create the widget on demand as needed by the dock.
virtual QString title() const
Returns the (translated) title of the tool.
void setTitle(const QString &title)
Set the translated title for the tool.
virtual QIcon icon() const
Returns the icon that will be shown in the tool in the panel.
void setIcon(const QIcon &icon)
Sets the icon for the factory object, which will be shown for the tool in the panel.
A panel widget that can be shown in the developer tools panel.
#define SIP_FACTORY
Definition: qgis_sip.h:76