Skip to content

Class QfReferencingFeatureListModelBase

ClassList > QfReferencingFeatureListModelBase

Inherits the following classes: QAbstractItemModel

Inherited by the following classes: QfOrderedRelationModel

Public Types

Type Name
enum ReferencedFeatureListRoles

Public Properties

Type Name
property int attachmentDocumentViewer
property QString attachmentFieldName
property QString attachmentStorageAuthConfigId
property QString attachmentStorageType
property QString attachmentStorageUrl
property QString currentNmRelationId
property QString currentRelationId
property QgsFeature feature
property bool isLoading
property QgsRelation nmRelation
property bool parentPrimariesAvailable
property QgsRelation relation

Public Signals

Type Name
signal void attachmentDetailsChanged
signal void attributeFormModelChanged
signal void beforeModelUpdated
signal void featureChanged
signal void isLoadingChanged
signal void modelUpdated
signal void nmRelationChanged
signal void parentPrimariesAvailableChanged
signal void relationChanged

Public Functions

Type Name
QfReferencingFeatureListModelBase (QObject * parent=nullptr)
int attachmentDocumentViewer () const
QString attachmentFieldName () const
QString attachmentStorageAuthConfigId () const
QString attachmentStorageType () const
QString attachmentStorageUrl () const
int columnCount (const QModelIndex & parent=QModelIndex()) override const
QString currentNmRelationId () const
On many-to-many relations returns the second relation id connecting the children in the association table to their other parent.
QString currentRelationId () const
Returns the id of the relation connecting the parent feature with the children in this model.
QVariant data (const QModelIndex & index, int role=Qt::DisplayRole) override const
Q_INVOKABLE bool deleteFeature (QgsFeatureId referencingFeatureId)
QgsFeature feature () const
Q_INVOKABLE int getFeatureIdRow (QgsFeatureId featureId)
QModelIndex index (int row, int column, const QModelIndex & parent=QModelIndex()) override const
bool isLoading () const
QgsRelation nmRelation () const
QModelIndex parent (const QModelIndex & index) override const
bool parentPrimariesAvailable () const
QgsRelation relation () const
Q_INVOKABLE void reload ()
QHash< int, QByteArray > roleNames () override const
int rowCount (const QModelIndex & parent=QModelIndex()) override const
void setCurrentNmRelationId (const QString & nmRelationId)
On many-to-many relations sets the second relation connecting the children in the association table to their other parent.
void setCurrentRelationId (const QString & relationId)
Sets the relation connecting the parent feature with the children in this model.
void setFeature (const QgsFeature & feature)
void setNmRelation (const QgsRelation & relation)
void setParentPrimariesAvailable (const bool parentPrimariesAvailable)
void setRelation (const QgsRelation & relation)

Public Types Documentation

enum ReferencedFeatureListRoles

enum QfReferencingFeatureListModelBase::ReferencedFeatureListRoles {
    DisplayString = Qt::UserRole,
    ReferencingFeature,
    NmReferencedFeature,
    NmDisplayString,
    AttachmentPath
};

Public Properties Documentation

property attachmentDocumentViewer [1/2]

int QfReferencingFeatureListModelBase::attachmentDocumentViewer;

property attachmentFieldName [1/2]

QString QfReferencingFeatureListModelBase::attachmentFieldName;

property attachmentStorageAuthConfigId [1/2]

QString QfReferencingFeatureListModelBase::attachmentStorageAuthConfigId;

property attachmentStorageType [1/2]

QString QfReferencingFeatureListModelBase::attachmentStorageType;

property attachmentStorageUrl [1/2]

QString QfReferencingFeatureListModelBase::attachmentStorageUrl;

property currentNmRelationId [1/2]

QString QfReferencingFeatureListModelBase::currentNmRelationId;

property currentRelationId [1/2]

QString QfReferencingFeatureListModelBase::currentRelationId;

property feature [1/2]

QgsFeature QfReferencingFeatureListModelBase::feature;

property isLoading [1/2]

bool QfReferencingFeatureListModelBase::isLoading;

property nmRelation [1/2]

QgsRelation QfReferencingFeatureListModelBase::nmRelation;

property parentPrimariesAvailable [1/2]

bool QfReferencingFeatureListModelBase::parentPrimariesAvailable;

property relation [1/2]

QgsRelation QfReferencingFeatureListModelBase::relation;

Public Signals Documentation

signal attachmentDetailsChanged

void QfReferencingFeatureListModelBase::attachmentDetailsChanged;

signal attributeFormModelChanged

void QfReferencingFeatureListModelBase::attributeFormModelChanged;

signal beforeModelUpdated

void QfReferencingFeatureListModelBase::beforeModelUpdated;

signal featureChanged

void QfReferencingFeatureListModelBase::featureChanged;

signal isLoadingChanged

void QfReferencingFeatureListModelBase::isLoadingChanged;

signal modelUpdated

void QfReferencingFeatureListModelBase::modelUpdated;

signal nmRelationChanged

void QfReferencingFeatureListModelBase::nmRelationChanged;

signal parentPrimariesAvailableChanged

void QfReferencingFeatureListModelBase::parentPrimariesAvailableChanged;

signal relationChanged

void QfReferencingFeatureListModelBase::relationChanged;

Public Functions Documentation

function QfReferencingFeatureListModelBase

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

function attachmentDocumentViewer [2/2]

int QfReferencingFeatureListModelBase::attachmentDocumentViewer () const

Returns the document viewer type of the first ExternalResource field found on the referencing layer. The value corresponds to the "DocumentViewer" configuration entry of the editor widget setup (0 = file, 1 = image, 3 = audio, 4 = video). Returns 0 if no ExternalResource field exists.

See also: QgsExternalResourceWidget::DocumentViewerContent in https://github.com/qgis/QGIS/blob/6ca6cf1bab8e017355f7631115cf48bc3c6a4601/src/gui/qgsexternalresourcewidget.h#L72-L79


function attachmentFieldName [2/2]

QString QfReferencingFeatureListModelBase::attachmentFieldName () const

Returns the field name of the first ExternalResource field found on the referencing layer, or an empty string if no such field exists. The value is cached when the relation is set.


function attachmentStorageAuthConfigId [2/2]

QString QfReferencingFeatureListModelBase::attachmentStorageAuthConfigId () const

Returns the authentication configuration ID for the external storage configured on the attachment field, or an empty string if none is set.


function attachmentStorageType [2/2]

QString QfReferencingFeatureListModelBase::attachmentStorageType () const

Returns the external storage type configured on the attachment field (e.g. "WebDAV"), or an empty string if none is set.


function attachmentStorageUrl [2/2]

QString QfReferencingFeatureListModelBase::attachmentStorageUrl () const

Returns the external storage URL configured on the attachment field (e.g. "https://server.com/remote.php/dav/files/user/"), or an empty string if none is set.


function columnCount

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

function currentNmRelationId [2/2]

On many-to-many relations returns the second relation id connecting the children in the association table to their other parent.

QString QfReferencingFeatureListModelBase::currentNmRelationId () const


function currentRelationId [2/2]

Returns the id of the relation connecting the parent feature with the children in this model.

QString QfReferencingFeatureListModelBase::currentRelationId () const


function data

QVariant QfReferencingFeatureListModelBase::data (
    const QModelIndex & index,
    int role=Qt::DisplayRole
) override const

function deleteFeature

Q_INVOKABLE bool QfReferencingFeatureListModelBase::deleteFeature (
    QgsFeatureId referencingFeatureId
) 

Deletes a feature regarding the referencing layer and the feature id of the selected child

Parameters:

  • referencingFeatureId id of the selected child

function feature [2/2]

QgsFeature QfReferencingFeatureListModelBase::feature () const

The parent feature for which this model contains the children

Returns:

the parent feature

See also: setFeature


function getFeatureIdRow

Q_INVOKABLE int QfReferencingFeatureListModelBase::getFeatureIdRow (
    QgsFeatureId featureId
) 

Returns the row number for a given feature id

Parameters:

  • featureId the feature id

function index

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

function isLoading [2/2]

bool QfReferencingFeatureListModelBase::isLoading () const

Indicator if the model is currently performing any feature iteration in the background.


function nmRelation [2/2]

QgsRelation QfReferencingFeatureListModelBase::nmRelation () const

On many-to-many relations this is the second relation connecting the children in the associationtable to their other parent

Returns:

associated relation

See also: setNmRelation


function parent

QModelIndex QfReferencingFeatureListModelBase::parent (
    const QModelIndex & index
) override const

function parentPrimariesAvailable [2/2]

bool QfReferencingFeatureListModelBase::parentPrimariesAvailable () const

The status if the pk of the parent feature (this feature) are valid (not null) It's needed to check on opening a form to add a new child

Returns:

parentPrimariesAvailable The status if the parent pks are available

See also: setParentPrimariesAvailable


function relation [2/2]

QgsRelation QfReferencingFeatureListModelBase::relation () const

The relation connecting the parent feature with the children in this model

Returns:

relation

See also: setRelation


function reload

Q_INVOKABLE void QfReferencingFeatureListModelBase::reload () 

Reloads the model by starting the reload functionality in the gatherer (seperate thread) Sets the property parentPrimariesAvailable


function roleNames

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

function rowCount

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

function setCurrentNmRelationId

On many-to-many relations sets the second relation connecting the children in the association table to their other parent.

void QfReferencingFeatureListModelBase::setCurrentNmRelationId (
    const QString & nmRelationId
) 


function setCurrentRelationId

Sets the relation connecting the parent feature with the children in this model.

void QfReferencingFeatureListModelBase::setCurrentRelationId (
    const QString & relationId
) 


function setFeature

void QfReferencingFeatureListModelBase::setFeature (
    const QgsFeature & feature
) 

The parent feature for which this model contains the children

Parameters:

  • feature

See also: feature


function setNmRelation

void QfReferencingFeatureListModelBase::setNmRelation (
    const QgsRelation & relation
) 

On many-to-many relations this is the second relation connecting the children in the associationtable to their other parent

Parameters:

  • relation The associated relation

See also: nmRelation


function setParentPrimariesAvailable

void QfReferencingFeatureListModelBase::setParentPrimariesAvailable (
    const bool parentPrimariesAvailable
) 

The status if the pk of the parent feature (this feature) are valid (not null)

Parameters:

  • parentPrimariesAvailable The status if the parent pks are available

See also: parentPrimariesAvailable


function setRelation

void QfReferencingFeatureListModelBase::setRelation (
    const QgsRelation & relation
) 

The relation connecting the parent feature with the children in this model

Parameters:

  • relation

See also: relation



The documentation for this class was generated from the following file src/gui/qfreferencingfeaturelistmodel.h