19#include "moc_qgsdatacollectionitem.cpp"
27#include <QRegularExpression>
32 const QString &providerKey )
33 :
QgsDataItem(
Qgis::BrowserItemType::Collection, parent, name, path, providerKey )
36 mIconName = QStringLiteral(
"/mIconDbSchema.svg" );
48 QgsDebugMsgLevel( QStringLiteral(
"delete child = 0x%0" ).arg(
static_cast<qlonglong
>( i ), 8, 16, QLatin1Char(
'0' ) ), 2 );
61 return fillColor.isValid() || strokeColor.isValid()
68 return fillColor.isValid() || strokeColor.isValid()
83 const QString connectionName {
name() };
88 if ( md->findConnection( connectionName ) )
96 const QString databaseFilePath {
path().
remove( QRegularExpression( R
"re([\aZ]{2,}://)re" ) ) };
98 if ( QFile::exists( databaseFilePath ) )
113 return fillColor.isValid() || strokeColor.isValid()
The Qgis class provides global constants for use throughout the application.
@ Fertile
Can create children. Even items without this capability may have children, but cannot create them,...
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
virtual void remove(const QString &name) const =0
Deletes the connection from the settings.
static QgsDataItemProviderRegistry * dataItemProviderRegistry()
Returns the application's data item provider registry, which keeps a list of data item providers that...
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QIcon homeDirIcon(const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Shared home directory icon.
QgsDataCollectionItem(QgsDataItem *parent, const QString &name, const QString &path=QString(), const QString &providerKey=QString())
Constructor for QgsDataCollectionItem, with the specified parent item.
static QIcon iconDir(const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Returns the standard browser directory icon.
static QIcon openDirIcon(const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Shared open directory icon.
~QgsDataCollectionItem() override
QgsAbstractDatabaseProviderConnection * databaseConnection() const override
For data items that represent a DB connection or one of its children, this method returns a connectio...
static QIcon iconDataCollection()
Returns the standard browser data collection icon.
QString dataProviderKey(const QString &dataItemProviderName)
Returns the (possibly blank) data provider key for a given data item provider name.
Base class for all items in the model.
QVector< QgsDataItem * > mChildren
Qgis::BrowserItemCapabilities mCapabilities
QString name() const
Returns the name of the item (the displayed text for the item).
QString providerKey() const
Returns the provider key that created this item (e.g.
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 QgsDebugMsgLevel(str, level)