QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsrelationwidgetregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrelationwidgetregistry.h
3  ----------------------
4  begin : October 2020
5  copyright : (C) 2020 by Ivan Ivanov
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 
19 #include "qgis_gui.h"
20 
21 
22 #ifndef QGSRELATIONWIDGETREGISTRY_H
23 #define QGSRELATIONWIDGETREGISTRY_H
24 
25 
33 class GUI_EXPORT QgsRelationWidgetRegistry
34 {
35  public:
36 
41 
43 
47  void addRelationWidget( QgsAbstractRelationEditorWidgetFactory *widgetFactory SIP_TRANSFER );
48 
52  void removeRelationWidget( const QString &widgetType );
53 
57  QStringList relationWidgetNames();
58 
62  QMap<QString, QgsAbstractRelationEditorWidgetFactory *> factories() const;
63 
71  QgsAbstractRelationEditorWidget *create( const QString &widgetType, const QVariantMap &config, QWidget *parent = nullptr ) const SIP_TRANSFERBACK;
72 
80  QgsAbstractRelationEditorConfigWidget *createConfigWidget( const QString &widgetType, const QgsRelation &relation, QWidget *parent = nullptr ) const SIP_TRANSFERBACK;
81 
82 
88  void setDefaultWidgetType( const QString &widgetType );
89 
94  QString defaultWidgetType() const;
95 
96  private:
97 
98  QMap<QString, QgsAbstractRelationEditorWidgetFactory *> mRelationWidgetFactories;
99 
100  QString mDefaultWidgetType;
101 };
102 
103 #endif // QGSRELATIONWIDGETREGISTRY_H
This class should be subclassed for every configurable relation widget type.
Factory class for creating relation widgets and their corresponding config widgets.
Base class to build new relation widgets.
Keeps track of the registered relations widgets.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48