QGIS API Documentation  3.6.0-Noosa (5873452)
qgisplugin.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgisplugin.h
3  --------------------------------------
4  Date : Sun Sep 16 12:12:31 AKDT 2007
5  Copyright : (C) 2007 by Gary E. Sherman
6  Email : sherman at mrcc 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 
35 #ifndef QGISPLUGIN_H
36 #define QGISPLUGIN_H
37 
38 #define SIP_NO_FILE
39 
40 
41 #include <QString>
42 
43 class QgisInterface;
44 
45 //#include "qgisplugingui.h"
46 
54 {
55  public:
56 
58  //virtual QgisPluginGui *gui()=0;
60 #if 0
61  enum Elements
62  {
63  MENU,
64  MENU_ITEM,
65  TOOLBAR,
66  TOOLBAR_BUTTON,
67  };
68 
69  \todo XXX this may be a hint that there should be subclasses
70 #endif
71 
73  {
74  UI = 1,
77  };
78 
79 
83  QgisPlugin( QString const &name = "",
84  QString const &description = "",
85  QString const &category = "",
86  QString const &version = "",
88  : mName( name )
89  , mDescription( description )
90  , mCategory( category )
91  , mVersion( version )
92  , mType( type )
93  {}
94 
95  virtual ~QgisPlugin() = default;
96 
98  QString const &name() const
99  {
100  return mName;
101  }
102 
103  QString &name()
104  {
105  return mName;
106  }
107 
109  QString const &version() const
110  {
111  return mVersion;
112  }
113 
115  QString &version()
116  {
117  return mVersion;
118  }
119 
121  QString const &description() const
122  {
123  return mDescription;
124  }
125 
127  QString &description()
128  {
129  return mDescription;
130  }
131 
133  QString const &category() const
134  {
135  return mCategory;
136  }
137 
139  QString &category()
140  {
141  return mCategory;
142  }
143 
146  {
147  return mType;
148  }
149 
150 
153  {
154  return mType;
155  }
156 
158  virtual void initGui() = 0;
159 
161  virtual void unload() = 0;
162 
163  private:
164 
166  QString mName;
167 
169  QString mDescription;
170 
172  QString mCategory;
173 
175  QString mVersion;
176 
178 
183  PluginType mType;
184 
185 }; // class QgisPlugin
186 
187 
188 // Typedefs used by qgis main app
189 
192 
194 typedef void unload_t( QgisPlugin * );
195 
197 typedef QString name_t();
198 
200 typedef QString description_t();
201 
203 typedef QString category_t();
204 
206 typedef int type_t();
207 
209 typedef QString version_t();
210 
212 typedef QString icon_t();
213 
215 typedef QString experimental_t();
216 
217 #endif // QGISPLUGIN_H
A plugin for a new renderer class.
Definition: qgisplugin.h:76
QString const & description() const
A brief description of the plugin.
Definition: qgisplugin.h:121
User interface plug-in.
Definition: qgisplugin.h:74
QString const & category() const
Plugin category.
Definition: qgisplugin.h:133
QString icon_t()
Typedef for getting the plugin icon file name without instantiating the plugin.
Definition: qgisplugin.h:212
QgisPlugin * create_t(QgisInterface *)
Typedef for the function that returns a generic pointer to a plugin object.
Definition: qgisplugin.h:191
QgisPlugin::PluginType const & type() const
Plugin type, either UI or map layer.
Definition: qgisplugin.h:145
QgisPlugin::PluginType & type()
Plugin type, either UI or map layer.
Definition: qgisplugin.h:152
void unload_t(QgisPlugin *)
Typedef for the function to unload a plugin and free its resources.
Definition: qgisplugin.h:194
Map layer plug-in.
Definition: qgisplugin.h:75
QString name_t()
Typedef for getting the name of the plugin without instantiating it.
Definition: qgisplugin.h:197
PluginType
Interface to gui element collection object.
Definition: qgisplugin.h:72
QgisPlugin(QString const &name="", QString const &description="", QString const &category="", QString const &version="", PluginType type=MapLayer)
Constructor for QgisPlugin.
Definition: qgisplugin.h:83
virtual void unload()=0
Unload the plugin and cleanup the GUI.
QString description_t()
Typedef for getting the description without instantiating the plugin.
Definition: qgisplugin.h:200
int type_t()
Typedef for getting the plugin type without instantiating the plugin.
Definition: qgisplugin.h:206
QString & category()
Plugin category.
Definition: qgisplugin.h:139
QgisInterface Abstract base class defining interfaces exposed by QgisApp and made available to plugin...
Definition: qgisinterface.h:77
QString const & version() const
Version of the plugin.
Definition: qgisplugin.h:109
QString version_t()
Typedef for getting the plugin version without instantiating the plugin.
Definition: qgisplugin.h:209
virtual void initGui()=0
function to initialize connection to GUI
QString category_t()
Typedef for getting the category without instantiating the plugin.
Definition: qgisplugin.h:203
QString const & name() const
Gets the name of the plugin.
Definition: qgisplugin.h:98
QString & version()
Version of the plugin.
Definition: qgisplugin.h:115
virtual ~QgisPlugin()=default
Abstract base class from which all plugins must inherit.
Definition: qgisplugin.h:53
QString & name()
Definition: qgisplugin.h:103
QString & description()
A brief description of the plugin.
Definition: qgisplugin.h:127
QString experimental_t()
Typedef for getting the experimental status without instantiating the plugin.
Definition: qgisplugin.h:215