QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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
36#ifndef QGISPLUGIN_H
37#define QGISPLUGIN_H
38
39#define SIP_NO_FILE
40
41
42#include <QString>
43
44class QgisInterface;
45
46//#include "qgisplugingui.h"
47
55{
56 public:
57
59 //virtual QgisPluginGui *gui()=0;
61#if 0
62 enum Elements
63 {
64 MENU,
65 MENU_ITEM,
66 TOOLBAR,
67 TOOLBAR_BUTTON,
68 };
69
70 \todo XXX this may be a hint that there should be subclasses
71#endif
72
74 {
75 UI = 1,
78 };
79
80
84 QgisPlugin( QString const &name = "",
85 QString const &description = "",
86 QString const &category = "",
87 QString const &version = "",
89 : mName( name )
90 , mDescription( description )
91 , mCategory( category )
92 , mVersion( version )
93 , mType( type )
94 {}
95
96 virtual ~QgisPlugin() = default;
97
99 QString const &name() const
100 {
101 return mName;
102 }
103
104 QString &name()
105 {
106 return mName;
107 }
108
110 QString const &version() const
111 {
112 return mVersion;
113 }
114
116 QString &version()
117 {
118 return mVersion;
119 }
120
122 QString const &description() const
123 {
124 return mDescription;
125 }
126
128 QString &description()
129 {
130 return mDescription;
131 }
132
134 QString const &category() const
135 {
136 return mCategory;
137 }
138
140 QString &category()
141 {
142 return mCategory;
143 }
144
147 {
148 return mType;
149 }
150
151
154 {
155 return mType;
156 }
157
159 virtual void initGui() = 0;
160
162 virtual void unload() = 0;
163
164 private:
165
167 QString mName;
168
170 QString mDescription;
171
173 QString mCategory;
174
176 QString mVersion;
177
179
184 PluginType mType;
185
186}; // class QgisPlugin
187
188
189// Typedefs used by qgis main app
190
193
195typedef void unload_t( QgisPlugin * );
196
198typedef const QString *name_t();
199
201typedef const QString *description_t();
202
204typedef const QString *category_t();
205
207typedef int type_t();
208
210typedef const QString *version_t();
211
213typedef const QString *icon_t();
214
216typedef const QString *experimental_t();
217
219typedef const QString *create_date_t();
220
222typedef const QString *update_date_t();
223
224#endif // QGISPLUGIN_H
QgisInterface Abstract base class defining interfaces exposed by QgisApp and made available to plugin...
Definition: qgisinterface.h:89
Abstract base class from which all plugins must inherit.
Definition: qgisplugin.h:55
QString & name()
Definition: qgisplugin.h:104
virtual ~QgisPlugin()=default
QString const & version() const
Version of the plugin.
Definition: qgisplugin.h:110
virtual void initGui()=0
function to initialize connection to GUI
PluginType
Interface to gui element collection object.
Definition: qgisplugin.h:74
@ Renderer
A plugin for a new renderer class.
Definition: qgisplugin.h:77
@ MapLayer
Map layer plug-in.
Definition: qgisplugin.h:76
@ UI
User interface plug-in.
Definition: qgisplugin.h:75
QString & category()
Plugin category.
Definition: qgisplugin.h:140
QgisPlugin::PluginType const & type() const
Plugin type, either UI or map layer.
Definition: qgisplugin.h:146
virtual void unload()=0
Unload the plugin and cleanup the GUI.
QgisPlugin::PluginType & type()
Plugin type, either UI or map layer.
Definition: qgisplugin.h:153
QString & version()
Version of the plugin.
Definition: qgisplugin.h:116
QString & description()
A brief description of the plugin.
Definition: qgisplugin.h:128
QString const & category() const
Plugin category.
Definition: qgisplugin.h:134
QgisPlugin(QString const &name="", QString const &description="", QString const &category="", QString const &version="", PluginType type=MapLayer)
Constructor for QgisPlugin.
Definition: qgisplugin.h:84
QString const & description() const
A brief description of the plugin.
Definition: qgisplugin.h:122
QString const & name() const
Gets the name of the plugin.
Definition: qgisplugin.h:99
const QString * name_t()
Typedef for getting the name of the plugin without instantiating it.
Definition: qgisplugin.h:198
const QString * icon_t()
Typedef for getting the plugin icon file name without instantiating the plugin.
Definition: qgisplugin.h:213
QgisPlugin * create_t(QgisInterface *)
Typedef for the function that returns a generic pointer to a plugin object.
Definition: qgisplugin.h:192
void unload_t(QgisPlugin *)
Typedef for the function to unload a plugin and free its resources.
Definition: qgisplugin.h:195
int type_t()
Typedef for getting the plugin type without instantiating the plugin.
Definition: qgisplugin.h:207
const QString * version_t()
Typedef for getting the plugin version without instantiating the plugin.
Definition: qgisplugin.h:210
const QString * update_date_t()
Typedef for getting the update date status without instantiating the plugin.
Definition: qgisplugin.h:222
const QString * description_t()
Typedef for getting the description without instantiating the plugin.
Definition: qgisplugin.h:201
const QString * category_t()
Typedef for getting the category without instantiating the plugin.
Definition: qgisplugin.h:204
const QString * experimental_t()
Typedef for getting the experimental status without instantiating the plugin.
Definition: qgisplugin.h:216
const QString * create_date_t()
Typedef for getting the create date without instantiating the plugin.
Definition: qgisplugin.h:219