QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
30 const QString &connectionUri,
31 const QString &providerKey )
32 :
QgsDataItem(
Qgis::BrowserItemType::Custom, parent, tr(
"Field Domains" ), path, providerKey )
33 , mConnectionUri( connectionUri )
49 if ( conn && ( conn->capabilities() & QgsAbstractDatabaseProviderConnection::Capability::RetrieveFieldDomain ) )
52 QStringList fieldDomains;
59 domainError = ex.
what();
62 for (
const QString &
name : std::as_const( fieldDomains ) )
66 std::unique_ptr< QgsFieldDomain > domain( conn->fieldDomain(
name ) );
68 children.push_back( fieldDomainItem );
76 if ( !domainError.isEmpty() )
97 return mConnectionUri;
105 :
QgsDataItem(
Qgis::BrowserItemType::Custom, parent, domain->name(), parent->path() +
'/' + domain->name(), parent->providerKey() )
116 switch ( mDomain->type() )
130 return mDomain.get();
@ Glob
Glob string pattern field domain.
const QgsFieldDomain * fieldDomain()
Returns the associated field domain.
QString name() const
Returns the name of the field domain.
QVector< QgsDataItem * > createChildren() override
Create children.
void setToolTip(const QString &msg)
QString name() const
Returns the name of the item (the displayed text for the item).
Qgis::BrowserItemCapabilities mCapabilities
~QgsFieldDomainsItem() override
~QgsFieldDomainItem() override
@ Collapse
The collapse/expand status for this items children should be ignored in order to avoid undesired netw...
QgsDataItem * parent() const
Gets item parent.
Contains a collection of field domain items.
@ RefreshChildrenWhenItemIsRefreshed
When the item is refreshed, all its populated children will also be refreshed in turn (since QGIS 3....
@ Populated
Children created.
QString connectionUri() const
Returns the connection URI.
virtual void setState(Qgis::BrowserItemState state)
Set item state.
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).
#define BUILTIN_UNREACHABLE
virtual QStringList fieldDomainNames() const SIP_THROW(QgsProviderConnectionException)
Returns a list of field domain names present on the provider.
QgsProviderMetadata * providerMetadata(const QString &providerKey) const
Returns metadata of the provider or nullptr if not found.
Custom exception class for provider connection related exceptions.
Data item that can be used to report problems (e.g. network error)
@ Range
Numeric range field domain (min/max)
A browser item representing a field domain.
QVector< QgsDataItem * > children() const
QString description() const
Returns the description of the field domain.
The Qgis class provides global constants for use throughout the application.
Base class for field domains.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
QString providerKey() const
Returns the provider key that created this item (e.g.
QgsFieldDomainItem(QgsDataItem *parent, QgsFieldDomain *domain)
Constructor for QgsFieldDomainItem, with the specified parent item and domain.
Base class for all items in the model.
QgsFieldDomainsItem(QgsDataItem *parent, const QString &path, const QString &connectionUri, const QString &providerKey)
Constructor for QgsFieldDomainsItem, with the specified parent item.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
@ Fertile
Can create children. Even items without this capability may have children, but cannot create them,...
@ Coded
Coded field domain.