19#include "moc_qgsfielddomainsitem.cpp"
28 const QString &connectionUri,
29 const QString &providerKey )
30 :
QgsDataItem(
Qgis::BrowserItemType::Custom, parent, tr(
"Field Domains" ), path, providerKey )
31 , mConnectionUri( connectionUri )
50 QStringList fieldDomains;
57 domainError = ex.
what();
60 for (
const QString &
name : std::as_const( fieldDomains ) )
64 std::unique_ptr< QgsFieldDomain > domain( conn->fieldDomain(
name ) );
66 children.push_back( fieldDomainItem );
74 if ( !domainError.isEmpty() )
95 return mConnectionUri;
103 :
QgsDataItem(
Qgis::BrowserItemType::Custom, parent, domain->name(), parent->path() +
'/' + domain->name(), parent->providerKey() )
114 switch ( mDomain->type() )
128 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.
@ 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...
@ RetrieveFieldDomain
Can retrieve field domain details from provider via fieldDomain()
virtual QStringList fieldDomainNames() const
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