19#include "moc_qgsrelationshipsitem.cpp"
28 const QString &connectionUri,
29 const QString &providerKey,
const QString &schema,
const QString &tableName )
30 :
QgsDataItem(
Qgis::BrowserItemType::Custom, parent, tr(
"Relationships" ), path, providerKey )
31 , mConnectionUri( connectionUri )
33 , mTableName( tableName )
51 QString relationError;
52 QList< QgsWeakRelation > relations;
59 relationError = ex.
what();
67 children.push_back( relationshipItem );
75 if ( !relationError.isEmpty() )
96 return mConnectionUri;
104 :
QgsDataItem(
Qgis::BrowserItemType::Custom, parent, relation.name(), parent->path() +
'/' + relation.name(), parent->providerKey() )
105 , mRelation( relation )
The Qgis class provides global constants for use throughout the application.
@ Populated
Children created.
@ Collapse
The collapse/expand status for this items children should be ignored in order to avoid undesired netw...
@ Fertile
Can create children. Even items without this capability may have children, but cannot create them,...
@ RefreshChildrenWhenItemIsRefreshed
When the item is refreshed, all its populated children will also be refreshed in turn.
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
virtual QList< QgsWeakRelation > relationships(const QString &schema=QString(), const QString &tableName=QString()) const
Returns a list of relationships detected in the database.
@ RetrieveRelationships
Can retrieve relationships from the database.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Base class for all items in the model.
void setToolTip(const QString &msg)
QVector< QgsDataItem * > children() const
Qgis::BrowserItemCapabilities mCapabilities
virtual void setState(Qgis::BrowserItemState state)
Set item state.
QgsDataItem * parent() const
Gets item parent.
QString providerKey() const
Returns the provider key that created this item (e.g.
Data item that can be used to report problems (e.g.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Custom exception class for provider connection related exceptions.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
QgsProviderMetadata * providerMetadata(const QString &providerKey) const
Returns metadata of the provider or nullptr if not found.
A browser item representing a relationship.
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
Contains a collection of relationship items.
~QgsRelationshipsItem() override
QString connectionUri() const
Returns the connection URI.
QVector< QgsDataItem * > createChildren() override
Create children.
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.
The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields...
QString name() const
Returns the relationship's name.