QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
24 : QAbstractItemModel( parent )
32 for (
int i =
mSublayers.count() - 1; i >= 0; --i )
36 beginRemoveRows( QModelIndex(), i, i );
97 return createIndex( row, column );
101 return QModelIndex();
109 return QModelIndex();
133 if ( !
index.isValid() )
145 case Qt::DisplayRole:
146 case Qt::ToolTipRole:
152 return details.
name();
155 switch ( details.
type() )
162 count = tr(
"Uncounted" );
167 return QStringLiteral(
"%1 - %2 (%3)" ).arg( details.
description(),
171 return QStringLiteral(
"%2 (%3)" ).arg(
189 return details.
name();
193 case Qt::DecorationRole:
195 if (
index.column() == 0 )
210 return static_cast< int >( details.
type() );
213 return details.
uri();
216 return details.
name();
222 return details.
path();
237 return static_cast< int >( details.
flags() );
249 case Qt::DisplayRole:
250 case Qt::ToolTipRole:
256 return details.
name();
263 case Qt::DecorationRole:
265 if (
index.column() == 0 )
266 return details.
icon();
275 return details.
uri();
278 return details.
name();
284 return details.
type();
294 switch ( orientation )
302 case Qt::DisplayRole:
303 case Qt::ToolTipRole:
305 switch (
static_cast< Column>( section ) )
310 return tr(
"Description" );
353 mDescription = description;
378 return mType == other.mType
379 && mName == other.mName
380 && mDescription == other.mDescription
381 && mUri == other.mUri;
386 return !( *
this == other );
394 : QSortFilterProxyModel(
parent )
396 setDynamicSortFilter(
true );
402 const QModelIndex sourceIndex = sourceModel()->index( source_row, 0, source_parent );
407 if ( mFilterString.trimmed().isEmpty() )
417 if ( wkbTypeVariant.isValid() )
432 if ( leftIsNonLayer && !rightIsNonLayer )
434 else if ( rightIsNonLayer && !leftIsNonLayer )
440 return QString::localeAwareCompare( leftName, rightName ) < 0;
445 return mIncludeSystemTables;
450 mIncludeSystemTables = include;
456 return mFilterString;
461 mFilterString = filter;
@ UnknownCount
Provider returned an unknown feature count.
QString name() const
Returns the item's name.
static QString displayString(Type type) SIP_HOLDGIL
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
@ MeshLayer
Mesh layer. Added in QGIS 3.2.
@ VectorLayer
Vector layer.
bool operator==(const QgsProviderSublayerModel::NonLayerItem &other) const
QList< QgsProviderSublayerDetails > sublayerDetails() const
Returns the sublayer details shown in the model.
QString uri() const
Returns the layer's URI.
QList< NonLayerItem > mNonLayerItems
Non layer item list.
@ GeometryColumnName
Geometry column name (for vector sublayers)
@ IsNonLayerItem
true if item is a non-sublayer item (e.g. an embedded project)
@ AnnotationLayer
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
QStringList path() const
Returns the path to the sublayer.
QgsProviderSublayerModel::NonLayerItem indexToNonLayerItem(const QModelIndex &index) const
Returns the non layer item corresponding to the given index.
QList< QgsProviderSublayerDetails > mSublayers
Sublayer list.
Type
The WKB type describes the number of dimensions a geometry has.
void setFilterString(const QString &filter)
Sets the filter string used for filtering items in the model.
static QIcon iconForLayerType(QgsMapLayerType type)
Returns the default icon for the specified layer type.
bool operator!=(const QgsProviderSublayerModel::NonLayerItem &other) const
bool includeSystemTables() const
Returns true if system and internal tables will be shown in the model.
@ ProviderKey
Provider key.
QString uri() const
Returns the item's URI.
long long featureCount() const
Returns the layer's feature count.
QgsProviderSublayerModel(QObject *parent=nullptr)
Constructor for QgsProviderSublayerModel, with the specified parent object.
@ WkbType
WKB geometry type (for vector sublayers)
@ GroupLayer
Composite group layer. Added in QGIS 3.24.
QString filterString() const
Returns the filter string used for filtering items in the model.
void setUri(const QString &uri)
Set the item's uri.
@ RasterLayer
Raster layer.
@ NonLayerItemType
Item type (for non-sublayer items)
@ Description
Layer description.
QString providerKey() const
Returns the associated data provider key.
Contains details about a sub layer available from a dataset.
int rowCount(const QModelIndex &parent) const override
Contains details for a non-sublayer item to include in a QgsProviderSublayerModel.
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override
QString type() const
Returns the item's type.
void addNonLayerItem(const QgsProviderSublayerModel::NonLayerItem &item)
Adds a non-layer item (e.g.
QIcon icon() const
Returns the item's icon.
QString name() const
Returns the layer's name.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QString geometryColumnName() const
Returns the layer's geometry column name, or an empty string if not applicable.
QString description() const
Returns the item's description.
QVariant data(const QModelIndex &index, int role) const override
@ Description
Layer description.
QgsProviderSublayerProxyModel(QObject *parent=nullptr)
Constructor for QgsProviderSublayerProxyModel, with the specified parent object.
QgsProviderSublayerDetails indexToSublayer(const QModelIndex &index) const
Returns the sublayer corresponding to the given index.
void setType(const QString &type)
Sets the item's type.
int layerNumber() const
Returns the associated layer number, for providers which order sublayers.
void setDescription(const QString &description)
Sets the item's description.
static QIcon iconForWkbType(QgsWkbTypes::Type type)
Returns the icon for a vector layer whose geometry type is provided.
@ FeatureCount
Feature count (for vector sublayers)
@ VectorTileLayer
Vector tile layer. Added in QGIS 3.14.
void setName(const QString &name)
Sets the item's name.
QgsMapLayerType type() const
Returns the layer type.
QgsWkbTypes::Type wkbType() const
Returns the layer's WKB type, or QgsWkbTypes::Unknown if the WKB type is not application or unknown.
@ Uncounted
Feature count not yet computed.
@ SystemTable
Sublayer is a system or internal table, which should be hidden by default.
void setIncludeSystemTables(bool include)
Sets whether system and internal tables will be shown in the model.
QString description() const
Returns the layer's description.
@ LayerNumber
Layer number.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void setIcon(const QIcon &icon)
Sets the item's icon.
@ PointCloudLayer
Point cloud layer. Added in QGIS 3.18.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
void setSublayerDetails(const QList< QgsProviderSublayerDetails > &details)
Sets the sublayer details to show in the model.
QModelIndex parent(const QModelIndex &index) const override
@ PluginLayer
Plugin based layer.
Qgis::SublayerFlags flags() const
Returns the layer's flags, which indicate properties of the layer.