Class FlatLayerTreeModel
ClassList > FlatLayerTreeModel
Inherits the following classes: QSortFilterProxyModel
Public Types
| Type | Name |
|---|---|
| enum | Roles |
| enum | Types |
Public Properties
| Type | Name |
|---|---|
| property bool | isFrozen |
| property bool | isTemporal |
| property QString | mapTheme |
Public Signals
| Type | Name |
|---|---|
| signal void | isFrozenChanged |
| signal void | isTemporalChanged |
| signal void | layersAdded |
| signal void | layersRemoved |
| signal void | mapThemeChanged |
Public Functions
| Type | Name |
|---|---|
| FlatLayerTreeModel (QgsLayerTree * layerTree, QgsProject * project, QObject * parent=nullptr) |
|
| Q_INVOKABLE QVariant | data (const QModelIndex & index, int role) override const |
| Q_INVOKABLE void | freeze () Freezes the model as is, with any source model signals ignored. |
| bool | isFrozen () const Returns TRUE if the model is frozen. |
| bool | isTemporal () const |
| QgsLayerTree * | layerTree () const |
| QgsLayerTreeModel * | layerTreeModel () const |
| QString | mapTheme () const |
| Q_INVOKABLE QgsRectangle | nodeExtent (const QModelIndex & index, QgsQuickMapSettings * mapSettings, const float buffer=0.02) Calculate layer tree node extent. |
| QgsProject * | project () const |
| Q_INVOKABLE bool | setData (const QModelIndex & index, const QVariant & value, int role) override |
| void | setLayerInTracking (QgsLayerTreeLayer * nodeLayer, bool tracking) Sets the information if the nodeLayer is currently in__tracking state. |
| void | setMapTheme (const QString & mapTheme) |
| Q_INVOKABLE void | unfreeze (bool resetModel=false) Unfreezes the model and resume listening to source model signals. |
| Q_INVOKABLE void | updateCurrentMapTheme () |
Protected Functions
| Type | Name |
|---|---|
| virtual bool | filterAcceptsRow (int source_row, const QModelIndex & source_parent) override const |
Public Types Documentation
enum Roles
enum FlatLayerTreeModel::Roles {
VectorLayerPointer = Qt::UserRole + 1,
MapLayerPointer,
HasSpatialExtent,
LegendImage,
Type,
Name,
Visible,
Trackable,
InTracking,
ReadOnly,
FeatureAdditionLocked,
AttributeEditingLocked,
GeometryEditingLocked,
FeatureDeletionLocked,
TreeLevel,
LayerType,
IsValid,
FeatureCount,
IsCollapsed,
IsParentCollapsed,
HasChildren,
CanReloadData,
HasLabels,
LabelsVisible,
Opacity,
FilterExpression,
Credits,
SnappingEnabled,
HasNotes,
Notes,
Checkable
};
enum Types
enum FlatLayerTreeModel::Types {
Layer,
Group,
Image,
Legend
};
Public Properties Documentation
property isFrozen [1/2]
bool FlatLayerTreeModel::isFrozen;
property isTemporal [1/2]
bool FlatLayerTreeModel::isTemporal;
property mapTheme [1/2]
QString FlatLayerTreeModel::mapTheme;
Public Signals Documentation
signal isFrozenChanged
void FlatLayerTreeModel::isFrozenChanged;
signal isTemporalChanged
void FlatLayerTreeModel::isTemporalChanged;
signal layersAdded
void FlatLayerTreeModel::layersAdded;
signal layersRemoved
void FlatLayerTreeModel::layersRemoved;
signal mapThemeChanged
void FlatLayerTreeModel::mapThemeChanged;
Public Functions Documentation
function FlatLayerTreeModel
explicit FlatLayerTreeModel::FlatLayerTreeModel (
QgsLayerTree * layerTree,
QgsProject * project,
QObject * parent=nullptr
)
function data
Q_INVOKABLE QVariant FlatLayerTreeModel::data (
const QModelIndex & index,
int role
) override const
function freeze
Freezes the model as is, with any source model signals ignored.
Q_INVOKABLE void FlatLayerTreeModel::freeze ()
function isFrozen [2/2]
Returns TRUE if the model is frozen.
bool FlatLayerTreeModel::isFrozen () const
function isTemporal [2/2]
bool FlatLayerTreeModel::isTemporal () const
function layerTree
QgsLayerTree * FlatLayerTreeModel::layerTree () const
function layerTreeModel
QgsLayerTreeModel * FlatLayerTreeModel::layerTreeModel () const
function mapTheme [2/2]
QString FlatLayerTreeModel::mapTheme () const
function nodeExtent
Calculate layer tree node extent.
Q_INVOKABLE QgsRectangle FlatLayerTreeModel::nodeExtent (
const QModelIndex & index,
QgsQuickMapSettings * mapSettings,
const float buffer=0.02
)
function project
QgsProject * FlatLayerTreeModel::project () const
function setData
Q_INVOKABLE bool FlatLayerTreeModel::setData (
const QModelIndex & index,
const QVariant & value,
int role
) override
function setLayerInTracking
Sets the information if the nodeLayer is currently in__tracking state.
void FlatLayerTreeModel::setLayerInTracking (
QgsLayerTreeLayer * nodeLayer,
bool tracking
)
function setMapTheme
void FlatLayerTreeModel::setMapTheme (
const QString & mapTheme
)
function unfreeze
Unfreezes the model and resume listening to source model signals.
Q_INVOKABLE void FlatLayerTreeModel::unfreeze (
bool resetModel=false
)
function updateCurrentMapTheme
Q_INVOKABLE void FlatLayerTreeModel::updateCurrentMapTheme ()
Update map theme as currently used by the model This should be triggered after a project has been loaded
Protected Functions Documentation
function filterAcceptsRow
virtual bool FlatLayerTreeModel::filterAcceptsRow (
int source_row,
const QModelIndex & source_parent
) override const
The documentation for this class was generated from the following file src/core/layertreemodel.h