QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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_core.h"
21#include "qgis_sip.h"
22#include "qgsdataitem.h"
23#include "qgsweakrelation.h"
24
25#include <QString>
26
27using namespace Qt::StringLiterals;
28
34class CORE_EXPORT QgsRelationshipsItem : public QgsDataItem
35{
36 Q_OBJECT
37
38 public:
52 QgsDataItem *parent SIP_TRANSFERTHIS, const QString &path, const QString &connectionUri, const QString &providerKey, const QString &schema = QString(), const QString &tableName = QString()
53 );
54
56
57#ifdef SIP_RUN
58 // clang-format off
59 SIP_PYOBJECT __repr__();
60 % MethodCode
61 QString str = u"<QgsRelationshipsItem: %1>"_s.arg( sipCpp->path() );
62 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
63 % End
64// clang-format on
65#endif
66
67 QVector<QgsDataItem *> createChildren() override;
68
69 QIcon icon() override;
70
74 QString connectionUri() const;
75
81 QString schema() const { return mSchema; }
82
88 QString tableName() const { return mTableName; }
89
90 private:
91 QString mConnectionUri;
92 QString mSchema;
93 QString mTableName;
94 QStringList mRelationshipNames;
95};
96
97
103class CORE_EXPORT QgsRelationshipItem : public QgsDataItem
104{
105 Q_OBJECT
106 public:
113
115
116#ifdef SIP_RUN
117 // clang-format off
118 SIP_PYOBJECT __repr__();
119 % MethodCode
120 QString str = u"<QgsRelationshipItem: %1>"_s.arg( sipCpp->name() );
121 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
122 % End
123// clang-format on
124#endif
125
126 QIcon icon() override;
127
131 const QgsWeakRelation &relation() const;
132
133 private:
134 QgsWeakRelation mRelation;
135};
136
137#endif // QGSRELATIONSHIPSITEM_H
QgsDataItem(Qgis::BrowserItemType type, QgsDataItem *parent, const QString &name, const QString &path, const QString &providerKey=QString())
Constructor for QgsDataItem, with the specified parent item.
virtual QVector< QgsDataItem * > createChildren()
Create children.
QString path() const
virtual QIcon icon()
QgsDataItem * parent() const
Gets item parent.
QString providerKey() const
Returns the provider key that created this item (e.g.
QgsRelationshipItem(QgsDataItem *parent, const QgsWeakRelation &relation)
Constructor for QgsRelationshipItem, with the specified parent item and relation.
const QgsWeakRelation & relation() const
Returns the associated relationship.
~QgsRelationshipItem() override
~QgsRelationshipsItem() override
QString connectionUri() const
Returns the connection URI.
QgsRelationshipsItem(QgsDataItem *parent, const QString &path, const QString &connectionUri, const QString &providerKey, const QString &schema=QString(), const QString &tableName=QString())
Constructor for QgsRelationshipsItem, with the specified parent item.
QString tableName() const
Returns the table name for filtering relationships, if set.
QString schema() const
Returns the schema for filtering relationships, if set.
Represent a QgsRelation with possibly unresolved layers or unmatched fields.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52