Skip to content

Class FlatLayerTreeModelBase

ClassList > FlatLayerTreeModelBase

Inherits the following classes: QAbstractProxyModel

Public Signals

Type Name
signal void isFrozenChanged
signal void isTemporalChanged
signal void layersAdded
signal void layersRemoved
signal void mapThemeChanged

Public Functions

Type Name
FlatLayerTreeModelBase (QgsLayerTree * layerTree, QgsProject * project, QObject * parent=nullptr)
int columnCount (const QModelIndex & parent=QModelIndex()) override const
QVariant data (const QModelIndex & index, int role) override const
Q_INVOKABLE void freeze ()
Freezes the model as is, with any source model signals ignored.
QModelIndex index (int row, int column, const QModelIndex & parent=QModelIndex()) override const
bool isFrozen () const
Returns TRUE if the model is frozen.
bool isTemporal () const
Returns whether the current layer tree has temporal awareness.
QgsLayerTree * layerTree () const
QgsLayerTreeModel * layerTreeModel () const
QModelIndex mapFromSource (const QModelIndex & sourceIndex) override const
QString mapTheme () const
QModelIndex mapToSource (const QModelIndex & proxyIndex) override const
Q_INVOKABLE QgsRectangle nodeExtent (const QModelIndex & index, QgsQuickMapSettings * mapSettings, const float buffer)
Calculate layer tree node extent and add optional buffer.
QModelIndex parent (const QModelIndex & child) override const
QgsProject * project () const
QHash< int, QByteArray > roleNames () override const
int rowCount (const QModelIndex & parent=QModelIndex()) override const
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)
void setSourceModel (QAbstractItemModel * sourceModel) override
Q_INVOKABLE void unfreeze (bool resetModel=false)
Unfreezes the model and resume listening to source model signals.
Q_INVOKABLE void updateCurrentMapTheme ()

Public Signals Documentation

signal isFrozenChanged

void FlatLayerTreeModelBase::isFrozenChanged;

signal isTemporalChanged

void FlatLayerTreeModelBase::isTemporalChanged;

signal layersAdded

void FlatLayerTreeModelBase::layersAdded;

signal layersRemoved

void FlatLayerTreeModelBase::layersRemoved;

signal mapThemeChanged

void FlatLayerTreeModelBase::mapThemeChanged;

Public Functions Documentation

function FlatLayerTreeModelBase

explicit FlatLayerTreeModelBase::FlatLayerTreeModelBase (
    QgsLayerTree * layerTree,
    QgsProject * project,
    QObject * parent=nullptr
) 

function columnCount

int FlatLayerTreeModelBase::columnCount (
    const QModelIndex & parent=QModelIndex()
) override const

function data

QVariant FlatLayerTreeModelBase::data (
    const QModelIndex & index,
    int role
) override const

function freeze

Freezes the model as is, with any source model signals ignored.

Q_INVOKABLE void FlatLayerTreeModelBase::freeze () 

function index

QModelIndex FlatLayerTreeModelBase::index (
    int row,
    int column,
    const QModelIndex & parent=QModelIndex()
) override const

function isFrozen

Returns TRUE if the model is frozen.

bool FlatLayerTreeModelBase::isFrozen () const

function isTemporal

Returns whether the current layer tree has temporal awareness.

inline bool FlatLayerTreeModelBase::isTemporal () const

function layerTree

QgsLayerTree * FlatLayerTreeModelBase::layerTree () const

function layerTreeModel

QgsLayerTreeModel * FlatLayerTreeModelBase::layerTreeModel () const

function mapFromSource

QModelIndex FlatLayerTreeModelBase::mapFromSource (
    const QModelIndex & sourceIndex
) override const

function mapTheme

QString FlatLayerTreeModelBase::mapTheme () const

function mapToSource

QModelIndex FlatLayerTreeModelBase::mapToSource (
    const QModelIndex & proxyIndex
) override const

function nodeExtent

Calculate layer tree node extent and add optional buffer.

Q_INVOKABLE QgsRectangle FlatLayerTreeModelBase::nodeExtent (
    const QModelIndex & index,
    QgsQuickMapSettings * mapSettings,
    const float buffer
) 

function parent

QModelIndex FlatLayerTreeModelBase::parent (
    const QModelIndex & child
) override const

function project

QgsProject * FlatLayerTreeModelBase::project () const

function roleNames

QHash< int, QByteArray > FlatLayerTreeModelBase::roleNames () override const

function rowCount

int FlatLayerTreeModelBase::rowCount (
    const QModelIndex & parent=QModelIndex()
) override const

function setData

bool FlatLayerTreeModelBase::setData (
    const QModelIndex & index,
    const QVariant & value,
    int role
) override

function setLayerInTracking

Sets the information if the nodeLayer is currently in__tracking state.

void FlatLayerTreeModelBase::setLayerInTracking (
    QgsLayerTreeLayer * nodeLayer,
    bool tracking
) 

function setMapTheme

void FlatLayerTreeModelBase::setMapTheme (
    const QString & mapTheme
) 

function setSourceModel

void FlatLayerTreeModelBase::setSourceModel (
    QAbstractItemModel * sourceModel
) override

function unfreeze

Unfreezes the model and resume listening to source model signals.

Q_INVOKABLE void FlatLayerTreeModelBase::unfreeze (
    bool resetModel=false
) 

function updateCurrentMapTheme

Q_INVOKABLE void FlatLayerTreeModelBase::updateCurrentMapTheme () 

Update map theme as currently used by the model This should be triggered after a project has been loaded



The documentation for this class was generated from the following file src/core/layertreemodel.h