QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsmaptoolshaperegistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaptoolshaperegistry.h
3  ----------------------
4  begin : January 2022
5  copyright : (C) 2022 by Denis Rouzaud
6  email : [email protected]
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSMAPTOOLSHAPEREGISTRY_H
19 #define QGSMAPTOOLSHAPEREGISTRY_H
20 
21 #define SIP_NO_FILE
22 
25 #include "qgis_gui.h"
26 
28 class QgsMapToolCapture;
29 
35 class GUI_EXPORT QgsMapToolShapeRegistry
36 {
37  Q_GADGET
38  public:
39 
44 
46 
50  void addMapTool( QgsMapToolShapeMetadata *mapTool SIP_TRANSFER );
51 
56  void removeMapTool( const QString &id );
57 
59  QList<QgsMapToolShapeMetadata *> mapToolMetadatas() const {return mMapTools;}
60 
62  QgsMapToolShapeMetadata *mapToolMetadata( const QString &id ) const;
63 
68  QgsMapToolShapeAbstract *mapTool( const QString &id, QgsMapToolCapture *parentTool ) const SIP_FACTORY;
69 
70  private:
71 
72  QList<QgsMapToolShapeMetadata *> mMapTools;
73 
74 };
75 
81 class GUI_EXPORT QgsMapToolShapeMetadata
82 {
83  public:
85  QgsMapToolShapeMetadata() = default;
86 
87  virtual ~QgsMapToolShapeMetadata() = default;
88 
90  virtual QString id() const = 0;
91 
93  virtual QString name() const = 0;
94 
96  virtual QIcon icon() const = 0;
97 
99  virtual QgsMapToolShapeAbstract::ShapeCategory category() const = 0;
100 
105  virtual QgsMapToolShapeAbstract *factory( QgsMapToolCapture *parentlTool ) const SIP_FACTORY = 0;
106 };
107 
108 
109 #endif // QGSMAPTOOLSHAPEREGISTRY_H
qgsmaptoolshapeabstract.h
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsMapToolShapeMetadata
QgsMapToolShapeMetadata is a base class for shape map tools metadata to be used in QgsMapToolShapeReg...
Definition: qgsmaptoolshaperegistry.h:81
QgsMapToolShapeRegistry::mapToolMetadatas
QList< QgsMapToolShapeMetadata * > mapToolMetadatas() const
Returns the list of map tools.
Definition: qgsmaptoolshaperegistry.h:59
QgsMapToolShapeRegistry
Keeps track of the registered shape map tools.
Definition: qgsmaptoolshaperegistry.h:35
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
qgsabstractrelationeditorwidget.h
QgsMapToolShapeAbstract
QgsMapToolShapeAbstract is a base class for shape map tools to be used by QgsMapToolCapture.
Definition: qgsmaptoolshapeabstract.h:40
QgsMapToolShapeAbstract::ShapeCategory
ShapeCategory
List of different shapes.
Definition: qgsmaptoolshapeabstract.h:46
QgsMapToolCapture
Definition: qgsmaptoolcapture.h:49