24 #include <QRegularExpression>
29 const QString &providerKey )
30 :
QgsDataItem(
Qgis::BrowserItemType::Collection, parent, name, path, providerKey )
33 mIconName = QStringLiteral(
"/mIconDbSchema.svg" );
45 QgsDebugMsgLevel( QStringLiteral(
"delete child = 0x%0" ).arg(
static_cast<qlonglong
>( i ), 8, 16, QLatin1Char(
'0' ) ), 2 );
58 return fillColor.isValid() || strokeColor.isValid()
65 return fillColor.isValid() || strokeColor.isValid()
80 const QString connectionName {
name() };
85 if ( md->findConnection( connectionName ) )
93 const QString databaseFilePath {
path().remove( QRegularExpression( R
"re([\aZ]{2,}://)re" ) ) };
95 if ( QFile::exists( databaseFilePath ) )
110 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...
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)