QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | Friends | List of all members
QgsRelationReferenceWidget Class Reference

#include <qgsrelationreferencewidget.h>

Inheritance diagram for QgsRelationReferenceWidget:
Inheritance graph
[legend]

Public Types

enum  CanvasExtent { Fixed , Pan , Scale }
 

Public Slots

void deleteForeignKeys ()
 unset the currently related feature More...
 
void mapIdentification ()
 activate the map tool to select a new related feature on the map More...
 
void openForm ()
 open the form of the related feature in a new dialog More...
 

Signals

Q_DECL_DEPRECATED void foreignKeyChanged (const QVariant &)
 Emitted when the foreign key changed. More...
 
void foreignKeysChanged (const QVariantList &)
 Emitted when the foreign keys changed. More...
 

Public Member Functions

 QgsRelationReferenceWidget (QWidget *parent)
 
 ~QgsRelationReferenceWidget () override
 
bool allowAddFeatures () const
 Determines if a button for adding new features should be shown. More...
 
bool allowMapIdentification ()
 determines if the widget offers the possibility to select the related feature on the map (using a dedicated map tool) More...
 
bool chainFilters () const
 Determines if the filters are chained. More...
 
bool embedForm ()
 determines if the form of the related feature will be shown More...
 
QString filterExpression () const
 Returns the currently set filter expression. More...
 
Q_DECL_DEPRECATED QVariant foreignKey () const
 returns the related feature foreign key More...
 
QVariantList foreignKeys () const
 returns the related feature foreign key More...
 
bool openFormButtonVisible ()
 determines the open form button is visible in the widget More...
 
bool orderByValue ()
 If the widget will order the combobox entries by value. More...
 
bool readOnlySelector ()
 determines if the drop-down is enabled More...
 
QgsFeature referencedFeature () const
 Returns the related feature (from the referenced layer) if no feature is related, it returns an invalid feature. More...
 
QString referencedLayerDataSource () const
 Returns the public data source of the referenced layer. More...
 
QString referencedLayerId () const
 Returns the id of the referenced layer. More...
 
QString referencedLayerName () const
 Returns the name of the referenced layer. More...
 
QString referencedLayerProviderKey () const
 Returns the data provider key of the referenced layer. More...
 
QgsRelation relation () const
 Returns the current relation, which might be invalid. More...
 
void setAllowAddFeatures (bool allowAddFeatures)
 Determines if a button for adding new features should be shown. More...
 
void setAllowMapIdentification (bool allowMapIdentification)
 
void setChainFilters (bool chainFilters)
 Set if filters are chained. More...
 
void setEditorContext (const QgsAttributeEditorContext &context, QgsMapCanvas *canvas, QgsMessageBar *messageBar)
 Sets the editor context. More...
 
void setEmbedForm (bool display)
 
void setFilterExpression (const QString &filterExpression)
 If not empty, will be used as filter expression. More...
 
void setFilterFields (const QStringList &filterFields)
 Sets the fields for which filter comboboxes will be created. More...
 
Q_DECL_DEPRECATED void setForeignKey (const QVariant &value)
 this sets the related feature using from the foreign key More...
 
void setForeignKeys (const QVariantList &values)
 Sets the related feature using the foreign keys. More...
 
void setFormFeature (const QgsFeature &formFeature)
 Set the current form feature (from the referencing layer) More...
 
void setOpenFormButtonVisible (bool openFormButtonVisible)
 
void setOrderByValue (bool orderByValue)
 Sets if the widget will order the combobox entries by value. More...
 
void setReadOnlySelector (bool readOnly)
 
void setReferencedLayerDataSource (const QString &referencedLayerDataSource)
 Set the public data source of the referenced layer to referencedLayerDataSource. More...
 
void setReferencedLayerId (const QString &referencedLayerId)
 Set the id of the referenced layer to referencedLayerId. More...
 
void setReferencedLayerName (const QString &referencedLayerName)
 Set the name of the referenced layer to referencedLayerName. More...
 
void setReferencedLayerProviderKey (const QString &referencedLayerProviderKey)
 Set the data provider key of the referenced layer to referencedLayerProviderKey. More...
 
void setRelation (const QgsRelation &relation, bool allowNullValue)
 
void setRelationEditable (bool editable)
 
void showIndeterminateState ()
 Sets the widget to display in an indeterminate "mixed value" state. More...
 

Protected Member Functions

void init ()
 
void showEvent (QShowEvent *e) override
 

Properties

bool openFormButtonVisible
 

Friends

class TestQgsRelationReferenceWidget
 

Detailed Description

Definition at line 57 of file qgsrelationreferencewidget.h.

Member Enumeration Documentation

◆ CanvasExtent

Enumerator
Fixed 
Pan 
Scale 

Definition at line 74 of file qgsrelationreferencewidget.h.

Constructor & Destructor Documentation

◆ QgsRelationReferenceWidget()

QgsRelationReferenceWidget::QgsRelationReferenceWidget ( QWidget *  parent)
explicit

Definition at line 64 of file qgsrelationreferencewidget.cpp.

◆ ~QgsRelationReferenceWidget()

QgsRelationReferenceWidget::~QgsRelationReferenceWidget ( )
override

Definition at line 164 of file qgsrelationreferencewidget.cpp.

Member Function Documentation

◆ allowAddFeatures()

bool QgsRelationReferenceWidget::allowAddFeatures ( ) const

Determines if a button for adding new features should be shown.

Since
QGIS 2.16

Definition at line 650 of file qgsrelationreferencewidget.cpp.

◆ allowMapIdentification()

bool QgsRelationReferenceWidget::allowMapIdentification ( )
inline

determines if the widget offers the possibility to select the related feature on the map (using a dedicated map tool)

Definition at line 131 of file qgsrelationreferencewidget.h.

◆ chainFilters()

bool QgsRelationReferenceWidget::chainFilters ( ) const
inline

Determines if the filters are chained.

Returns
true if filters are chained

Definition at line 150 of file qgsrelationreferencewidget.h.

◆ deleteForeignKeys

void QgsRelationReferenceWidget::deleteForeignKeys ( )
slot

unset the currently related feature

Definition at line 285 of file qgsrelationreferencewidget.cpp.

◆ embedForm()

bool QgsRelationReferenceWidget::embedForm ( )
inline

determines if the form of the related feature will be shown

Definition at line 123 of file qgsrelationreferencewidget.h.

◆ filterExpression()

QString QgsRelationReferenceWidget::filterExpression ( ) const
inline

Returns the currently set filter expression.

Definition at line 163 of file qgsrelationreferencewidget.h.

◆ foreignKey()

QVariant QgsRelationReferenceWidget::foreignKey ( ) const

returns the related feature foreign key

Deprecated:
since QGIS 3.10

Definition at line 319 of file qgsrelationreferencewidget.cpp.

◆ foreignKeyChanged

Q_DECL_DEPRECATED void QgsRelationReferenceWidget::foreignKeyChanged ( const QVariant &  )
signal

Emitted when the foreign key changed.

Deprecated:
since QGIS 3.10

◆ foreignKeys()

QVariantList QgsRelationReferenceWidget::foreignKeys ( ) const

returns the related feature foreign key

Returns the related feature foreign keys

Since
QGIS 3.10

Definition at line 328 of file qgsrelationreferencewidget.cpp.

◆ foreignKeysChanged

void QgsRelationReferenceWidget::foreignKeysChanged ( const QVariantList &  )
signal

Emitted when the foreign keys changed.

Since
QGIS 3.10

◆ init()

void QgsRelationReferenceWidget::init ( )
protected

Definition at line 411 of file qgsrelationreferencewidget.cpp.

◆ mapIdentification

void QgsRelationReferenceWidget::mapIdentification ( )
slot

activate the map tool to select a new related feature on the map

Definition at line 606 of file qgsrelationreferencewidget.cpp.

◆ openForm

void QgsRelationReferenceWidget::openForm ( )
slot

open the form of the related feature in a new dialog

Definition at line 531 of file qgsrelationreferencewidget.cpp.

◆ openFormButtonVisible()

bool QgsRelationReferenceWidget::openFormButtonVisible ( )
inline

determines the open form button is visible in the widget

Definition at line 142 of file qgsrelationreferencewidget.h.

◆ orderByValue()

bool QgsRelationReferenceWidget::orderByValue ( )
inline

If the widget will order the combobox entries by value.

Definition at line 135 of file qgsrelationreferencewidget.h.

◆ readOnlySelector()

bool QgsRelationReferenceWidget::readOnlySelector ( )
inline

determines if the drop-down is enabled

Definition at line 127 of file qgsrelationreferencewidget.h.

◆ referencedFeature()

QgsFeature QgsRelationReferenceWidget::referencedFeature ( ) const

Returns the related feature (from the referenced layer) if no feature is related, it returns an invalid feature.

Definition at line 302 of file qgsrelationreferencewidget.cpp.

◆ referencedLayerDataSource()

QString QgsRelationReferenceWidget::referencedLayerDataSource ( ) const

Returns the public data source of the referenced layer.

Since
QGIS 3.12

Definition at line 999 of file qgsrelationreferencewidget.cpp.

◆ referencedLayerId()

QString QgsRelationReferenceWidget::referencedLayerId ( ) const

Returns the id of the referenced layer.

Since
QGIS 3.12

Definition at line 979 of file qgsrelationreferencewidget.cpp.

◆ referencedLayerName()

QString QgsRelationReferenceWidget::referencedLayerName ( ) const

Returns the name of the referenced layer.

Since
QGIS 3.12

Definition at line 969 of file qgsrelationreferencewidget.cpp.

◆ referencedLayerProviderKey()

QString QgsRelationReferenceWidget::referencedLayerProviderKey ( ) const

Returns the data provider key of the referenced layer.

Since
QGIS 3.12

Definition at line 989 of file qgsrelationreferencewidget.cpp.

◆ relation()

QgsRelation QgsRelationReferenceWidget::relation ( ) const

Returns the current relation, which might be invalid.

Since
QGIS 3.10

Definition at line 661 of file qgsrelationreferencewidget.cpp.

◆ setAllowAddFeatures()

void QgsRelationReferenceWidget::setAllowAddFeatures ( bool  allowAddFeatures)

Determines if a button for adding new features should be shown.

Since
QGIS 2.16

Definition at line 655 of file qgsrelationreferencewidget.cpp.

◆ setAllowMapIdentification()

void QgsRelationReferenceWidget::setAllowMapIdentification ( bool  allowMapIdentification)

Definition at line 369 of file qgsrelationreferencewidget.cpp.

◆ setChainFilters()

void QgsRelationReferenceWidget::setChainFilters ( bool  chainFilters)

Set if filters are chained.

Chained filters restrict the option of subsequent filters based on the selection of a previous filter.

Parameters
chainFiltersIf chaining should be enabled

Definition at line 392 of file qgsrelationreferencewidget.cpp.

◆ setEditorContext()

void QgsRelationReferenceWidget::setEditorContext ( const QgsAttributeEditorContext context,
QgsMapCanvas canvas,
QgsMessageBar messageBar 
)

Sets the editor context.

Note
if context cadDockWidget is null, it won't be possible to digitize the geometry of a referenced feature from this widget

Definition at line 333 of file qgsrelationreferencewidget.cpp.

◆ setEmbedForm()

void QgsRelationReferenceWidget::setEmbedForm ( bool  display)

Definition at line 350 of file qgsrelationreferencewidget.cpp.

◆ setFilterExpression()

void QgsRelationReferenceWidget::setFilterExpression ( const QString &  filterExpression)

If not empty, will be used as filter expression.

Only if this evaluates to true, the value will be shown.

Definition at line 397 of file qgsrelationreferencewidget.cpp.

◆ setFilterFields()

void QgsRelationReferenceWidget::setFilterFields ( const QStringList &  filterFields)

Sets the fields for which filter comboboxes will be created.

Definition at line 381 of file qgsrelationreferencewidget.cpp.

◆ setForeignKey()

void QgsRelationReferenceWidget::setForeignKey ( const QVariant &  value)

this sets the related feature using from the foreign key

Deprecated:
since QGIS 3.10 use setForeignKeys

Definition at line 239 of file qgsrelationreferencewidget.cpp.

◆ setForeignKeys()

void QgsRelationReferenceWidget::setForeignKeys ( const QVariantList &  values)

Sets the related feature using the foreign keys.

Since
QGIS 3.10

Definition at line 244 of file qgsrelationreferencewidget.cpp.

◆ setFormFeature()

void QgsRelationReferenceWidget::setFormFeature ( const QgsFeature formFeature)

Set the current form feature (from the referencing layer)

Since
QGIS 3.10

Definition at line 1010 of file qgsrelationreferencewidget.cpp.

◆ setOpenFormButtonVisible()

void QgsRelationReferenceWidget::setOpenFormButtonVisible ( bool  openFormButtonVisible)

Definition at line 386 of file qgsrelationreferencewidget.cpp.

◆ setOrderByValue()

void QgsRelationReferenceWidget::setOrderByValue ( bool  orderByValue)

Sets if the widget will order the combobox entries by value.

Definition at line 376 of file qgsrelationreferencewidget.cpp.

◆ setReadOnlySelector()

void QgsRelationReferenceWidget::setReadOnlySelector ( bool  readOnly)

Definition at line 362 of file qgsrelationreferencewidget.cpp.

◆ setReferencedLayerDataSource()

void QgsRelationReferenceWidget::setReferencedLayerDataSource ( const QString &  referencedLayerDataSource)

Set the public data source of the referenced layer to referencedLayerDataSource.

Since
QGIS 3.12

Definition at line 1004 of file qgsrelationreferencewidget.cpp.

◆ setReferencedLayerId()

void QgsRelationReferenceWidget::setReferencedLayerId ( const QString &  referencedLayerId)

Set the id of the referenced layer to referencedLayerId.

Since
QGIS 3.12

Definition at line 984 of file qgsrelationreferencewidget.cpp.

◆ setReferencedLayerName()

void QgsRelationReferenceWidget::setReferencedLayerName ( const QString &  referencedLayerName)

Set the name of the referenced layer to referencedLayerName.

Since
QGIS 3.12

Definition at line 974 of file qgsrelationreferencewidget.cpp.

◆ setReferencedLayerProviderKey()

void QgsRelationReferenceWidget::setReferencedLayerProviderKey ( const QString &  referencedLayerProviderKey)

Set the data provider key of the referenced layer to referencedLayerProviderKey.

Since
QGIS 3.12

Definition at line 994 of file qgsrelationreferencewidget.cpp.

◆ setRelation()

void QgsRelationReferenceWidget::setRelation ( const QgsRelation relation,
bool  allowNullValue 
)

Definition at line 170 of file qgsrelationreferencewidget.cpp.

◆ setRelationEditable()

void QgsRelationReferenceWidget::setRelationEditable ( bool  editable)

Definition at line 224 of file qgsrelationreferencewidget.cpp.

◆ showEvent()

void QgsRelationReferenceWidget::showEvent ( QShowEvent *  e)
overrideprotected

Definition at line 402 of file qgsrelationreferencewidget.cpp.

◆ showIndeterminateState()

void QgsRelationReferenceWidget::showIndeterminateState ( )

Sets the widget to display in an indeterminate "mixed value" state.

Since
QGIS 2.16

Definition at line 312 of file qgsrelationreferencewidget.cpp.

Friends And Related Function Documentation

◆ TestQgsRelationReferenceWidget

friend class TestQgsRelationReferenceWidget
friend

Definition at line 366 of file qgsrelationreferencewidget.h.

Property Documentation

◆ openFormButtonVisible

bool QgsRelationReferenceWidget::openFormButtonVisible
readwrite

Definition at line 57 of file qgsrelationreferencewidget.h.


The documentation for this class was generated from the following files: