QGIS API Documentation 3.41.0-Master (d5b93354e9c)
|
A QSortFilterProxyModel subclass for filtering and sorting browser model items. More...
#include <qgsbrowserproxymodel.h>
Public Types | |
enum | FilterSyntax { Normal , Wildcards , RegularExpression } |
Filter syntax options. More... | |
Public Member Functions | |
QgsBrowserProxyModel (QObject *parent=nullptr) | |
Constructor for QgsBrowserProxyModel, with the specified parent object. | |
QgsBrowserModel * | browserModel () |
Returns the underlying browser model. | |
Qt::CaseSensitivity | caseSensitivity () const |
Returns whether item filtering is case sensitive. | |
QgsDataItem * | dataItem (const QModelIndex &index) const |
Returns the data item at the specified proxy index, or nullptr if no item exists at the index. | |
bool | filterByLayerType () const |
Returns true if the model is filtered by map layer type. | |
QString | filterString () const |
Returns the filter string used when filtering items in the model. | |
FilterSyntax | filterSyntax () const |
Returns the filter syntax. | |
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const override |
Qgis::LayerType | layerType () const |
Returns the layer type to filter the model by. | |
void | setBrowserModel (QgsBrowserModel *model) |
Sets the underlying browser model. | |
void | setFilterByLayerType (bool enabled) |
Sets whether the model is filtered by map layer type. | |
void | setFilterCaseSensitivity (Qt::CaseSensitivity sensitivity) |
Sets whether item filtering should be case sensitive. | |
void | setFilterString (const QString &filter) |
Sets the filter string to use when filtering items in the model. | |
void | setFilterSyntax (FilterSyntax syntax) |
Sets the filter syntax. | |
void | setHiddenDataItemProviderKeyFilter (const QStringList &hiddenItemsFilter) |
Sets a filter to hide data items based on QgsDataItem::providerKey() associated with the item. | |
void | setLayerType (Qgis::LayerType type) |
Sets the layer type to filter the model by. | |
void | setShowLayers (bool showLayers) |
Sets show layers to showLayers. | |
void | setShownDataItemProviderKeyFilter (const QStringList &shownItemsFilter) |
Sets a filter to show data items based on QgsDataItem::providerKey() associated with the item. | |
bool | showLayers () const |
Returns true if layers must be shown, this flag is TRUE by default. | |
Protected Member Functions | |
bool | filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override |
Protected Attributes | |
QgsBrowserModel * | mModel = nullptr |
Reference to associated browser model. | |
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
Definition at line 32 of file qgsbrowserproxymodel.h.
Filter syntax options.
Enumerator | |
---|---|
Normal | Standard string filtering. |
Wildcards | Wildcard filtering. |
RegularExpression | Regular expression filtering. |
Definition at line 38 of file qgsbrowserproxymodel.h.
|
explicit |
Constructor for QgsBrowserProxyModel, with the specified parent object.
Definition at line 24 of file qgsbrowserproxymodel.cpp.
|
inline |
Returns the underlying browser model.
Definition at line 62 of file qgsbrowserproxymodel.h.
Qt::CaseSensitivity QgsBrowserProxyModel::caseSensitivity | ( | ) | const |
Returns whether item filtering is case sensitive.
Definition at line 77 of file qgsbrowserproxymodel.cpp.
QgsDataItem * QgsBrowserProxyModel::dataItem | ( | const QModelIndex & | index | ) | const |
Returns the data item at the specified proxy index, or nullptr
if no item exists at the index.
Definition at line 39 of file qgsbrowserproxymodel.cpp.
|
overrideprotected |
Definition at line 130 of file qgsbrowserproxymodel.cpp.
|
inline |
Returns true
if the model is filtered by map layer type.
Definition at line 118 of file qgsbrowserproxymodel.h.
QString QgsBrowserProxyModel::filterString | ( | ) | const |
Returns the filter string used when filtering items in the model.
Definition at line 66 of file qgsbrowserproxymodel.cpp.
QgsBrowserProxyModel::FilterSyntax QgsBrowserProxyModel::filterSyntax | ( | ) | const |
Returns the filter syntax.
Definition at line 53 of file qgsbrowserproxymodel.cpp.
|
override |
Definition at line 279 of file qgsbrowserproxymodel.cpp.
Qgis::LayerType QgsBrowserProxyModel::layerType | ( | ) | const |
Returns the layer type to filter the model by.
This is only used if filterByLayerType() is true
.
Definition at line 161 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setBrowserModel | ( | QgsBrowserModel * | model | ) |
Sets the underlying browser model.
Definition at line 33 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setFilterByLayerType | ( | bool | enabled | ) |
Sets whether the model is filtered by map layer type.
Definition at line 172 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setFilterCaseSensitivity | ( | Qt::CaseSensitivity | sensitivity | ) |
Sets whether item filtering should be case sensitive.
Definition at line 71 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setFilterString | ( | const QString & | filter | ) |
Sets the filter string to use when filtering items in the model.
Definition at line 58 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setFilterSyntax | ( | FilterSyntax | syntax | ) |
Sets the filter syntax.
Definition at line 45 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setHiddenDataItemProviderKeyFilter | ( | const QStringList & | hiddenItemsFilter | ) |
Sets a filter to hide data items based on QgsDataItem::providerKey() associated with the item.
By default browser model shows all items from all available data item providers and few special items (e.g. Favorites). To customize the behavior, set the filter to not load certain data items. The items that are not based on data item providers have prefix "special:", for example "special:Favorites", "special:Home", "PostGIS", "MSSQL"
All items created by the providers listed in filter are hidden from the layer tree. This filter is always evaluated.
hiddenItemsFilter | a list of data provider prefixes that will be hidden. |
Definition at line 266 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setLayerType | ( | Qgis::LayerType | type | ) |
Sets the layer type to filter the model by.
This is only used if filterByLayerType() is true
.
Definition at line 166 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setShowLayers | ( | bool | showLayers | ) |
Sets show layers to showLayers.
Definition at line 156 of file qgsbrowserproxymodel.cpp.
void QgsBrowserProxyModel::setShownDataItemProviderKeyFilter | ( | const QStringList & | shownItemsFilter | ) |
Sets a filter to show data items based on QgsDataItem::providerKey() associated with the item.
By default browser model shows all items from all available data item providers and few special items (e.g. Favorites). To customize the behavior, set the filter to load only certain data items. The items that are not based on data item providers have prefix "special:", for example "special:Favorites", "special:Home", "PostGIS", "MSSQL"
Only the items created by the providers listed in filter are shown in the layer tree. This filter is always evaluated.
shownItemsFilter | a list of data provider prefixes that will be hidden. |
Definition at line 272 of file qgsbrowserproxymodel.cpp.
bool QgsBrowserProxyModel::showLayers | ( | ) | const |
Returns true
if layers must be shown, this flag is TRUE by default.
Definition at line 151 of file qgsbrowserproxymodel.cpp.
|
protected |
Reference to associated browser model.
Definition at line 206 of file qgsbrowserproxymodel.h.