QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsfielddomainsitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfielddomainsitem.h
3  -------------------
4  begin : 2022-01-27
5  copyright : (C) 2022 Nyall Dawson
6  email : nyall dot dawson at gmail dot com
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 #ifndef QGSFIELDDOMAINSITEM_H
18 #define QGSFIELDDOMAINSITEM_H
19 
20 #include "qgis_sip.h"
21 #include "qgis_core.h"
22 #include "qgsdataitem.h"
24 #include "qgsfield.h"
25 
31 class CORE_EXPORT QgsFieldDomainsItem : public QgsDataItem
32 {
33  Q_OBJECT
34 
35  public:
36 
47  const QString &path,
48  const QString &connectionUri,
49  const QString &providerKey );
50 
51  ~QgsFieldDomainsItem() override;
52 
53 #ifdef SIP_RUN
54  SIP_PYOBJECT __repr__();
55  % MethodCode
56  QString str = QStringLiteral( "<QgsFieldDomainsItem: %1>" ).arg( sipCpp->path() );
57  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
58  % End
59 #endif
60 
61  QVector<QgsDataItem *> createChildren() override;
62 
63  QIcon icon() override;
64 
68  QString connectionUri() const;
69 
70  private:
71 
72  QString mConnectionUri;
73  QStringList mFieldDomainNames;
74 
75 };
76 
77 
83 class CORE_EXPORT QgsFieldDomainItem : public QgsDataItem
84 {
85  Q_OBJECT
86  public:
87 
96  QgsFieldDomain *domain SIP_TRANSFER );
97 
98  ~QgsFieldDomainItem() override;
99 
100 #ifdef SIP_RUN
101  SIP_PYOBJECT __repr__();
102  % MethodCode
103  QString str = QStringLiteral( "<QgsFieldDomainItem: %1>" ).arg( sipCpp->name() );
104  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
105  % End
106 #endif
107 
108  QIcon icon() override;
109 
113  const QgsFieldDomain *fieldDomain();
114 
115  private:
116 
117  std::unique_ptr< QgsFieldDomain > mDomain;
118 
119 };
120 
121 #endif // QGSFIELDDOMAINSITEM_H
122 
123 
QgsDataItem::icon
virtual QIcon icon()
Definition: qgsdataitem.cpp:162
qgsdataitem.h
QgsFieldDomainsItem
Contains a collection of field domain items.
Definition: qgsfielddomainsitem.h:31
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
str
#define str(x)
Definition: qgis.cpp:37
QgsFieldDomainItem
A browser item representing a field domain.
Definition: qgsfielddomainsitem.h:83
qgsfield.h
QgsFieldDomain
Base class for field domains.
Definition: qgsfielddomain.h:33
QgsDataItem
Base class for all items in the model.
Definition: qgsdataitem.h:45
qgsabstractdatabaseproviderconnection.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsDataItem::createChildren
virtual QVector< QgsDataItem * > createChildren()
Create children.
Definition: qgsdataitem.cpp:184