27 const QString &connectionUri,
28 const QString &providerKey )
29 :
QgsDataItem(
Qgis::BrowserItemType::Custom, parent, tr(
"Field Domains" ), path, providerKey )
30 , mConnectionUri( connectionUri )
46 if ( conn && ( conn->capabilities() & QgsAbstractDatabaseProviderConnection::Capability::RetrieveFieldDomain ) )
49 QStringList fieldDomains;
56 domainError = ex.
what();
59 for (
const QString &
name : std::as_const( fieldDomains ) )
63 std::unique_ptr< QgsFieldDomain > domain( conn->fieldDomain(
name ) );
65 children.push_back( fieldDomainItem );
73 if ( !domainError.isEmpty() )
94 return mConnectionUri;
102 :
QgsDataItem(
Qgis::BrowserItemType::Custom, parent, domain->name(), parent->path() +
'/' + domain->name(), parent->providerKey() )
113 switch ( mDomain->type() )
127 return mDomain.get();
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 (since QGIS 3....
@ Coded
Coded field domain.
@ Range
Numeric range field domain (min/max)
@ Glob
Glob string pattern field domain.
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
virtual QStringList fieldDomainNames() const SIP_THROW(QgsProviderConnectionException)
Returns a list of field domain names present on the provider.
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
QString name() const
Returns the name of the item (the displayed text for the item).
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.
A browser item representing a field domain.
const QgsFieldDomain * fieldDomain()
Returns the associated field domain.
~QgsFieldDomainItem() override
QgsFieldDomainItem(QgsDataItem *parent, QgsFieldDomain *domain)
Constructor for QgsFieldDomainItem, with the specified parent item and domain.
Base class for field domains.
QString name() const
Returns the name of the field domain.
QString description() const
Returns the description of the field domain.
Contains a collection of field domain items.
QgsFieldDomainsItem(QgsDataItem *parent, const QString &path, const QString &connectionUri, const QString &providerKey)
Constructor for QgsFieldDomainsItem, with the specified parent item.
QVector< QgsDataItem * > createChildren() override
Create children.
~QgsFieldDomainsItem() override
QString connectionUri() const
Returns the connection URI.
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.
#define BUILTIN_UNREACHABLE