QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsfeaturefilterwidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsfeaturefilterwidget.cpp
3 --------------------------------------
4 Date : 20.9.2019
5 Copyright : (C) 2019 Julien Cabieces
6 Email : julien dot cabieces at oslandia dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
18//
19// W A R N I N G
20// -------------
21//
22// This file is not part of the QGIS API. It exists purely as an
23// implementation detail. This header file may change from version to
24// version without notice, or even be removed.
25//
26
28
29#include "qgsapplication.h"
31#include "qgsdualview.h"
36#include "qgsgui.h"
37#include "qgsdialog.h"
39#include "qgsmessagebar.h"
40
41#include <QMenu>
42
43QgsFeatureFilterWidget::QgsFeatureFilterWidget( QWidget *parent )
44 : QWidget( parent )
45{
46 setupUi( this );
47
48 // Initialize filter gui elements
49 mFilterColumnsMenu = new QMenu( this );
50 mActionFilterColumnsMenu->setMenu( mFilterColumnsMenu );
51 mStoredFilterExpressionMenu = new QMenu( this );
52 mActionStoredFilterExpressions->setMenu( mStoredFilterExpressionMenu );
53
54 // Set filter icon in a couple of places
55 mActionShowAllFilter->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.svg" ) );
56 mActionAdvancedFilter->setIcon( QgsApplication::getThemeIcon( "/mActionFilter2.svg" ) );
57 mActionSelectedFilter->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTableSelected.svg" ) );
58 mActionInvalidFilter->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTableInvalid.svg" ) );
59 mActionVisibleFilter->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTableVisible.svg" ) );
60 mActionEditedFilter->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTableEdited.svg" ) );
61
62
63 // Set button to store or delete stored filter expressions
64 mStoreFilterExpressionButton->setDefaultAction( mActionHandleStoreFilterExpression );
65 connect( mActionSaveAsStoredFilterExpression, &QAction::triggered, this, &QgsFeatureFilterWidget::saveAsStoredFilterExpression );
66 connect( mActionEditStoredFilterExpression, &QAction::triggered, this, &QgsFeatureFilterWidget::editStoredFilterExpression );
67 connect( mActionHandleStoreFilterExpression, &QAction::triggered, this, &QgsFeatureFilterWidget::handleStoreFilterExpression );
68 mApplyFilterButton->setDefaultAction( mActionApplyFilter );
69
70 // Connect filter signals
71 connect( mActionAdvancedFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterExpressionBuilder );
72 connect( mActionShowAllFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterShowAll );
73 connect( mActionSelectedFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterSelected );
74 connect( mActionInvalidFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterInvalid );
75 connect( mActionVisibleFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterVisible );
76 connect( mActionEditedFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterEdited );
77 connect( mFilterQuery, &QLineEdit::returnPressed, this, &QgsFeatureFilterWidget::filterQueryAccepted );
78 connect( mActionApplyFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterQueryAccepted );
79 connect( mFilterQuery, &QLineEdit::textChanged, this, &QgsFeatureFilterWidget::onFilterQueryTextChanged );
80}
81
82void QgsFeatureFilterWidget::init( QgsVectorLayer *layer, const QgsAttributeEditorContext &context, QgsDualView *mainView,
83 QgsMessageBar *messageBar, int )
84{
85 mMainView = mainView;
86 mLayer = layer;
87 mEditorContext = context;
88 mMessageBar = messageBar;
89
90 connect( mLayer, &QgsVectorLayer::attributeAdded, this, &QgsFeatureFilterWidget::columnBoxInit );
91 connect( mLayer, &QgsVectorLayer::attributeDeleted, this, &QgsFeatureFilterWidget::columnBoxInit );
92
93 //set delay on entering text
94 mFilterQueryTimer.setSingleShot( true );
95 connect( &mFilterQueryTimer, &QTimer::timeout, this, &QgsFeatureFilterWidget::updateCurrentStoredFilterExpression );
96
97 columnBoxInit();
98 storedFilterExpressionBoxInit();
99 storeExpressionButtonInit();
100}
101
102void QgsFeatureFilterWidget::filterShowAll()
103{
104 mFilterButton->setDefaultAction( mActionShowAllFilter );
105 mFilterButton->setPopupMode( QToolButton::InstantPopup );
106 mFilterQuery->setVisible( false );
107 mFilterQuery->setText( QString() );
108 if ( mCurrentSearchWidgetWrapper )
109 {
110 mCurrentSearchWidgetWrapper->widget()->setVisible( false );
111 }
112 mApplyFilterButton->setVisible( false );
113 mStoreFilterExpressionButton->setVisible( false );
114 mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowAll );
115}
116
117void QgsFeatureFilterWidget::filterSelected()
118{
119 mFilterButton->setDefaultAction( mActionSelectedFilter );
120 mFilterButton->setPopupMode( QToolButton::InstantPopup );
121 mFilterQuery->setVisible( false );
122 mApplyFilterButton->setVisible( false );
123 mStoreFilterExpressionButton->setVisible( false );
124 mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowSelected );
125}
126
127void QgsFeatureFilterWidget::filterVisible()
128{
129 if ( !mLayer->isSpatial() )
130 {
131 filterShowAll();
132 return;
133 }
134
135 mFilterButton->setDefaultAction( mActionVisibleFilter );
136 mFilterButton->setPopupMode( QToolButton::InstantPopup );
137 mFilterQuery->setVisible( false );
138 mApplyFilterButton->setVisible( false );
139 mStoreFilterExpressionButton->setVisible( false );
140 mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowVisible );
141}
142
143void QgsFeatureFilterWidget::filterInvalid()
144{
145 mFilterButton->setDefaultAction( mActionInvalidFilter );
146 mFilterButton->setPopupMode( QToolButton::InstantPopup );
147 mFilterQuery->setVisible( false );
148 mApplyFilterButton->setVisible( false );
149 mStoreFilterExpressionButton->setVisible( false );
151 mMainView->filterFeatures( QStringLiteral( "is_feature_valid() = false" ), context );
152 mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowInvalid );
153}
154
155void QgsFeatureFilterWidget::filterEdited()
156{
157 mFilterButton->setDefaultAction( mActionEditedFilter );
158 mFilterButton->setPopupMode( QToolButton::InstantPopup );
159 mFilterQuery->setVisible( false );
160 mApplyFilterButton->setVisible( false );
161 mStoreFilterExpressionButton->setVisible( false );
162 mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowEdited );
163}
164
165
166void QgsFeatureFilterWidget::filterQueryAccepted()
167{
168 if ( ( mFilterQuery->isVisible() && mFilterQuery->text().isEmpty() ) ||
169 ( mCurrentSearchWidgetWrapper && mCurrentSearchWidgetWrapper->widget()->isVisible()
170 && mCurrentSearchWidgetWrapper->expression().isEmpty() ) )
171 {
172 filterShowAll();
173 return;
174 }
175 filterQueryChanged( mFilterQuery->text() );
176}
177
178void QgsFeatureFilterWidget::filterQueryChanged( const QString &query )
179{
180 QString str;
181 if ( mFilterButton->defaultAction() == mActionAdvancedFilter )
182 {
183 str = query;
184 }
185 else if ( mCurrentSearchWidgetWrapper )
186 {
187 str = mCurrentSearchWidgetWrapper->expression();
188 }
189
190 setFilterExpression( str );
191}
192
193void QgsFeatureFilterWidget::columnBoxInit()
194{
195 const auto constActions = mFilterColumnsMenu->actions();
196 for ( QAction *a : constActions )
197 {
198 mFilterColumnsMenu->removeAction( a );
199 mFilterButton->removeAction( a );
200 delete a;
201 }
202
203 mFilterButton->addAction( mActionShowAllFilter );
204 mFilterButton->addAction( mActionSelectedFilter );
205 if ( mLayer->isSpatial() )
206 {
207 mFilterButton->addAction( mActionVisibleFilter );
208 }
209 mFilterButton->addAction( mActionInvalidFilter );
210 mFilterButton->addAction( mActionEditedFilter );
211 mFilterButton->addAction( mActionFilterColumnsMenu );
212 mFilterButton->addAction( mActionAdvancedFilter );
213 mFilterButton->addAction( mActionStoredFilterExpressions );
214
215 const QList<QgsField> fields = mLayer->fields().toList();
216
217 const auto constFields = fields;
218 for ( const QgsField &field : constFields )
219 {
220 const int idx = mLayer->fields().lookupField( field.name() );
221 if ( idx < 0 )
222 continue;
223
224 if ( QgsGui::editorWidgetRegistry()->findBest( mLayer, field.name() ).type() != QLatin1String( "Hidden" ) )
225 {
226 const QIcon icon = mLayer->fields().iconForField( idx );
227 const QString alias = mLayer->attributeDisplayName( idx );
228
229 // Generate action for the filter popup button
230 QAction *filterAction = new QAction( icon, alias, mFilterButton );
231 filterAction->setData( field.name() );
232
233 connect( filterAction, &QAction::triggered, this, [ = ] { filterColumnChanged( filterAction ); } );
234 mFilterColumnsMenu->addAction( filterAction );
235 }
236 }
237}
238
239void QgsFeatureFilterWidget::handleStoreFilterExpression()
240{
241 if ( !mActionHandleStoreFilterExpression->isChecked() )
242 {
243 mLayer->storedExpressionManager()->removeStoredExpression( mActionHandleStoreFilterExpression->data().toString() );
244 }
245 else
246 {
247 mLayer->storedExpressionManager()->addStoredExpression( mFilterQuery->text(), mFilterQuery->text() );
248 }
249
250 updateCurrentStoredFilterExpression();
251 storedFilterExpressionBoxInit();
252}
253
254void QgsFeatureFilterWidget::storedFilterExpressionBoxInit()
255{
256 const auto constActions = mStoredFilterExpressionMenu->actions();
257 for ( QAction *a : constActions )
258 {
259 mStoredFilterExpressionMenu->removeAction( a );
260 delete a;
261 }
262
263 const QList< QgsStoredExpression > storedExpressions = mLayer->storedExpressionManager()->storedExpressions();
264 for ( const QgsStoredExpression &storedExpression : storedExpressions )
265 {
266 QAction *storedExpressionAction = new QAction( storedExpression.name, mFilterButton );
267 connect( storedExpressionAction, &QAction::triggered, this, [ = ]()
268 {
269 setFilterExpression( storedExpression.expression, QgsAttributeForm::ReplaceFilter, true );
270 } );
271 mStoredFilterExpressionMenu->addAction( storedExpressionAction );
272 }
273}
274
275void QgsFeatureFilterWidget::storeExpressionButtonInit()
276{
277 if ( mActionHandleStoreFilterExpression->isChecked() )
278 {
279 mActionHandleStoreFilterExpression->setToolTip( tr( "Delete stored expression" ) );
280 mActionHandleStoreFilterExpression->setText( tr( "Delete Stored Expression" ) );
281 mActionHandleStoreFilterExpression->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionHandleStoreFilterExpressionChecked.svg" ) ) );
282 mStoreFilterExpressionButton->removeAction( mActionSaveAsStoredFilterExpression );
283 mStoreFilterExpressionButton->addAction( mActionEditStoredFilterExpression );
284 }
285 else
286 {
287 mActionHandleStoreFilterExpression->setToolTip( tr( "Save expression with the text as name" ) );
288 mActionHandleStoreFilterExpression->setText( tr( "Save Expression" ) );
289 mActionHandleStoreFilterExpression->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionHandleStoreFilterExpressionUnchecked.svg" ) ) );
290 mStoreFilterExpressionButton->addAction( mActionSaveAsStoredFilterExpression );
291 mStoreFilterExpressionButton->removeAction( mActionEditStoredFilterExpression );
292 }
293}
294
295
296void QgsFeatureFilterWidget::filterColumnChanged( QAction *filterAction )
297{
298 mFilterButton->setDefaultAction( filterAction );
299 mFilterButton->setPopupMode( QToolButton::InstantPopup );
300 // replace the search line edit with a search widget that is suited to the selected field
301 // delete previous widget
302 if ( mCurrentSearchWidgetWrapper )
303 {
304 mCurrentSearchWidgetWrapper->widget()->setVisible( false );
305 delete mCurrentSearchWidgetWrapper;
306 }
307 const QString fieldName = mFilterButton->defaultAction()->data().toString();
308 // get the search widget
309 const int fldIdx = mLayer->fields().lookupField( fieldName );
310 if ( fldIdx < 0 )
311 return;
312 const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mLayer, fieldName );
313 mCurrentSearchWidgetWrapper = QgsGui::editorWidgetRegistry()->
314 createSearchWidget( setup.type(), mLayer, fldIdx, setup.config(), mFilterContainer, mEditorContext );
315 if ( mCurrentSearchWidgetWrapper->applyDirectly() )
316 {
317 connect( mCurrentSearchWidgetWrapper, &QgsSearchWidgetWrapper::expressionChanged, this, &QgsFeatureFilterWidget::filterQueryChanged );
318 mApplyFilterButton->setVisible( false );
319 mStoreFilterExpressionButton->setVisible( false );
320 }
321 else
322 {
323 connect( mCurrentSearchWidgetWrapper, &QgsSearchWidgetWrapper::expressionChanged, this, &QgsFeatureFilterWidget::filterQueryAccepted );
324 mApplyFilterButton->setVisible( true );
325 mStoreFilterExpressionButton->setVisible( true );
326 }
327
328 replaceSearchWidget( mFilterQuery, mCurrentSearchWidgetWrapper->widget() );
329}
330
331void QgsFeatureFilterWidget::filterExpressionBuilder()
332{
333 // Show expression builder
335
336 QgsExpressionBuilderDialog dlg( mLayer, mFilterQuery->text(), this, QStringLiteral( "generic" ), context );
337 dlg.setWindowTitle( tr( "Expression Based Filter" ) );
338
339 QgsDistanceArea myDa;
340 myDa.setSourceCrs( mLayer->crs(), QgsProject::instance()->transformContext() );
341 myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );
342 dlg.setGeomCalculator( myDa );
343
344 if ( dlg.exec() == QDialog::Accepted )
345 {
346 setFilterExpression( dlg.expressionText(), QgsAttributeForm::ReplaceFilter, true );
347 }
348}
349
350void QgsFeatureFilterWidget::saveAsStoredFilterExpression()
351{
352 QgsDialog *dlg = new QgsDialog( this, Qt::WindowFlags(), QDialogButtonBox::Save | QDialogButtonBox::Cancel );
353 dlg->setWindowTitle( tr( "Save Expression As" ) );
354 QVBoxLayout *layout = dlg->layout();
355 dlg->resize( std::max( 400, this->width() / 2 ), dlg->height() );
356
357 QLabel *nameLabel = new QLabel( tr( "Name" ), dlg );
358 QLineEdit *nameEdit = new QLineEdit( dlg );
359 layout->addWidget( nameLabel );
360 layout->addWidget( nameEdit );
361 nameEdit->setFocus();
362
363 if ( dlg->exec() == QDialog::Accepted )
364 {
365 mLayer->storedExpressionManager()->addStoredExpression( nameEdit->text(), mFilterQuery->text() );
366
367 updateCurrentStoredFilterExpression();
368 storedFilterExpressionBoxInit();
369 }
370}
371
372void QgsFeatureFilterWidget::editStoredFilterExpression()
373{
374 QgsDialog *dlg = new QgsDialog( this, Qt::WindowFlags(), QDialogButtonBox::Save | QDialogButtonBox::Cancel );
375 dlg->setWindowTitle( tr( "Edit expression" ) );
376 QVBoxLayout *layout = dlg->layout();
377 dlg->resize( std::max( 400, this->width() / 2 ), dlg->height() );
378
379 QLabel *nameLabel = new QLabel( tr( "Name" ), dlg );
380 QLineEdit *nameEdit = new QLineEdit( mLayer->storedExpressionManager()->storedExpression( mActionHandleStoreFilterExpression->data().toString() ).name, dlg );
381 QLabel *expressionLabel = new QLabel( tr( "Expression" ), dlg );
382 QgsExpressionLineEdit *expressionEdit = new QgsExpressionLineEdit( dlg );
383 expressionEdit->setExpression( mLayer->storedExpressionManager()->storedExpression( mActionHandleStoreFilterExpression->data().toString() ).expression );
384
385 layout->addWidget( nameLabel );
386 layout->addWidget( nameEdit );
387 layout->addWidget( expressionLabel );
388 layout->addWidget( expressionEdit );
389 nameEdit->setFocus();
390
391 if ( dlg->exec() == QDialog::Accepted )
392 {
393 //update stored expression
394 mLayer->storedExpressionManager()->updateStoredExpression( mActionHandleStoreFilterExpression->data().toString(), nameEdit->text(), expressionEdit->expression(), QgsStoredExpression::Category::FilterExpression );
395
396 //update text
397 mFilterQuery->setValue( expressionEdit->expression() );
398
399 storedFilterExpressionBoxInit();
400 }
401}
402
403void QgsFeatureFilterWidget::updateCurrentStoredFilterExpression()
404{
405 const QgsStoredExpression currentStoredExpression = mLayer->storedExpressionManager()->findStoredExpressionByExpression( mFilterQuery->value() );
406
407 //set checked when it's an existing stored expression
408 mActionHandleStoreFilterExpression->setChecked( !currentStoredExpression.id.isNull() );
409
410 mActionHandleStoreFilterExpression->setData( currentStoredExpression.id );
411 mActionEditStoredFilterExpression->setData( currentStoredExpression.id );
412
413 //update bookmark button
414 storeExpressionButtonInit();
415}
416
417void QgsFeatureFilterWidget::setFilterExpression( const QString &filterString, QgsAttributeForm::FilterType type, bool alwaysShowFilter )
418{
419 QString filter;
420 if ( !mFilterQuery->text().isEmpty() && !filterString.isEmpty() )
421 {
422 switch ( type )
423 {
425 filter = filterString;
426 break;
427
429 filter = QStringLiteral( "(%1) AND (%2)" ).arg( mFilterQuery->text(), filterString );
430 break;
431
433 filter = QStringLiteral( "(%1) OR (%2)" ).arg( mFilterQuery->text(), filterString );
434 break;
435 }
436 }
437 else if ( !filterString.isEmpty() )
438 {
439 filter = filterString;
440 }
441 else
442 {
443 filterShowAll();
444 return;
445 }
446
447 mFilterQuery->setText( filter );
448
449 if ( alwaysShowFilter || !mCurrentSearchWidgetWrapper || !mCurrentSearchWidgetWrapper->applyDirectly() )
450 {
451
452 mFilterButton->setDefaultAction( mActionAdvancedFilter );
453 mFilterButton->setPopupMode( QToolButton::MenuButtonPopup );
454 mFilterQuery->setVisible( true );
455 mApplyFilterButton->setVisible( true );
456 mStoreFilterExpressionButton->setVisible( true );
457 if ( mCurrentSearchWidgetWrapper )
458 {
459 // replace search widget widget with the normal filter query line edit
460 replaceSearchWidget( mCurrentSearchWidgetWrapper->widget(), mFilterQuery );
461 }
462 }
463
464 // parse search string and build parsed tree
465 QgsExpression filterExpression( filter );
466 if ( filterExpression.hasParserError() )
467 {
468 mMessageBar->pushMessage( tr( "Parsing error" ), filterExpression.parserErrorString(), Qgis::MessageLevel::Warning );
469 return;
470 }
471
473
474 if ( !filterExpression.prepare( &context ) )
475 {
476 mMessageBar->pushMessage( tr( "Evaluation error" ), filterExpression.evalErrorString(), Qgis::MessageLevel::Warning );
477 }
478
479 mMainView->filterFeatures( filterExpression, context );
480 mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowFilteredList );
481}
482
483void QgsFeatureFilterWidget::replaceSearchWidget( QWidget *oldw, QWidget *neww )
484{
485 mFilterLayout->removeWidget( oldw );
486 oldw->setVisible( false );
487 mFilterLayout->addWidget( neww, 0, 0 );
488 neww->setVisible( true );
489 neww->setFocus();
490}
491
492void QgsFeatureFilterWidget::onFilterQueryTextChanged( const QString &value )
493{
494 Q_UNUSED( value );
495 mFilterQueryTimer.start( 300 );
496}
497
@ Warning
Warning message.
Definition qgis.h:156
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.
FilterType
Filter types.
@ ReplaceFilter
Filter should replace any existing filter.
@ FilterOr
Filter should be combined using "OR".
@ FilterAnd
Filter should be combined using "AND".
@ ShowFilteredList
Show only features whose ids are on the filter list. {.
@ ShowVisible
Show only visible features (depends on the map canvas)
@ ShowSelected
Show only selected features.
@ ShowInvalid
Show only features not respecting constraints.
@ ShowEdited
Show only features which have unsaved changes.
A generic dialog with layout and button box.
Definition qgsdialog.h:34
QVBoxLayout * layout()
Returns the central layout. Widgets added to it must have this dialog as parent.
Definition qgsdialog.h:46
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
void setSourceCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets source spatial reference system crs.
bool setEllipsoid(const QString &ellipsoid)
Sets the ellipsoid by its acronym.
This widget is used to show the attributes of a set of features of a QgsVectorLayer.
Definition qgsdualview.h:45
QgsEditorWidgetSetup findBest(const QgsVectorLayer *vl, const QString &fieldName) const
Find the best editor widget and its configuration for a given field.
Holder for the widget type and its configuration for a field.
QVariantMap config() const
A generic dialog for building expression strings.
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...
The QgsExpressionLineEdit widget includes a line edit for entering expressions together with a button...
QString expression() const
Returns the current expression shown in the widget.
void setExpression(const QString &expression)
Sets the current expression to show in the widget.
Class for parsing and evaluation of expressions (formerly called "search strings").
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:53
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories.
Definition qgsgui.cpp:94
A bar for displaying non-blocking messages to the user.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsCoordinateTransformContext transformContext
Definition qgsproject.h:113
void expressionChanged(const QString &exp)
Emitted whenever the expression changes.
Stored expression containing name, content (expression text) and a category tag.
@ FilterExpression
Expressions to filter features.
QString id
generated uuid used for identification
Represents a vector layer which manages a vector based data sets.
void attributeAdded(int idx)
Will be emitted, when a new attribute has been added to this vector layer.
void attributeDeleted(int idx)
Will be emitted, when an attribute has been deleted from this vector layer.
#define str(x)
Definition qgis.cpp:39