QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsrelationshipsitem.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrelationshipsitem.h
3 -------------------
4 begin : 2022-07-28
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 QGSRELATIONSHIPSITEM_H
18#define QGSRELATIONSHIPSITEM_H
19
20#include "qgis_sip.h"
21#include "qgis_core.h"
22#include "qgsdataitem.h"
23#include "qgsweakrelation.h"
24
30class CORE_EXPORT QgsRelationshipsItem : public QgsDataItem
31{
32 Q_OBJECT
33
34 public:
35
49 const QString &path,
50 const QString &connectionUri,
51 const QString &providerKey,
52 const QString &schema = QString(),
53 const QString &tableName = QString() );
54
56
57#ifdef SIP_RUN
58 SIP_PYOBJECT __repr__();
59 % MethodCode
60 QString str = QStringLiteral( "<QgsRelationshipsItem: %1>" ).arg( sipCpp->path() );
61 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
62 % End
63#endif
64
65 QVector<QgsDataItem *> createChildren() override;
66
67 QIcon icon() override;
68
72 QString connectionUri() const;
73
79 QString schema() const { return mSchema; }
80
86 QString tableName() const {return mTableName;}
87
88 private:
89
90 QString mConnectionUri;
91 QString mSchema;
92 QString mTableName;
93 QStringList mRelationshipNames;
94
95};
96
97
103class CORE_EXPORT QgsRelationshipItem : public QgsDataItem
104{
105 Q_OBJECT
106 public:
107
114 const QgsWeakRelation &relation );
115
117
118#ifdef SIP_RUN
119 SIP_PYOBJECT __repr__();
120 % MethodCode
121 QString str = QStringLiteral( "<QgsRelationshipItem: %1>" ).arg( sipCpp->name() );
122 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
123 % End
124#endif
125
126 QIcon icon() override;
127
131 const QgsWeakRelation &relation() const;
132
133 private:
134
135 QgsWeakRelation mRelation;
136
137};
138
139#endif // QGSRELATIONSHIPSITEM_H
140
141
Base class for all items in the model.
Definition qgsdataitem.h:46
virtual QVector< QgsDataItem * > createChildren()
Create children.
virtual QIcon icon()
A browser item representing a relationship.
~QgsRelationshipItem() override
Contains a collection of relationship items.
~QgsRelationshipsItem() override
QString tableName() const
Returns the table name for filtering relationships, if set.
QString schema() const
Returns the schema for filtering relationships, if set.
The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields...
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53