QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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
QgsDevToolWidgetFactory::title
virtual QString title() const
Returns the (translated) title of the tool.
Definition: qgsdevtoolwidgetfactory.h:60
QgsDevToolWidgetFactory
Definition: qgsdevtoolwidgetfactory.h:33
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsDevToolWidgetFactory::setIcon
void setIcon(const QIcon &icon)
Sets the icon for the factory object, which will be shown for the tool in the panel.
Definition: qgsdevtoolwidgetfactory.h:54
qgis_sip.h
QgsDevToolWidgetFactory::icon
virtual QIcon icon() const
Returns the icon that will be shown in the tool in the panel.
Definition: qgsdevtoolwidgetfactory.h:48
QgsDevToolWidget
A panel widget that can be shown in the developer tools panel.
Definition: qgsdevtoolwidget.h:28
QgsDevToolWidgetFactory::setTitle
void setTitle(const QString &title)
Set the translated title for the tool.
Definition: qgsdevtoolwidgetfactory.h:65