QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgsfieldsitem.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfieldsitem.h
3  -------------------
4  begin : 2011-04-01
5  copyright : (C) 2011 Radim Blazek
6  email : radim dot blazek 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 QGSFIELDSITEM_H
18 #define QGSFIELDSITEM_H
19 
20 #include "qgis_sip.h"
21 #include "qgis_core.h"
22 #include "qgsdataitem.h"
24 #include "qgsfield.h"
25 
33 class CORE_EXPORT QgsFieldsItem : public QgsDataItem
34 {
35  Q_OBJECT
36 
37  public:
38 
50  const QString &path,
51  const QString &connectionUri,
52  const QString &providerKey,
53  const QString &schema,
54  const QString &tableName );
55 
56  ~QgsFieldsItem() override;
57 
58 #ifdef SIP_RUN
59  SIP_PYOBJECT __repr__();
60  % MethodCode
61  QString str = QStringLiteral( "<QgsFieldsItem: %1>" ).arg( sipCpp->path() );
62  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
63  % End
64 #endif
65 
66  QVector<QgsDataItem *> createChildren() override;
67 
68  QIcon icon() override;
69 
73  QString schema() const;
74 
78  QString tableName() const;
79 
83  QString connectionUri() const;
84 
88  QgsVectorLayer *layer() SIP_FACTORY;
89 
95 
96  private:
97 
98  QString mSchema;
99  QString mTableName;
100  QString mConnectionUri;
101  std::unique_ptr<QgsAbstractDatabaseProviderConnection::TableProperty> mTableProperty;
102 
103 };
104 
105 
113 class CORE_EXPORT QgsFieldItem : public QgsDataItem
114 {
115  Q_OBJECT
116  public:
117 
123  const QgsField &field );
124 
125  ~QgsFieldItem() override;
126 
127 #ifdef SIP_RUN
128  SIP_PYOBJECT __repr__();
129  % MethodCode
130  QString str = QStringLiteral( "<QgsFieldItem: %1>" ).arg( sipCpp->name() );
131  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
132  % End
133 #endif
134 
135  QIcon icon() override;
136 
137  //QgsField field() const;
138 
139 
140  private:
141 
142  const QgsField mField;
143 
144 };
145 
146 #endif // QGSFIELDSITEM_H
147 
148 
Base class for all items in the model.
Definition: qgsdataitem.h:46
virtual QVector< QgsDataItem * > createChildren()
Create children.
virtual QIcon icon()
A layer field item, information about the connection URI, the schema and the table as well as the lay...
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:51
A collection of field items with some internal logic to retrieve the fields and a the vector layer in...
Definition: qgsfieldsitem.h:34
Represents a vector layer which manages a vector based data sets.
#define str(x)
Definition: qgis.cpp:37
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_FACTORY
Definition: qgis_sip.h:76
const QgsField & field
Definition: qgsfield.h:463
The TableProperty class represents a database table or view.