QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
A model for representing the sublayers present in a URI. More...
#include <qgsprovidersublayermodel.h>
Classes | |
class | NonLayerItem |
Contains details for a non-sublayer item to include in a QgsProviderSublayerModel. More... | |
Public Types | |
enum class | Column : int { Name = 0 , Description = 1 } |
Model columns. More... | |
enum class | Role : int { ProviderKey = Qt::UserRole + 1 , LayerType , Uri , Name , Description , Path , FeatureCount , WkbType , GeometryColumnName , LayerNumber , IsNonLayerItem , NonLayerItemType , Flags } |
Custom model roles. More... | |
Public Member Functions | |
QgsProviderSublayerModel (QObject *parent=nullptr) | |
Constructor for QgsProviderSublayerModel, with the specified parent object. More... | |
void | addNonLayerItem (const QgsProviderSublayerModel::NonLayerItem &item) |
Adds a non-layer item (e.g. More... | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QVariant | data (const QModelIndex &index, int role) const override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QgsProviderSublayerModel::NonLayerItem | indexToNonLayerItem (const QModelIndex &index) const |
Returns the non layer item corresponding to the given index. More... | |
QgsProviderSublayerDetails | indexToSublayer (const QModelIndex &index) const |
Returns the sublayer corresponding to the given index. More... | |
QModelIndex | parent (const QModelIndex &index) const override |
int | rowCount (const QModelIndex &parent) const override |
void | setSublayerDetails (const QList< QgsProviderSublayerDetails > &details) |
Sets the sublayer details to show in the model. More... | |
QList< QgsProviderSublayerDetails > | sublayerDetails () const |
Returns the sublayer details shown in the model. More... | |
Protected Attributes | |
std::unique_ptr< QgsProviderSublayerModelGroup > | mRootNode |
QList< QgsProviderSublayerDetails > | mSublayers |
Sublayer list. More... | |
A model for representing the sublayers present in a URI.
QgsProviderSublayerModel is designed to present a tree view of the sublayers available for a URI, including any vector, raster or mesh sublayers present.
Additionally, QgsProviderSublayerModel can include some non-sublayer items, e.g. in order to represent other content available for a URI, such as embedded project items. The non-sublayer items can be added by calling addNonLayerItem().
Definition at line 54 of file qgsprovidersublayermodel.h.
|
strong |
Model columns.
Enumerator | |
---|---|
Name | Layer name. |
Description | Layer description. |
Definition at line 79 of file qgsprovidersublayermodel.h.
|
strong |
Custom model roles.
Definition at line 61 of file qgsprovidersublayermodel.h.
QgsProviderSublayerModel::QgsProviderSublayerModel | ( | QObject * | parent = nullptr | ) |
Constructor for QgsProviderSublayerModel, with the specified parent object.
Definition at line 348 of file qgsprovidersublayermodel.cpp.
void QgsProviderSublayerModel::addNonLayerItem | ( | const QgsProviderSublayerModel::NonLayerItem & | item | ) |
Adds a non-layer item (e.g.
an embedded QGIS project item) to the model.
Definition at line 423 of file qgsprovidersublayermodel.cpp.
|
override |
Definition at line 462 of file qgsprovidersublayermodel.cpp.
|
override |
Definition at line 495 of file qgsprovidersublayermodel.cpp.
|
override |
Definition at line 477 of file qgsprovidersublayermodel.cpp.
|
override |
Definition at line 508 of file qgsprovidersublayermodel.cpp.
|
override |
Definition at line 430 of file qgsprovidersublayermodel.cpp.
QgsProviderSublayerModel::NonLayerItem QgsProviderSublayerModel::indexToNonLayerItem | ( | const QModelIndex & | index | ) | const |
Returns the non layer item corresponding to the given index.
Definition at line 415 of file qgsprovidersublayermodel.cpp.
QgsProviderSublayerDetails QgsProviderSublayerModel::indexToSublayer | ( | const QModelIndex & | index | ) | const |
Returns the sublayer corresponding to the given index.
Definition at line 407 of file qgsprovidersublayermodel.cpp.
|
override |
Definition at line 446 of file qgsprovidersublayermodel.cpp.
|
override |
Definition at line 468 of file qgsprovidersublayermodel.cpp.
void QgsProviderSublayerModel::setSublayerDetails | ( | const QList< QgsProviderSublayerDetails > & | details | ) |
Sets the sublayer details to show in the model.
Definition at line 355 of file qgsprovidersublayermodel.cpp.
QList< QgsProviderSublayerDetails > QgsProviderSublayerModel::sublayerDetails | ( | ) | const |
Returns the sublayer details shown in the model.
Definition at line 402 of file qgsprovidersublayermodel.cpp.
|
protected |
Definition at line 233 of file qgsprovidersublayermodel.h.
|
protected |
Sublayer list.
Definition at line 231 of file qgsprovidersublayermodel.h.