50 for (
const auto fid : layer->selectedFeatureIds() )
51 if ( mRequest.acceptFeature( layer->getFeature( fid ) ) )
52 mSelectedFeatureIds << fid;
57const QgsFeatureIds &QgsFilteredSelectionManager::selectedFeatureIds()
const
61 return mSelectedFeatureIds;
64int QgsFilteredSelectionManager::selectedFeatureCount()
66 return mSelectedFeatureIds.count();
69void QgsFilteredSelectionManager::onSelectionChanged(
const QgsFeatureIds &selected,
const QgsFeatureIds &deselected,
bool clearAndSelect )
74 mSelectedFeatureIds.clear();
78 for (
const auto fid : deselected )
79 mSelectedFeatureIds.remove( fid );
82 for (
const auto fid : selected )
83 if ( mRequest.acceptFeature( layer()->getFeature( fid ) ) )
84 mSelectedFeatureIds << fid;
86 lselected.remove( fid );
88 emit selectionChanged( lselected, deselected, clearAndSelect );
96 , mShowFirstFeature( config.value( QStringLiteral(
"show_first_feature" ), true ).toBool() )
97 , mAllowAddChildFeatureWithNoGeometry( config.value( QStringLiteral(
"allow_add_child_feature_with_no_geometry" ), false ).toBool() )
98 , mFilterExpression( config.value( QStringLiteral(
"filter_expression" ) ).toString() )
100 QVBoxLayout *rootLayout =
new QVBoxLayout(
this );
101 rootLayout->setContentsMargins( 0, 9, 0, 0 );
104 QHBoxLayout *buttonLayout =
new QHBoxLayout();
105 buttonLayout->setContentsMargins( 0, 0, 0, 0 );
107 mToggleEditingButton =
new QToolButton(
this );
108 mToggleEditingButton->setObjectName( QStringLiteral(
"mToggleEditingButton" ) );
110 mToggleEditingButton->setText( tr(
"Toggle Editing" ) );
111 mToggleEditingButton->setEnabled(
false );
112 mToggleEditingButton->setCheckable(
true );
113 mToggleEditingButton->setToolTip( tr(
"Toggle editing mode for child layer" ) );
114 buttonLayout->addWidget( mToggleEditingButton );
116 mSaveEditsButton =
new QToolButton(
this );
118 mSaveEditsButton->setText( tr(
"Save Child Layer Edits" ) );
119 mSaveEditsButton->setToolTip( tr(
"Save child layer edits" ) );
120 mSaveEditsButton->setEnabled(
true );
121 buttonLayout->addWidget( mSaveEditsButton );
123 mAddFeatureGeometryButton =
new QToolButton(
this );
124 mAddFeatureGeometryButton->setObjectName( QStringLiteral(
"mAddFeatureGeometryButton" ) );
125 buttonLayout->addWidget( mAddFeatureGeometryButton );
127 mAddFeatureButton =
new QToolButton(
this );
129 mAddFeatureButton->setText( tr(
"Add Child Feature" ) );
130 mAddFeatureButton->setToolTip( tr(
"Add child feature" ) );
131 mAddFeatureButton->setObjectName( QStringLiteral(
"mAddFeatureButton" ) );
132 buttonLayout->addWidget( mAddFeatureButton );
134 mDuplicateFeatureButton =
new QToolButton(
this );
136 mDuplicateFeatureButton->setText( tr(
"Duplicate Child Feature(s)" ) );
137 mDuplicateFeatureButton->setToolTip( tr(
"Duplicate selected child feature(s)" ) );
138 mDuplicateFeatureButton->setObjectName( QStringLiteral(
"mDuplicateFeatureButton" ) );
139 buttonLayout->addWidget( mDuplicateFeatureButton );
141 mDeleteFeatureButton =
new QToolButton(
this );
143 mDeleteFeatureButton->setText( tr(
"Delete Child Feature(s)" ) );
144 mDeleteFeatureButton->setToolTip( tr(
"Delete selected child feature(s)" ) );
145 mDeleteFeatureButton->setObjectName( QStringLiteral(
"mDeleteFeatureButton" ) );
146 buttonLayout->addWidget( mDeleteFeatureButton );
148 mLinkFeatureButton =
new QToolButton(
this );
150 mLinkFeatureButton->setText( tr(
"Link Existing Feature(s)" ) );
151 mLinkFeatureButton->setToolTip( tr(
"Link existing child feature(s)" ) );
152 mLinkFeatureButton->setObjectName( QStringLiteral(
"mLinkFeatureButton" ) );
153 buttonLayout->addWidget( mLinkFeatureButton );
155 mUnlinkFeatureButton =
new QToolButton(
this );
157 mUnlinkFeatureButton->setText( tr(
"Unlink Feature(s)" ) );
158 mUnlinkFeatureButton->setToolTip( tr(
"Unlink selected child feature(s)" ) );
159 mUnlinkFeatureButton->setObjectName( QStringLiteral(
"mUnlinkFeatureButton" ) );
160 buttonLayout->addWidget( mUnlinkFeatureButton );
162 mZoomToFeatureButton =
new QToolButton(
this );
164 mZoomToFeatureButton->setText( tr(
"Zoom To Feature(s)" ) );
165 mZoomToFeatureButton->setToolTip( tr(
"Zoom to selected child feature(s)" ) );
166 mZoomToFeatureButton->setObjectName( QStringLiteral(
"mZoomToFeatureButton" ) );
167 buttonLayout->addWidget( mZoomToFeatureButton );
169 buttonLayout->addItem(
new QSpacerItem( 0, 0, QSizePolicy::Expanding ) );
171 mFormViewButton =
new QToolButton(
this );
172 mFormViewButton->setText( tr(
"Form View" ) );
173 mFormViewButton->setToolTip( tr(
"Switch to form view" ) );
175 mFormViewButton->setCheckable(
true );
177 buttonLayout->addWidget( mFormViewButton );
179 mTableViewButton =
new QToolButton(
this );
180 mTableViewButton->setText( tr(
"Table View" ) );
181 mTableViewButton->setToolTip( tr(
"Switch to table view" ) );
183 mTableViewButton->setCheckable(
true );
185 buttonLayout->addWidget( mTableViewButton );
187 mViewModeButtonGroup =
new QButtonGroup(
this );
191 mMultiEditInfoLabel =
new QLabel(
this );
192 buttonLayout->addWidget( mMultiEditInfoLabel );
195 rootLayout->addLayout( buttonLayout );
198 mStackedWidget =
new QStackedWidget(
this );
202 mDualView->
setView( mViewMode );
206 mMultiEditStackedWidgetPage =
new QWidget(
this );
208 QVBoxLayout *vBoxLayout =
new QVBoxLayout();
209 vBoxLayout->setContentsMargins( 0, 0, 0, 0 );
211 mMultiEditTreeWidget =
new QTreeWidget(
this );
212 mMultiEditTreeWidget->setHeaderHidden(
true );
213 mMultiEditTreeWidget->setSelectionMode( QTreeWidget::ExtendedSelection );
214 vBoxLayout->addWidget( mMultiEditTreeWidget );
216 mMultiEditStackedWidgetPage->setLayout( vBoxLayout );
218 mStackedWidget->addWidget( mMultiEditStackedWidgetPage );
220 mStackedWidget->addWidget( mDualView );
222 rootLayout->addWidget( mStackedWidget );
224 connect( mViewModeButtonGroup, &QButtonGroup::idClicked,
226 connect( mToggleEditingButton, &QAbstractButton::clicked,
this, &QgsRelationEditorWidget::toggleEditing );
228 connect( mAddFeatureButton, &QAbstractButton::clicked,
this, &QgsRelationEditorWidget::addFeature );
229 connect( mAddFeatureGeometryButton, &QAbstractButton::clicked,
this, &QgsRelationEditorWidget::addFeatureGeometry );
232 connect( mLinkFeatureButton, &QAbstractButton::clicked,
this, &QgsRelationEditorWidget::linkFeature );
235 connect( mMultiEditTreeWidget, &QTreeWidget::itemSelectionChanged,
this, &QgsRelationEditorWidget::multiEditItemSelectionChanged );
240 setLayout( rootLayout );
254 mFeatureSelectionMgr =
new QgsFilteredSelectionManager( layer, request, mDualView );
264 text = tr(
"Add Point Child Feature" );
269 text = tr(
"Add Line Child Feature" );
274 text = tr(
"Add Polygon Child Feature" );
277 mAddFeatureGeometryButton->setIcon( icon );
278 mAddFeatureGeometryButton->setText( text );
279 mAddFeatureGeometryButton->setToolTip( text );
291 mMapToolDigitize->
setButton( mAddFeatureGeometryButton );
303void QgsRelationEditorWidget::updateButtons()
305 bool toggleEditingButtonEnabled =
false;
307 bool canAddGeometry =
false;
308 bool canRemove =
false;
309 bool canEdit =
false;
310 bool canLink =
false;
311 bool canUnlink =
false;
312 bool spatial =
false;
336 const bool selectionNotEmpty = mFeatureSelectionMgr ? mFeatureSelectionMgr->
selectedFeatureCount() :
false;
339 const bool multieditLinkedChildSelected = ! selectedChildFeatureIds().isEmpty();
341 canAddGeometry =
false;
343 canRemove = canRemove && multieditLinkedChildSelected;
347 canUnlink = canUnlink && multieditLinkedChildSelected;
351 canRemove = canRemove && selectionNotEmpty;
352 canUnlink = canUnlink && selectionNotEmpty;
355 mToggleEditingButton->setEnabled( toggleEditingButtonEnabled );
356 mAddFeatureButton->setEnabled( canAdd );
357 mAddFeatureGeometryButton->setEnabled( canAddGeometry );
358 mDuplicateFeatureButton->setEnabled( canEdit && selectionNotEmpty );
359 mLinkFeatureButton->setEnabled( canLink );
360 mDeleteFeatureButton->setEnabled( canRemove );
361 mUnlinkFeatureButton->setEnabled( canUnlink );
362 mZoomToFeatureButton->setEnabled( selectionNotEmpty );
363 mToggleEditingButton->setChecked( canEdit );
364 mSaveEditsButton->setEnabled( canEdit || canLink || canUnlink );
378void QgsRelationEditorWidget::addFeature()
385 mMultiEditTreeWidget->blockSignals(
true );
386 mMultiEdit1NJustAddedIds = addedFeatures;
387 QTreeWidgetItemIterator treeWidgetItemIterator( mMultiEditTreeWidget );
388 while ( *treeWidgetItemIterator )
390 if ( ( *treeWidgetItemIterator )->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ) ).toInt() !=
static_cast<int>( MultiEditFeatureType::Child ) )
392 ++treeWidgetItemIterator;
396 if ( addedFeatures.contains( ( *treeWidgetItemIterator )->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toInt() ) )
397 ( *treeWidgetItemIterator )->setSelected(
true );
399 ++treeWidgetItemIterator;
401 mMultiEditTreeWidget->blockSignals(
false );
407void QgsRelationEditorWidget::addFeatureGeometry()
411 QgsLogger::warning( tr(
"Adding a geometry feature is not supported in multiple edit mode" ) );
421 mMapToolDigitize->
setLayer( layer );
424 if ( window()->objectName() != QLatin1String(
"QgisApp" ) )
426 window()->setVisible(
false );
428 setMapTool( mMapToolDigitize );
439 const QString msg = tr(
"Digitize the geometry for the new feature on layer %1. Press <ESC> to cancel." )
440 .arg( layer->
name() );
442 lMainMessageBar->pushItem( mMessageBarItem );
446void QgsRelationEditorWidget::onDigitizingCompleted(
const QgsFeature &feature )
449 digitizingFinished();
452void QgsRelationEditorWidget::multiEditItemSelectionChanged()
454 const QList<QTreeWidgetItem *> selectedItems = mMultiEditTreeWidget->selectedItems();
458 if ( selectedItems.size() == 1
459 && mMultiEditPreviousSelectedItems.size() <= 1 )
461 if ( selectedItems.first()->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ) ).toInt() ==
static_cast<int>( MultiEditFeatureType::Child ) )
463 mMultiEditTreeWidget->blockSignals(
true );
465 const QgsFeatureId featureIdSelectedItem = selectedItems.first()->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toInt();
467 QTreeWidgetItemIterator treeWidgetItemIterator( mMultiEditTreeWidget );
468 while ( *treeWidgetItemIterator )
470 if ( ( *treeWidgetItemIterator )->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ) ).toInt() !=
static_cast<int>( MultiEditFeatureType::Child ) )
472 ++treeWidgetItemIterator;
476 const QgsFeatureId featureIdCurrentItem = ( *treeWidgetItemIterator )->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toInt();
479 if ( featureIdSelectedItem == featureIdCurrentItem )
480 ( *treeWidgetItemIterator )->setSelected(
true );
484 if ( ! mMultiEdit1NJustAddedIds.contains( featureIdSelectedItem ) )
487 if ( mMultiEdit1NJustAddedIds.contains( featureIdCurrentItem ) )
488 ( *treeWidgetItemIterator )->setSelected(
true );
491 ++treeWidgetItemIterator;
493 mMultiEditTreeWidget->blockSignals(
false );
496 mMultiEditPreviousSelectedItems = selectedItems;
500void QgsRelationEditorWidget::linkFeature()
505void QgsRelationEditorWidget::toggleEditing(
bool state )
523 updateUiSingleEdit();
528 mButtonsVisibility = buttons;
535 if ( mLinkFeatureButton->isVisible() )
537 if ( mUnlinkFeatureButton->isVisible() )
539 if ( mSaveEditsButton->isVisible() )
541 if ( mAddFeatureButton->isVisible() )
543 if ( mDuplicateFeatureButton->isVisible() )
545 if ( mDeleteFeatureButton->isVisible() )
547 if ( mZoomToFeatureButton->isVisible() )
561 QAction *qAction =
nullptr;
566 connect( qAction, &QAction::triggered,
this, [
this, fid]() {
deleteFeature( fid ); } );
572 connect( qAction, &QAction::triggered,
this, [
this, fid]() {
unlinkFeature( fid ); } );
577void QgsRelationEditorWidget::setMapTool(
QgsMapTool *mapTool )
582 mapCanvas->window()->raise();
583 mapCanvas->activateWindow();
584 mapCanvas->setFocus();
588void QgsRelationEditorWidget::unsetMapTool()
598QgsFeatureIds QgsRelationEditorWidget::selectedChildFeatureIds()
const
603 for ( QTreeWidgetItem *treeWidgetItem : mMultiEditTreeWidget->selectedItems() )
605 if (
static_cast<MultiEditFeatureType
>( treeWidgetItem->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ) ).toInt() ) != MultiEditFeatureType::Child )
608 featureIds.insert( treeWidgetItem->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toLongLong() );
616void QgsRelationEditorWidget::updateUiSingleEdit()
618 mFormViewButton->setVisible(
true );
619 mTableViewButton->setVisible(
true );
620 mMultiEditInfoLabel->setVisible(
false );
622 mStackedWidget->setCurrentWidget( mDualView );
635 filters << filter.prepend(
'(' ).append(
')' );
655 initDualView( layer, request );
659 mFeatureSelectionMgr =
new QgsFilteredSelectionManager( layer, request, mDualView );
670void QgsRelationEditorWidget::updateUiMultiEdit()
672 mFormViewButton->setVisible(
false );
673 mTableViewButton->setVisible(
false );
674 mMultiEditInfoLabel->setVisible(
true );
676 mStackedWidget->setCurrentWidget( mMultiEditStackedWidgetPage ) ;
678 QList<QTreeWidgetItem *> parentTreeWidgetItems;
681 QMultiMap<QTreeWidgetItem *, QgsFeatureId> multimapChildFeatures;
683 mMultiEditTreeWidget->clear();
686 QTreeWidgetItem *treeWidgetItem = createMultiEditTreeWidgetItem( featureParent,
mRelation.
referencedLayer(), MultiEditFeatureType::Parent );
689 treeWidgetItem->setFlags( Qt::ItemIsEnabled );
691 parentTreeWidgetItems.append( treeWidgetItem );
697 while ( featureIterator.
nextFeature( featureChild ) )
704 while ( featureIteratorFinalChild.
nextFeature( featureChildChild ) )
706 QTreeWidgetItem *treeWidgetItemChild = createMultiEditTreeWidgetItem( featureChildChild,
mNmRelation.
referencedLayer(), MultiEditFeatureType::Child );
708 treeWidgetItem->addChild( treeWidgetItemChild );
710 featureIdsMixedValues.insert( featureChildChild.
id() );
711 multimapChildFeatures.insert( treeWidgetItem, featureChildChild.
id() );
716 QTreeWidgetItem *treeWidgetItemChild = createMultiEditTreeWidgetItem( featureChild,
mRelation.
referencingLayer(), MultiEditFeatureType::Child );
717 treeWidgetItem->addChild( treeWidgetItemChild );
719 featureIdsMixedValues.insert( featureChild.
id() );
723 mMultiEditTreeWidget->addTopLevelItem( treeWidgetItem );
724 treeWidgetItem->setExpanded(
true );
740 QgsFeatureIds::iterator iterator = featureIdsMixedValues.begin();
741 while ( iterator != featureIdsMixedValues.end() )
743 bool mixedValues =
false;
744 for ( QTreeWidgetItem *parentTreeWidgetItem : parentTreeWidgetItems )
746 if ( ! multimapChildFeatures.values( parentTreeWidgetItem ).contains( *iterator ) )
755 iterator = featureIdsMixedValues.erase( iterator );
764 if ( featureIdsMixedValues.isEmpty() )
767 mMultiEditInfoLabel->setPixmap( icon.pixmap( mMultiEditInfoLabel->height(),
768 mMultiEditInfoLabel->height() ) );
769 mMultiEditInfoLabel->setToolTip( tr(
"All features in selection have equal relations" ) );
774 mMultiEditInfoLabel->setPixmap( icon.pixmap( mMultiEditInfoLabel->height(),
775 mMultiEditInfoLabel->height() ) );
776 mMultiEditInfoLabel->setToolTip( tr(
"Some features in selection have different relations" ) );
779 QFont fontItalic = mMultiEditTreeWidget->font();
780 fontItalic.setItalic(
true );
781 for ( QTreeWidgetItem *parentTreeWidgetItem : parentTreeWidgetItems )
783 for (
int childIndex = 0; childIndex < parentTreeWidgetItem->childCount(); ++childIndex )
785 QTreeWidgetItem *childItem = parentTreeWidgetItem->child( childIndex );
786 const QgsFeatureId featureIdCurrentItem = childItem->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toInt();
787 if ( featureIdsMixedValues.contains( featureIdCurrentItem ) )
788 childItem->setFont( 0, fontItalic );
794QTreeWidgetItem *QgsRelationEditorWidget::createMultiEditTreeWidgetItem(
const QgsFeature &feature,
QgsVectorLayer *layer, MultiEditFeatureType type )
796 QTreeWidgetItem *treeWidgetItem =
new QTreeWidgetItem();
799 treeWidgetItem->setData( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ),
static_cast<int>( type ) );
800 treeWidgetItem->setData( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ),
feature.
id() );
801 return treeWidgetItem;
804void QgsRelationEditorWidget::onDigitizingCanceled( )
806 digitizingFinished();
809void QgsRelationEditorWidget::digitizingFinished( )
811 window()->setVisible(
true );
813 window()->activateWindow();
817void QgsRelationEditorWidget::mapToolDeactivated()
823 mMessageBarItem =
nullptr;
829 {
"show_first_feature", mShowFirstFeature},
830 {
"allow_add_child_feature_with_no_geometry", mAllowAddChildFeatureWithNoGeometry },
831 {
"filter_expression", mFilterExpression }
838 mShowFirstFeature =
config.value( QStringLiteral(
"show_first_feature" ),
true ).toBool();
839 mAllowAddChildFeatureWithNoGeometry =
config.value( QStringLiteral(
"allow_add_child_feature_with_no_geometry" ),
false ).toBool();
840 mFilterExpression =
config.value( QStringLiteral(
"filter_expression" ) ).toString();
846 Q_UNUSED( newRelation );
847 Q_UNUSED( newFeature );
876 Q_UNUSED( newRelation );
877 Q_UNUSED( newNmRelation );
911 return mFeatureSelectionMgr;
916 const QgsFeatureIds selectedFids = selectedChildFeatureIds();
932 const QgsFeatureIds selectedFids = selectedChildFeatureIds();
958 filterExpressionLabel->setEnabled( mRelationShowLinkCheckBox->isChecked() );
959 mEditExpression->setEnabled( mRelationShowLinkCheckBox->isChecked() );
960 mFilterExpression->setEnabled( mRelationShowLinkCheckBox->isChecked() );
961 connect( mRelationShowLinkCheckBox, &QCheckBox::toggled, filterExpressionLabel, &QLabel::setEnabled );
962 connect( mRelationShowLinkCheckBox, &QCheckBox::toggled, mEditExpression, &QToolButton::setEnabled );
963 connect( mRelationShowLinkCheckBox, &QCheckBox::toggled, mFilterExpression, &QTextEdit::setEnabled );
966 mAllowAddChildFeatureWithNoGeometry->setEnabled( mRelationShowAddChildCheckBox->isChecked() );
967 connect( mRelationShowAddChildCheckBox, &QCheckBox::toggled, mAllowAddChildFeatureWithNoGeometry, &QCheckBox::setEnabled );
986 dlg.setWindowTitle( tr(
"Edit Filter Expression of Target Layer" ) );
988 if ( dlg.exec() == QDialog::Accepted )
1008 {
"show_first_feature", mShowFirstFeature->isChecked()},
1009 {
"allow_add_child_feature_with_no_geometry", mAllowAddChildFeatureWithNoGeometry->isChecked()},
1010 {
"filter_expression", mFilterExpression->toPlainText()}
1025 mShowFirstFeature->setChecked(
config.value( QStringLiteral(
"show_first_feature" ),
true ).toBool() );
1026 mAllowAddChildFeatureWithNoGeometry->setChecked(
config.value( QStringLiteral(
"allow_add_child_feature_with_no_geometry" ),
false ).toBool() );
1027 mFilterExpression->setPlainText(
config.value( QStringLiteral(
"filter_expression" ) ).toString() );
1042 return QStringLiteral(
"relation_editor" );
1047 return QObject::tr(
"Relation Editor" );
void reset(T *p=nullptr)
Will reset the managed pointer to p.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
This class contains context information for attribute editor widgets.
QgsMapCanvas * mapCanvas() const
Returns the associated map canvas (e.g.
QgsAdvancedDigitizingDockWidget * cadDockWidget() const
Returns the associated CAD dock widget (e.g.
void setParentFormFeature(const QgsFeature &feature)
Sets the feature of the currently edited parent form.
QgsMessageBar * mainMessageBar()
Returns the main message bar.
QgsVectorLayer * layer() const
Returns the layer this model uses as backend.
virtual void loadLayer()
Loads the layer into the model Preferably to be called, before using this model as source for any oth...
This widget is used to show the attributes of a set of features of a QgsVectorLayer.
void showContextMenuExternally(QgsActionMenu *menu, QgsFeatureId fid)
Emitted when selecting context menu on the feature list to create the context menu individually.
ViewMode
The view modes, in which this widget can present information.
@ AttributeTable
Shows the features and attributes in a table layout.
@ AttributeEditor
Show a list of the features, where one can be chosen and the according attribute dialog will be prese...
void setFeatureSelectionManager(QgsIFeatureSelectionManager *featureSelectionManager)
Set the feature selection model.
void init(QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request=QgsFeatureRequest(), const QgsAttributeEditorContext &context=QgsAttributeEditorContext(), bool loadFeatures=true, bool showFirstFeature=true)
Has to be called to initialize the dual view.
void setRequest(const QgsFeatureRequest &request)
Set the request.
void parentFormValueChanged(const QString &attribute, const QVariant &value)
Called in embedded forms when an attribute value in the parent form has changed.
QgsAttributeTableModel * masterModel() const
Returns the model which has the information about all features (not only filtered)
void setView(ViewMode view)
Change the current view mode.
A generic dialog for building expression strings.
QgsExpressionBuilderWidget * expressionBuilder()
The builder widget that is used by the dialog.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QString expression() const
Returns the original, unmodified expression string.
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsExpression * filterExpression() const
Returns the filter expression (if set).
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Is an interface class to abstract feature selection handling.
void selectionChanged(const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect)
Emitted when selection was changed.
static QIcon iconForLayer(const QgsMapLayer *layer)
Returns the icon corresponding to a specified map layer.
static void warning(const QString &msg)
Goes to qWarning.
Map canvas is a class for displaying all GIS data types on a canvas.
void unsetMapTool(QgsMapTool *mapTool)
Unset the current map tool or last non zoom tool.
void setMapTool(QgsMapTool *mapTool, bool clean=false)
Sets the map tool currently being used on the canvas.
void zoomToFeatureIds(QgsVectorLayer *layer, const QgsFeatureIds &ids)
Set canvas extent to the bounding box of a set of features.
void editingStopped()
Emitted when edited changes have been successfully written to the data provider.
void editingStarted()
Emitted when editing on this layer has started.
bool popWidget(QgsMessageBarItem *item)
Remove the specified item from the bar, and display the next most recent one in the stack.
static QgsMessageBarItem * createMessage(const QString &text, QWidget *parent=nullptr)
Creates message bar item widget containing a message text to be displayed on the bar.
Represents a relationship between two vector layers.
QgsFeatureRequest getReferencedFeatureRequest(const QgsAttributes &attributes) const
Creates a request to return the feature on the referenced (parent) layer which is referenced by the p...
QgsVectorLayer * referencedLayer
QgsVectorLayer * referencingLayer
QgsFeatureRequest getRelatedFeaturesRequest(const QgsFeature &feature) const
Creates a request to return all the features on the referencing (child) layer which have a foreign ke...
int selectedFeatureCount() override
Returns the number of features that are selected in this layer.
const QgsFeatureIds & selectedFeatureIds() const override
Returns reference to identifiers of selected features.
static QString getFeatureDisplayString(const QgsVectorLayer *layer, const QgsFeature &feature)
Represents a vector layer which manages a vector based data sets.
bool isSpatial() const FINAL
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
void selectionChanged(const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect)
Emitted when selection was changed.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QString qgsFlagValueToKeys(const T &value, bool *returnOk=nullptr)
Returns the value for the given keys of a flag.
T qgsFlagKeysToValue(const QString &keys, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given keys of a flag.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features