Skip to content

Class MapLayerModel

ClassList > MapLayerModel

A project map layers model within filtering capabilities.

  • #include <maplayermodel.h>

Inherits the following classes: QSortFilterProxyModel

Public Types

Type Name
enum Role

Public Properties

Type Name
property bool enabled
property Qgis::LayerFilters filters
The map layer filters.
property QgsProject * project
The project from which map layers will be taken from.
property bool requiresTrackingAvailability
The tracking availability requirement filter.
property TrackingModel * trackingModel
The tracking model against which map layers' tracking availability will be checked against.

Public Signals

Type Name
signal void enabledChanged
signal void filtersChanged
signal void projectChanged
signal void requiresTrackingAvailabilityChanged
signal void trackingModelChanged

Public Functions

Type Name
MapLayerModel (QObject * parent=nullptr)
The constructor.
bool enabled () const
bool filterAcceptsRow (int sourceRow, const QModelIndex & sourceParent) override const
Qgis::LayerFilters filters () const
The map layer filters.
Q_INVOKABLE int findLayer (QgsMapLayer * layer) const
Q_INVOKABLE QVariantMap get (int row) const
bool lessThan (const QModelIndex & left, const QModelIndex & right) override const
QgsProject * project () const
The project from which map layers will be taken from.
bool requiresTrackingAvailability () const
The tracking availability requirement filter.
void setEnabled (bool enabled)
void setFilters (Qgis::LayerFilters filters)
The map layer filters.
void setProject (QgsProject * project)
The project from which map layers will be taken from.
void setRequiresTrackingAvailability (bool requiresTrackingAvailability)
The tracking availability requirement filter.
void setTrackingModel (TrackingModel * trackingModel)
The tracking model against which map layers' tracking availability will be checked against.
TrackingModel * trackingModel () const
The tracking model against which map layers' tracking availability will be checked against.

Public Types Documentation

enum Role

enum MapLayerModel::Role {
    IdRole = Qt::UserRole + 1,
    NameRole,
    LayerRole,
    LayerTypeRole,
    GeometryTypeRole
};

Public Properties Documentation

property enabled [1/2]

bool MapLayerModel::enabled;

The enabled state of the model.

Note:

When disabled, any changes to the project's map layers registry will be ignored


property filters [1/2]

The map layer filters.

Qgis::LayerFilters MapLayerModel::filters;

property project [1/2]

The project from which map layers will be taken from.

QgsProject * MapLayerModel::project;

property requiresTrackingAvailability [1/2]

The tracking availability requirement filter.

bool MapLayerModel::requiresTrackingAvailability;

property trackingModel [1/2]

The tracking model against which map layers' tracking availability will be checked against.

TrackingModel * MapLayerModel::trackingModel;

Public Signals Documentation

signal enabledChanged

void MapLayerModel::enabledChanged;

signal filtersChanged

void MapLayerModel::filtersChanged;

signal projectChanged

void MapLayerModel::projectChanged;

signal requiresTrackingAvailabilityChanged

void MapLayerModel::requiresTrackingAvailabilityChanged;

signal trackingModelChanged

void MapLayerModel::trackingModelChanged;

Public Functions Documentation

function MapLayerModel

The constructor.

explicit MapLayerModel::MapLayerModel (
    QObject * parent=nullptr
) 

function enabled [2/2]

bool MapLayerModel::enabled () const

The enabled state of the model.

Note:

When disabled, any changes to the project's map layers registry will be ignored


function filterAcceptsRow

bool MapLayerModel::filterAcceptsRow (
    int sourceRow,
    const QModelIndex & sourceParent
) override const

function filters [2/2]

The map layer filters.

inline Qgis::LayerFilters MapLayerModel::filters () const

function findLayer

Q_INVOKABLE int MapLayerModel::findLayer (
    QgsMapLayer * layer
) const

Returns the model row for given map layer.

Note:

If the map layer is not found, -1 will be returned


function get

Q_INVOKABLE QVariantMap MapLayerModel::get (
    int row
) const

Returns a model data map for a given row.


function lessThan

bool MapLayerModel::lessThan (
    const QModelIndex & left,
    const QModelIndex & right
) override const

function project [2/2]

The project from which map layers will be taken from.

QgsProject * MapLayerModel::project () const

function requiresTrackingAvailability [2/2]

The tracking availability requirement filter.

inline bool MapLayerModel::requiresTrackingAvailability () const

function setEnabled

void MapLayerModel::setEnabled (
    bool enabled
) 

The enabled state of the model.

Note:

When disabled, any changes to the project's map layers registry will be ignored


function setFilters

The map layer filters.

void MapLayerModel::setFilters (
    Qgis::LayerFilters filters
) 

function setProject

The project from which map layers will be taken from.

void MapLayerModel::setProject (
    QgsProject * project
) 

function setRequiresTrackingAvailability

The tracking availability requirement filter.

void MapLayerModel::setRequiresTrackingAvailability (
    bool requiresTrackingAvailability
) 

function setTrackingModel

The tracking model against which map layers' tracking availability will be checked against.

void MapLayerModel::setTrackingModel (
    TrackingModel * trackingModel
) 

function trackingModel [2/2]

The tracking model against which map layers' tracking availability will be checked against.

TrackingModel * MapLayerModel::trackingModel () const


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