48 for (
const auto fid : layer->selectedFeatureIds() )
49 if ( mRequest.acceptFeature( layer->getFeature( fid ) ) )
50 mSelectedFeatureIds << fid;
55const QgsFeatureIds &QgsFilteredSelectionManager::selectedFeatureIds()
const
59 return mSelectedFeatureIds;
62int QgsFilteredSelectionManager::selectedFeatureCount()
64 return mSelectedFeatureIds.count();
67void QgsFilteredSelectionManager::onSelectionChanged(
const QgsFeatureIds &selected,
const QgsFeatureIds &deselected,
bool clearAndSelect )
72 mSelectedFeatureIds.clear();
76 for (
const auto fid : deselected )
77 mSelectedFeatureIds.remove( fid );
80 for (
const auto fid : selected )
81 if ( mRequest.acceptFeature( layer()->getFeature( fid ) ) )
82 mSelectedFeatureIds << fid;
84 lselected.remove( fid );
86 emit selectionChanged( lselected, deselected, clearAndSelect );
94 , mShowFirstFeature( config.value( QStringLiteral(
"show_first_feature" ), true ).toBool() )
95 , mAllowAddChildFeatureWithNoGeometry( config.value( QStringLiteral(
"allow_add_child_feature_with_no_geometry" ), false ).toBool() )
97 QVBoxLayout *rootLayout =
new QVBoxLayout(
this );
98 rootLayout->setContentsMargins( 0, 9, 0, 0 );
101 QHBoxLayout *buttonLayout =
new QHBoxLayout();
102 buttonLayout->setContentsMargins( 0, 0, 0, 0 );
104 mToggleEditingButton =
new QToolButton(
this );
105 mToggleEditingButton->setObjectName( QStringLiteral(
"mToggleEditingButton" ) );
107 mToggleEditingButton->setText( tr(
"Toggle Editing" ) );
108 mToggleEditingButton->setEnabled(
false );
109 mToggleEditingButton->setCheckable(
true );
110 mToggleEditingButton->setToolTip( tr(
"Toggle editing mode for child layer" ) );
111 buttonLayout->addWidget( mToggleEditingButton );
113 mSaveEditsButton =
new QToolButton(
this );
115 mSaveEditsButton->setText( tr(
"Save Child Layer Edits" ) );
116 mSaveEditsButton->setToolTip( tr(
"Save child layer edits" ) );
117 mSaveEditsButton->setEnabled(
true );
118 buttonLayout->addWidget( mSaveEditsButton );
120 mAddFeatureGeometryButton =
new QToolButton(
this );
121 mAddFeatureGeometryButton->setObjectName( QStringLiteral(
"mAddFeatureGeometryButton" ) );
122 buttonLayout->addWidget( mAddFeatureGeometryButton );
124 mAddFeatureButton =
new QToolButton(
this );
126 mAddFeatureButton->setText( tr(
"Add Child Feature" ) );
127 mAddFeatureButton->setToolTip( tr(
"Add child feature" ) );
128 mAddFeatureButton->setObjectName( QStringLiteral(
"mAddFeatureButton" ) );
129 buttonLayout->addWidget( mAddFeatureButton );
131 mDuplicateFeatureButton =
new QToolButton(
this );
133 mDuplicateFeatureButton->setText( tr(
"Duplicate Child Feature(s)" ) );
134 mDuplicateFeatureButton->setToolTip( tr(
"Duplicate selected child feature(s)" ) );
135 mDuplicateFeatureButton->setObjectName( QStringLiteral(
"mDuplicateFeatureButton" ) );
136 buttonLayout->addWidget( mDuplicateFeatureButton );
138 mDeleteFeatureButton =
new QToolButton(
this );
140 mDeleteFeatureButton->setText( tr(
"Delete Child Feature(s)" ) );
141 mDeleteFeatureButton->setToolTip( tr(
"Delete selected child feature(s)" ) );
142 mDeleteFeatureButton->setObjectName( QStringLiteral(
"mDeleteFeatureButton" ) );
143 buttonLayout->addWidget( mDeleteFeatureButton );
145 mLinkFeatureButton =
new QToolButton(
this );
147 mLinkFeatureButton->setText( tr(
"Link Existing Feature(s)" ) );
148 mLinkFeatureButton->setToolTip( tr(
"Link existing child feature(s)" ) );
149 mLinkFeatureButton->setObjectName( QStringLiteral(
"mLinkFeatureButton" ) );
150 buttonLayout->addWidget( mLinkFeatureButton );
152 mUnlinkFeatureButton =
new QToolButton(
this );
154 mUnlinkFeatureButton->setText( tr(
"Unlink Feature(s)" ) );
155 mUnlinkFeatureButton->setToolTip( tr(
"Unlink selected child feature(s)" ) );
156 mUnlinkFeatureButton->setObjectName( QStringLiteral(
"mUnlinkFeatureButton" ) );
157 buttonLayout->addWidget( mUnlinkFeatureButton );
159 mZoomToFeatureButton =
new QToolButton(
this );
161 mZoomToFeatureButton->setText( tr(
"Zoom To Feature(s)" ) );
162 mZoomToFeatureButton->setToolTip( tr(
"Zoom to selected child feature(s)" ) );
163 mZoomToFeatureButton->setObjectName( QStringLiteral(
"mZoomToFeatureButton" ) );
164 buttonLayout->addWidget( mZoomToFeatureButton );
166 buttonLayout->addItem(
new QSpacerItem( 0, 0, QSizePolicy::Expanding ) );
168 mFormViewButton =
new QToolButton(
this );
169 mFormViewButton->setText( tr(
"Form View" ) );
170 mFormViewButton->setToolTip( tr(
"Switch to form view" ) );
172 mFormViewButton->setCheckable(
true );
174 buttonLayout->addWidget( mFormViewButton );
176 mTableViewButton =
new QToolButton(
this );
177 mTableViewButton->setText( tr(
"Table View" ) );
178 mTableViewButton->setToolTip( tr(
"Switch to table view" ) );
180 mTableViewButton->setCheckable(
true );
182 buttonLayout->addWidget( mTableViewButton );
184 mViewModeButtonGroup =
new QButtonGroup(
this );
188 mMultiEditInfoLabel =
new QLabel(
this );
189 buttonLayout->addWidget( mMultiEditInfoLabel );
192 rootLayout->addLayout( buttonLayout );
195 mStackedWidget =
new QStackedWidget(
this );
199 mDualView->
setView( mViewMode );
203 mMultiEditStackedWidgetPage =
new QWidget(
this );
205 QVBoxLayout *vBoxLayout =
new QVBoxLayout();
206 vBoxLayout->setContentsMargins( 0, 0, 0, 0 );
208 mMultiEditTreeWidget =
new QTreeWidget(
this );
209 mMultiEditTreeWidget->setHeaderHidden(
true );
210 mMultiEditTreeWidget->setSelectionMode( QTreeWidget::ExtendedSelection );
211 vBoxLayout->addWidget( mMultiEditTreeWidget );
213 mMultiEditStackedWidgetPage->setLayout( vBoxLayout );
215 mStackedWidget->addWidget( mMultiEditStackedWidgetPage );
217 mStackedWidget->addWidget( mDualView );
219 rootLayout->addWidget( mStackedWidget );
221#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
222 connect( mViewModeButtonGroup,
static_cast<void ( QButtonGroup::* )(
int )
>( &QButtonGroup::buttonClicked ),
225 connect( mViewModeButtonGroup, &QButtonGroup::idClicked,
228 connect( mToggleEditingButton, &QAbstractButton::clicked,
this, &QgsRelationEditorWidget::toggleEditing );
230 connect( mAddFeatureButton, &QAbstractButton::clicked,
this, &QgsRelationEditorWidget::addFeature );
231 connect( mAddFeatureGeometryButton, &QAbstractButton::clicked,
this, &QgsRelationEditorWidget::addFeatureGeometry );
237 connect( mMultiEditTreeWidget, &QTreeWidget::itemSelectionChanged,
this, &QgsRelationEditorWidget::multiEditItemSelectionChanged );
242 setLayout( rootLayout );
256 mFeatureSelectionMgr =
new QgsFilteredSelectionManager( layer, request, mDualView );
266 text = tr(
"Add Point Child Feature" );
271 text = tr(
"Add Line Child Feature" );
276 text = tr(
"Add Polygon Child Feature" );
279 mAddFeatureGeometryButton->setIcon( icon );
280 mAddFeatureGeometryButton->setText( text );
281 mAddFeatureGeometryButton->setToolTip( text );
293 mMapToolDigitize->
setButton( mAddFeatureGeometryButton );
305void QgsRelationEditorWidget::updateButtons()
307 bool toggleEditingButtonEnabled =
false;
309 bool canAddGeometry =
false;
310 bool canRemove =
false;
311 bool canEdit =
false;
312 bool canLink =
false;
313 bool canUnlink =
false;
314 bool spatial =
false;
338 const bool selectionNotEmpty = mFeatureSelectionMgr ? mFeatureSelectionMgr->
selectedFeatureCount() :
false;
341 const bool multieditLinkedChildSelected = ! selectedChildFeatureIds().isEmpty();
343 canAddGeometry =
false;
345 canRemove = canRemove && multieditLinkedChildSelected;
349 canUnlink = canUnlink && multieditLinkedChildSelected;
353 canRemove = canRemove && selectionNotEmpty;
354 canUnlink = canUnlink && selectionNotEmpty;
357 mToggleEditingButton->setEnabled( toggleEditingButtonEnabled );
358 mAddFeatureButton->setEnabled( canAdd );
359 mAddFeatureGeometryButton->setEnabled( canAddGeometry );
360 mDuplicateFeatureButton->setEnabled( canEdit && selectionNotEmpty );
361 mLinkFeatureButton->setEnabled( canLink );
362 mDeleteFeatureButton->setEnabled( canRemove );
363 mUnlinkFeatureButton->setEnabled( canUnlink );
364 mZoomToFeatureButton->setEnabled( selectionNotEmpty );
365 mToggleEditingButton->setChecked( canEdit );
366 mSaveEditsButton->setEnabled( canEdit || canLink || canUnlink );
380void QgsRelationEditorWidget::addFeature()
387 mMultiEditTreeWidget->blockSignals(
true );
388 mMultiEdit1NJustAddedIds = addedFeatures;
389 QTreeWidgetItemIterator treeWidgetItemIterator( mMultiEditTreeWidget );
390 while ( *treeWidgetItemIterator )
392 if ( ( *treeWidgetItemIterator )->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ) ).toInt() !=
static_cast<int>( MultiEditFeatureType::Child ) )
394 ++treeWidgetItemIterator;
398 if ( addedFeatures.contains( ( *treeWidgetItemIterator )->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toInt() ) )
399 ( *treeWidgetItemIterator )->setSelected(
true );
401 ++treeWidgetItemIterator;
403 mMultiEditTreeWidget->blockSignals(
false );
409void QgsRelationEditorWidget::addFeatureGeometry()
413 QgsLogger::warning( tr(
"Adding a geometry feature is not supported in multiple edit mode" ) );
423 mMapToolDigitize->
setLayer( layer );
426 if ( window()->objectName() != QLatin1String(
"QgisApp" ) )
428 window()->setVisible(
false );
430 setMapTool( mMapToolDigitize );
441 const QString msg = tr(
"Digitize the geometry for the new feature on layer %1. Press <ESC> to cancel." )
442 .arg( layer->
name() );
444 lMainMessageBar->pushItem( mMessageBarItem );
448void QgsRelationEditorWidget::onDigitizingCompleted(
const QgsFeature &feature )
451 digitizingFinished();
454void QgsRelationEditorWidget::multiEditItemSelectionChanged()
456 const QList<QTreeWidgetItem *> selectedItems = mMultiEditTreeWidget->selectedItems();
460 if ( selectedItems.size() == 1
461 && mMultiEditPreviousSelectedItems.size() <= 1 )
463 if ( selectedItems.first()->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ) ).toInt() ==
static_cast<int>( MultiEditFeatureType::Child ) )
465 mMultiEditTreeWidget->blockSignals(
true );
467 const QgsFeatureId featureIdSelectedItem = selectedItems.first()->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toInt();
469 QTreeWidgetItemIterator treeWidgetItemIterator( mMultiEditTreeWidget );
470 while ( *treeWidgetItemIterator )
472 if ( ( *treeWidgetItemIterator )->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ) ).toInt() !=
static_cast<int>( MultiEditFeatureType::Child ) )
474 ++treeWidgetItemIterator;
478 const QgsFeatureId featureIdCurrentItem = ( *treeWidgetItemIterator )->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toInt();
481 if ( featureIdSelectedItem == featureIdCurrentItem )
482 ( *treeWidgetItemIterator )->setSelected(
true );
486 if ( ! mMultiEdit1NJustAddedIds.contains( featureIdSelectedItem ) )
489 if ( mMultiEdit1NJustAddedIds.contains( featureIdCurrentItem ) )
490 ( *treeWidgetItemIterator )->setSelected(
true );
493 ++treeWidgetItemIterator;
495 mMultiEditTreeWidget->blockSignals(
false );
498 mMultiEditPreviousSelectedItems = selectedItems;
502void QgsRelationEditorWidget::toggleEditing(
bool state )
520 updateUiSingleEdit();
525 mButtonsVisibility = buttons;
532 if ( mLinkFeatureButton->isVisible() )
534 if ( mUnlinkFeatureButton->isVisible() )
536 if ( mSaveEditsButton->isVisible() )
538 if ( mAddFeatureButton->isVisible() )
540 if ( mDuplicateFeatureButton->isVisible() )
542 if ( mDeleteFeatureButton->isVisible() )
544 if ( mZoomToFeatureButton->isVisible() )
558 QAction *qAction =
nullptr;
563 connect( qAction, &QAction::triggered,
this, [
this, fid]() {
deleteFeature( fid ); } );
569 connect( qAction, &QAction::triggered,
this, [
this, fid]() {
unlinkFeature( fid ); } );
574void QgsRelationEditorWidget::setMapTool(
QgsMapTool *mapTool )
579 mapCanvas->window()->raise();
580 mapCanvas->activateWindow();
581 mapCanvas->setFocus();
585void QgsRelationEditorWidget::unsetMapTool()
595QgsFeatureIds QgsRelationEditorWidget::selectedChildFeatureIds()
const
600 for ( QTreeWidgetItem *treeWidgetItem : mMultiEditTreeWidget->selectedItems() )
602 if (
static_cast<MultiEditFeatureType
>( treeWidgetItem->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ) ).toInt() ) != MultiEditFeatureType::Child )
605 featureIds.insert( treeWidgetItem->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toLongLong() );
613void QgsRelationEditorWidget::updateUiSingleEdit()
615 mFormViewButton->setVisible(
true );
616 mTableViewButton->setVisible(
true );
617 mMultiEditInfoLabel->setVisible(
false );
619 mStackedWidget->setCurrentWidget( mDualView );
632 filters << filter.prepend(
'(' ).append(
')' );
652 initDualView( layer, request );
656 mFeatureSelectionMgr =
new QgsFilteredSelectionManager( layer, request, mDualView );
667void QgsRelationEditorWidget::updateUiMultiEdit()
669 mFormViewButton->setVisible(
false );
670 mTableViewButton->setVisible(
false );
671 mMultiEditInfoLabel->setVisible(
true );
673 mStackedWidget->setCurrentWidget( mMultiEditStackedWidgetPage ) ;
675 QList<QTreeWidgetItem *> parentTreeWidgetItems;
678 QMultiMap<QTreeWidgetItem *, QgsFeatureId> multimapChildFeatures;
680 mMultiEditTreeWidget->clear();
683 QTreeWidgetItem *treeWidgetItem = createMultiEditTreeWidgetItem( featureParent,
mRelation.
referencedLayer(), MultiEditFeatureType::Parent );
686 treeWidgetItem->setFlags( Qt::ItemIsEnabled );
688 parentTreeWidgetItems.append( treeWidgetItem );
694 while ( featureIterator.
nextFeature( featureChild ) )
701 while ( featureIteratorFinalChild.
nextFeature( featureChildChild ) )
703 QTreeWidgetItem *treeWidgetItemChild = createMultiEditTreeWidgetItem( featureChildChild,
mNmRelation.
referencedLayer(), MultiEditFeatureType::Child );
705 treeWidgetItem->addChild( treeWidgetItemChild );
707 featureIdsMixedValues.insert( featureChildChild.
id() );
708 multimapChildFeatures.insert( treeWidgetItem, featureChildChild.
id() );
713 QTreeWidgetItem *treeWidgetItemChild = createMultiEditTreeWidgetItem( featureChild,
mRelation.
referencingLayer(), MultiEditFeatureType::Child );
714 treeWidgetItem->addChild( treeWidgetItemChild );
716 featureIdsMixedValues.insert( featureChild.
id() );
720 mMultiEditTreeWidget->addTopLevelItem( treeWidgetItem );
721 treeWidgetItem->setExpanded(
true );
737 QgsFeatureIds::iterator iterator = featureIdsMixedValues.begin();
738 while ( iterator != featureIdsMixedValues.end() )
740 bool mixedValues =
false;
741 for ( QTreeWidgetItem *parentTreeWidgetItem : parentTreeWidgetItems )
743 if ( ! multimapChildFeatures.values( parentTreeWidgetItem ).contains( *iterator ) )
752 iterator = featureIdsMixedValues.erase( iterator );
761 if ( featureIdsMixedValues.isEmpty() )
764 mMultiEditInfoLabel->setPixmap( icon.pixmap( mMultiEditInfoLabel->height(),
765 mMultiEditInfoLabel->height() ) );
766 mMultiEditInfoLabel->setToolTip( tr(
"All features in selection have equal relations" ) );
771 mMultiEditInfoLabel->setPixmap( icon.pixmap( mMultiEditInfoLabel->height(),
772 mMultiEditInfoLabel->height() ) );
773 mMultiEditInfoLabel->setToolTip( tr(
"Some features in selection have different relations" ) );
776 QFont fontItalic = mMultiEditTreeWidget->font();
777 fontItalic.setItalic(
true );
778 for ( QTreeWidgetItem *parentTreeWidgetItem : parentTreeWidgetItems )
780 for (
int childIndex = 0; childIndex < parentTreeWidgetItem->childCount(); ++childIndex )
782 QTreeWidgetItem *childItem = parentTreeWidgetItem->child( childIndex );
783 const QgsFeatureId featureIdCurrentItem = childItem->data( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ) ).toInt();
784 if ( featureIdsMixedValues.contains( featureIdCurrentItem ) )
785 childItem->setFont( 0, fontItalic );
791QTreeWidgetItem *QgsRelationEditorWidget::createMultiEditTreeWidgetItem(
const QgsFeature &feature,
QgsVectorLayer *layer, MultiEditFeatureType type )
793 QTreeWidgetItem *treeWidgetItem =
new QTreeWidgetItem();
796 treeWidgetItem->setData( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureType ),
static_cast<int>( type ) );
797 treeWidgetItem->setData( 0,
static_cast<int>( MultiEditTreeWidgetRole::FeatureId ),
feature.
id() );
798 return treeWidgetItem;
801void QgsRelationEditorWidget::onDigitizingCanceled( )
803 digitizingFinished();
806void QgsRelationEditorWidget::digitizingFinished( )
808 window()->setVisible(
true );
810 window()->activateWindow();
814void QgsRelationEditorWidget::mapToolDeactivated()
820 mMessageBarItem =
nullptr;
826 {
"show_first_feature", mShowFirstFeature},
827 {
"allow_add_child_feature_with_no_geometry", mAllowAddChildFeatureWithNoGeometry }} );
833 mShowFirstFeature =
config.value( QStringLiteral(
"show_first_feature" ),
true ).toBool();
834 mAllowAddChildFeatureWithNoGeometry =
config.value( QStringLiteral(
"allow_add_child_feature_with_no_geometry" ),
false ).toBool();
840 Q_UNUSED( newRelation );
841 Q_UNUSED( newFeature );
870 Q_UNUSED( newRelation );
871 Q_UNUSED( newNmRelation );
905 return mFeatureSelectionMgr;
910 const QgsFeatureIds selectedFids = selectedChildFeatureIds();
926 const QgsFeatureIds selectedFids = selectedChildFeatureIds();
953 QgsRelationEditorWidget::Buttons buttons;
965 {
"show_first_feature", mShowFirstFeature->isChecked()},
966 {
"allow_add_child_feature_with_no_geometry", mAllowAddChildFeatureWithNoGeometry->isChecked()}
981 mShowFirstFeature->setChecked(
config.value( QStringLiteral(
"show_first_feature" ),
true ).toBool() );
982 mAllowAddChildFeatureWithNoGeometry->setChecked(
config.value( QStringLiteral(
"allow_add_child_feature_with_no_geometry" ),
false ).toBool() );
997 return QStringLiteral(
"relation_editor" );
1002 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.
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)
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.
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