QGIS API Documentation  2.14.0-Essen
qgsdualview.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdualview.cpp
3  --------------------------------------
4  Date : 10.2.2013
5  Copyright : (C) 2013 Matthias Kuhn
6  Email : matthias at opengis dot ch
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 
16 #include "qgsapplication.h"
17 #include "qgsattributeaction.h"
18 #include "qgsattributeform.h"
19 #include "qgsattributetablemodel.h"
20 #include "qgsdualview.h"
22 #include "qgsfeaturelistmodel.h"
24 #include "qgsmapcanvas.h"
26 #include "qgsmessagelog.h"
27 #include "qgsvectordataprovider.h"
28 #include "qgsvectorlayercache.h"
29 
30 #include <QDialog>
31 #include <QMenu>
32 #include <QMessageBox>
33 #include <QProgressDialog>
34 
36  : QStackedWidget( parent )
37  , mEditorContext()
38  , mMasterModel( nullptr )
39  , mFilterModel( nullptr )
40  , mFeatureListModel( nullptr )
41  , mAttributeForm( nullptr )
42  , mLayerCache( nullptr )
43  , mProgressDlg( nullptr )
44  , mFeatureSelectionManager( nullptr )
45 {
46  setupUi( this );
47 
48  mConditionalFormatWidget->hide();
49 
50  mPreviewActionMapper = new QSignalMapper( this );
51 
52  mPreviewColumnsMenu = new QMenu( this );
53  mActionPreviewColumnsMenu->setMenu( mPreviewColumnsMenu );
54 
55  // Set preview icon
56  mActionExpressionPreview->setIcon( QgsApplication::getThemeIcon( "/mIconExpressionPreview.svg" ) );
57 
58  // Connect layer list preview signals
59  connect( mActionExpressionPreview, SIGNAL( triggered() ), SLOT( previewExpressionBuilder() ) );
60  connect( mPreviewActionMapper, SIGNAL( mapped( QObject* ) ), SLOT( previewColumnChanged( QObject* ) ) );
61  connect( mFeatureList, SIGNAL( displayExpressionChanged( QString ) ), this, SLOT( previewExpressionChanged( QString ) ) );
62 }
63 
64 void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsFeatureRequest &request, const QgsAttributeEditorContext &context )
65 {
66  mEditorContext = context;
67 
68  connect( mTableView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) );
69 
70  initLayerCache( layer, !request.filterRect().isNull() );
71  initModels( mapCanvas, request );
72 
73  mConditionalFormatWidget->setLayer( layer );
74 
75  mTableView->setModel( mFilterModel );
76  mFeatureList->setModel( mFeatureListModel );
77  mAttributeForm = new QgsAttributeForm( layer, QgsFeature(), mEditorContext );
78  if ( !mAttributeEditorScrollArea->layout() )
79  mAttributeEditorScrollArea->setLayout( new QGridLayout() );
80  mAttributeEditorScrollArea->layout()->addWidget( mAttributeForm );
81  mAttributeEditorScrollArea->setWidget( mAttributeForm );
82 
83  mAttributeForm->hideButtonBox();
84 
85  connect( mAttributeForm, SIGNAL( attributeChanged( QString, QVariant ) ), this, SLOT( featureFormAttributeChanged() ) );
86  connect( mMasterModel, SIGNAL( modelChanged() ), mAttributeForm, SLOT( refreshFeature() ) );
87 
88  if ( mFeatureListPreviewButton->defaultAction() )
89  mFeatureList->setDisplayExpression( mDisplayExpression );
90  else
91  columnBoxInit();
92 
93  // This slows down load of the attribute table heaps and uses loads of memory.
94  //mTableView->resizeColumnsToContents();
95 
96  mFeatureList->setEditSelection( QgsFeatureIds() << mFeatureListModel->idxToFid( mFeatureListModel->index( 0, 0 ) ) );
97 }
98 
100 {
101  // load fields
102  QList<QgsField> fields = mLayerCache->layer()->fields().toList();
103 
104  QString defaultField;
105 
106  // default expression: saved value
107  QString displayExpression = mLayerCache->layer()->displayExpression();
108 
109  // if no display expression is saved: use display field instead
110  if ( displayExpression == "" )
111  {
112  if ( mLayerCache->layer()->displayField() != "" )
113  {
114  defaultField = mLayerCache->layer()->displayField();
115  displayExpression = QString( "COALESCE(\"%1\", '<NULL>')" ).arg( defaultField );
116  }
117  }
118 
119  // if neither diaplay expression nor display field is saved...
120  if ( displayExpression == "" )
121  {
122  QgsAttributeList pkAttrs = mLayerCache->layer()->pkAttributeList();
123 
124  if ( !pkAttrs.isEmpty() )
125  {
126  if ( pkAttrs.size() == 1 )
127  defaultField = pkAttrs.at( 0 );
128 
129  // ... If there are primary key(s) defined
130  QStringList pkFields;
131 
132  Q_FOREACH ( int attr, pkAttrs )
133  {
134  pkFields.append( "COALESCE(\"" + fields[attr].name() + "\", '<NULL>')" );
135  }
136 
137  displayExpression = pkFields.join( "||', '||" );
138  }
139  else if ( !fields.isEmpty() )
140  {
141  if ( fields.size() == 1 )
142  defaultField = fields.at( 0 ).name();
143 
144  // ... concat all fields
145  QStringList fieldNames;
146  Q_FOREACH ( const QgsField& field, fields )
147  {
148  fieldNames.append( "COALESCE(\"" + field.name() + "\", '<NULL>')" );
149  }
150 
151  displayExpression = fieldNames.join( "||', '||" );
152  }
153  else
154  {
155  // ... there isn't really much to display
156  displayExpression = "'[Please define preview text]'";
157  }
158  }
159 
160  mFeatureListPreviewButton->addAction( mActionExpressionPreview );
161  mFeatureListPreviewButton->addAction( mActionPreviewColumnsMenu );
162 
163  Q_FOREACH ( const QgsField& field, fields )
164  {
165  int fieldIndex = mLayerCache->layer()->fieldNameIndex( field.name() );
166  if ( fieldIndex == -1 )
167  continue;
168 
169  if ( mLayerCache->layer()->editFormConfig()->widgetType( fieldIndex ) != "Hidden" )
170  {
171  QIcon icon = QgsApplication::getThemeIcon( "/mActionNewAttribute.png" );
172  QString text = field.name();
173 
174  // Generate action for the preview popup button of the feature list
175  QAction* previewAction = new QAction( icon, text, mFeatureListPreviewButton );
176  mPreviewActionMapper->setMapping( previewAction, previewAction );
177  connect( previewAction, SIGNAL( triggered() ), mPreviewActionMapper, SLOT( map() ) );
178  mPreviewColumnsMenu->addAction( previewAction );
179 
180  if ( text == defaultField )
181  {
182  mFeatureListPreviewButton->setDefaultAction( previewAction );
183  }
184  }
185  }
186 
187  // If there is no single field found as preview
188  if ( !mFeatureListPreviewButton->defaultAction() )
189  {
190  mFeatureList->setDisplayExpression( displayExpression );
191  mFeatureListPreviewButton->setDefaultAction( mActionExpressionPreview );
192  mDisplayExpression = mFeatureList->displayExpression();
193  }
194  else
195  {
196  mFeatureListPreviewButton->defaultAction()->trigger();
197  }
198 }
199 
201 {
202  setCurrentIndex( view );
203 }
204 
206 {
207  mFilterModel->setFilterMode( filterMode );
208  emit filterChanged();
209 }
210 
211 void QgsDualView::setSelectedOnTop( bool selectedOnTop )
212 {
213  mFilterModel->setSelectedOnTop( selectedOnTop );
214 }
215 
216 void QgsDualView::initLayerCache( QgsVectorLayer* layer, bool cacheGeometry )
217 {
218  // Initialize the cache
219  QSettings settings;
220  int cacheSize = settings.value( "/qgis/attributeTableRowCache", "10000" ).toInt();
221  mLayerCache = new QgsVectorLayerCache( layer, cacheSize, this );
222  mLayerCache->setCacheGeometry( cacheGeometry );
223  if ( 0 == cacheSize || 0 == ( QgsVectorDataProvider::SelectAtId & mLayerCache->layer()->dataProvider()->capabilities() ) )
224  {
225  connect( mLayerCache, SIGNAL( progress( int, bool & ) ), this, SLOT( progress( int, bool & ) ) );
226  connect( mLayerCache, SIGNAL( finished() ), this, SLOT( finished() ) );
227 
228  mLayerCache->setFullCache( true );
229  }
230 }
231 
232 void QgsDualView::initModels( QgsMapCanvas* mapCanvas, const QgsFeatureRequest& request )
233 {
234  delete mFeatureListModel;
235  delete mFilterModel;
236  delete mMasterModel;
237 
238  mMasterModel = new QgsAttributeTableModel( mLayerCache, this );
239  mMasterModel->setRequest( request );
240  mMasterModel->setEditorContext( mEditorContext );
241 
242  connect( mMasterModel, SIGNAL( progress( int, bool & ) ), this, SLOT( progress( int, bool & ) ) );
243  connect( mMasterModel, SIGNAL( finished() ), this, SLOT( finished() ) );
244 
245  connect( mConditionalFormatWidget, SIGNAL( rulesUpdated( QString ) ), mMasterModel, SLOT( fieldConditionalStyleChanged( QString ) ) );
246 
247  mMasterModel->loadLayer();
248 
249  mFilterModel = new QgsAttributeTableFilterModel( mapCanvas, mMasterModel, mMasterModel );
250 
251  connect( mFeatureList, SIGNAL( displayExpressionChanged( QString ) ), this, SIGNAL( displayExpressionChanged( QString ) ) );
252 
253  mFeatureListModel = new QgsFeatureListModel( mFilterModel, mFilterModel );
254 }
255 
256 void QgsDualView::on_mFeatureList_aboutToChangeEditSelection( bool& ok )
257 {
258  if ( mLayerCache->layer()->isEditable() && !mAttributeForm->save() )
259  ok = false;
260 }
261 
262 void QgsDualView::on_mFeatureList_currentEditSelectionChanged( const QgsFeature &feat )
263 {
264  if ( !mLayerCache->layer()->isEditable() || mAttributeForm->save() )
265  {
266  mAttributeForm->setFeature( feat );
268  }
269  else
270  {
271  // Couldn't save feature
272  }
273 }
274 
276 {
277  mFeatureList->setCurrentFeatureEdited( false );
278  mFeatureList->setEditSelection( fids );
279 }
280 
282 {
283  return mAttributeForm->save();
284 }
285 
287 {
288  mConditionalFormatWidget->setVisible( !mConditionalFormatWidget->isVisible() );
289  mConditionalFormatWidget->viewRules();
290 }
291 
292 void QgsDualView::previewExpressionBuilder()
293 {
294  // Show expression builder
295  QgsExpressionContext context;
298  << QgsExpressionContextUtils::layerScope( mLayerCache->layer() );
299 
300  QgsExpressionBuilderDialog dlg( mLayerCache->layer(), mFeatureList->displayExpression(), this, "generic", context );
301  dlg.setWindowTitle( tr( "Expression based preview" ) );
302  dlg.setExpressionText( mFeatureList->displayExpression() );
303 
304  if ( dlg.exec() == QDialog::Accepted )
305  {
306  mFeatureList->setDisplayExpression( dlg.expressionText() );
307  mFeatureListPreviewButton->setDefaultAction( mActionExpressionPreview );
308  mFeatureListPreviewButton->setPopupMode( QToolButton::MenuButtonPopup );
309  }
310 
311  mDisplayExpression = mFeatureList->displayExpression();
312 }
313 
314 void QgsDualView::previewColumnChanged( QObject* action )
315 {
316  QAction* previewAction = qobject_cast< QAction* >( action );
317 
318  if ( previewAction )
319  {
320  if ( !mFeatureList->setDisplayExpression( QString( "COALESCE( \"%1\", '<NULL>' )" ).arg( previewAction->text() ) ) )
321  {
322  QMessageBox::warning( this,
323  tr( "Could not set preview column" ),
324  tr( "Could not set column '%1' as preview column.\nParser error:\n%2" )
325  .arg( previewAction->text(), mFeatureList->parserErrorString() )
326  );
327  }
328  else
329  {
330  mFeatureListPreviewButton->setDefaultAction( previewAction );
331  mFeatureListPreviewButton->setPopupMode( QToolButton::InstantPopup );
332  }
333  }
334 
335  mDisplayExpression = mFeatureList->displayExpression();
336 
337  Q_ASSERT( previewAction );
338 }
339 
341 {
342  return mMasterModel->rowCount();
343 }
344 
346 {
347  return mFilterModel->rowCount();
348 }
349 
350 void QgsDualView::viewWillShowContextMenu( QMenu* menu, const QModelIndex& atIndex )
351 {
352  if ( !menu )
353  {
354  return;
355  }
356 
357  QgsVectorLayer* vl = mFilterModel->layer();
358  QgsMapCanvas* canvas = mFilterModel->mapCanvas();
359  if ( canvas && vl && vl->geometryType() != QGis::NoGeometry )
360  {
361  menu->addAction( tr( "Zoom to feature" ), this, SLOT( zoomToCurrentFeature() ) );
362  }
363 
364  QModelIndex sourceIndex = mFilterModel->mapToSource( atIndex );
365 
366  //add user-defined actions to context menu
367  if ( mLayerCache->layer()->actions()->size() != 0 )
368  {
369 
370  QAction *a = menu->addAction( tr( "Run layer action" ) );
371  a->setEnabled( false );
372 
373  for ( int i = 0; i < mLayerCache->layer()->actions()->size(); i++ )
374  {
375  const QgsAction &action = mLayerCache->layer()->actions()->at( i );
376 
377  if ( !action.runable() )
378  continue;
379 
380  QgsAttributeTableAction *a = new QgsAttributeTableAction( action.name(), this, i, sourceIndex );
381  menu->addAction( action.name(), a, SLOT( execute() ) );
382  }
383  }
384 
385  //add actions from QgsMapLayerActionRegistry to context menu
387  if ( !registeredActions.isEmpty() )
388  {
389  //add a separator between user defined and standard actions
390  menu->addSeparator();
391 
393  for ( actionIt = registeredActions.begin(); actionIt != registeredActions.end(); ++actionIt )
394  {
395  QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction(( *actionIt )->text(), this, ( *actionIt ), sourceIndex );
396  menu->addAction(( *actionIt )->text(), a, SLOT( execute() ) );
397  }
398  }
399 
400  menu->addSeparator();
401  QgsAttributeTableAction *a = new QgsAttributeTableAction( tr( "Open form" ), this, -1, sourceIndex );
402  menu->addAction( tr( "Open form" ), a, SLOT( featureForm() ) );
403 }
404 
405 void QgsDualView::zoomToCurrentFeature()
406 {
407  QModelIndex currentIndex = mTableView->currentIndex();
408  if ( !currentIndex.isValid() )
409  {
410  return;
411  }
412 
413  QgsFeatureIds ids;
414  ids.insert( mFilterModel->rowToId( currentIndex ) );
415  QgsMapCanvas* canvas = mFilterModel->mapCanvas();
416  if ( canvas )
417  {
418  canvas->zoomToFeatureIds( mLayerCache->layer(), ids );
419  }
420 }
421 
422 void QgsDualView::previewExpressionChanged( const QString& expression )
423 {
424  mLayerCache->layer()->setDisplayExpression( expression );
425 }
426 
427 void QgsDualView::featureFormAttributeChanged()
428 {
429  mFeatureList->setCurrentFeatureEdited( true );
430 }
431 
433 {
434  mFilterModel->setFilteredFeatures( filteredFeatures );
435 }
436 
438 {
439  mMasterModel->setRequest( request );
440 }
441 
443 {
444  mTableView->setFeatureSelectionManager( featureSelectionManager );
445  mFeatureList->setFeatureSelectionManager( featureSelectionManager );
446 
447  if ( mFeatureSelectionManager && mFeatureSelectionManager->parent() == this )
448  delete mFeatureSelectionManager;
449 
450  mFeatureSelectionManager = featureSelectionManager;
451 }
452 
453 void QgsDualView::progress( int i, bool& cancel )
454 {
455  if ( !mProgressDlg )
456  {
457  mProgressDlg = new QProgressDialog( tr( "Loading features..." ), tr( "Abort" ), 0, 0, this );
458  mProgressDlg->setWindowTitle( tr( "Attribute table" ) );
459  mProgressDlg->setWindowModality( Qt::WindowModal );
460  mProgressDlg->show();
461  }
462 
463  mProgressDlg->setValue( i );
464  mProgressDlg->setLabelText( tr( "%1 features loaded." ).arg( i ) );
465 
467 
468  cancel = mProgressDlg && mProgressDlg->wasCanceled();
469 }
470 
471 void QgsDualView::finished()
472 {
473  delete mProgressDlg;
474  mProgressDlg = nullptr;
475 }
476 
477 /*
478  * QgsAttributeTableAction
479  */
480 
482 {
483  mDualView->masterModel()->executeAction( mAction, mFieldIdx );
484 }
485 
487 {
488  QgsFeatureIds editedIds;
489  editedIds << mDualView->masterModel()->rowToId( mFieldIdx.row() );
490  mDualView->setCurrentEditSelection( editedIds );
491  mDualView->setView( QgsDualView::AttributeEditor );
492 }
493 
494 /*
495  * QgsAttributeTableMapLayerAction
496  */
497 
499 {
500  mDualView->masterModel()->executeMapLayerAction( mAction, mFieldIdx );
501 }
QList< QgsField > toList() const
Utility function to return a list of QgsField instances.
Definition: qgsfield.cpp:429
QgsFeatureId id() const
Get the feature ID for this feature.
Definition: qgsfeature.cpp:65
void setRequest(const QgsFeatureRequest &request)
Set a request that will be used to fill this attribute table model.
QgsFeatureId rowToId(const QModelIndex &row)
Returns the feature id for a given model index.
void setFilterMode(QgsAttributeTableFilterModel::FilterMode filterMode)
Set the filter mode.
virtual void loadLayer()
Loads the layer into the model Preferably to be called, before using this model as source for any oth...
void setupUi(QWidget *widget)
QgsMapCanvas * mapCanvas() const
Returns the map canvas.
void setSelectedOnTop(bool selectedOnTop)
Changes the sort order of the features.
void setFilterMode(FilterMode filterMode)
Set the filter mode the filter will use.
QgsAttributeAction * actions()
void setFeatureSelectionManager(QgsIFeatureSelectionManager *featureSelectionManager)
void openConditionalStyles()
void hideButtonBox()
Hides the button box (Ok/Cancel) and enables auto-commit.
const QgsRectangle & filterRect() const
Get the rectangle from which features will be taken.
void setWindowModality(Qt::WindowModality windowModality)
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeature.h:433
QgsFields fields() const
Returns the list of fields of this layer.
This class contains context information for attribute editor widgets.
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
void setLabelText(const QString &text)
bool save()
Save all the values from the editors to the layer.
ViewMode
The view modes, in which this widget can present information.
Definition: qgsdualview.h:53
const T & at(int i) const
void addAction(QAction *action)
bool isNull() const
test if the rectangle is null (all coordinates zero or after call to setMinimal()).
QList< QgsMapLayerAction * > mapLayerActions(QgsMapLayer *layer, const QgsMapLayerAction::Targets &targets=QgsMapLayerAction::AllActions)
Returns the map layer actions which can run on the specified layer.
QgsVectorLayer * layer()
Returns the layer to which this cache belongs.
int filteredFeatureCount()
Returns the number of features which are currently visible, according to the filter restrictions...
const QPixmap * icon() const
void setDisplayExpression(const QString &displayExpression)
Set the preview expression, used to create a human readable preview string.
QString join(const QString &separator) const
const_iterator insert(const T &value)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:187
QString widgetType(int fieldIdx) const
Get the id for the editor widget used to represent the field at the given index.
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
void setCurrentEditSelection(const QgsFeatureIds &fids)
Set the current edit selection in the AttributeEditor mode.
QgsEditFormConfig * editFormConfig() const
Get the configuration of the form used to represent this vector layer.
const QString displayExpression()
Get the preview expression, used to create a human readable preview string.
virtual bool isEditable() const override
Returns true if the provider is in editing mode.
QString tr(const char *sourceText, const char *disambiguation, int n)
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:105
virtual int rowCount(const QModelIndex &parent) const
void setView(ViewMode view)
Change the current view mode.
int size() const
virtual void setFilteredFeatures(const QgsFeatureIds &ids)
Specify a list of features, which the filter will accept.
QgsDualView(QWidget *parent=nullptr)
Constructor.
Definition: qgsdualview.cpp:35
Show a list of the features, where one can be chosen and the according attribute dialog will be prese...
Definition: qgsdualview.h:64
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
const char * name() const
void setValue(int progress)
bool isValid() const
void setMapping(QObject *sender, int id)
QString name() const
The name of the action.
void processEvents(QFlags< QEventLoop::ProcessEventsFlag > flags)
void append(const T &value)
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
int toInt(bool *ok) const
void setFeature(const QgsFeature &feature)
Update all editors to correspond to a different feature.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities Note, some capabilities may change depending ...
void setEditorContext(const QgsAttributeEditorContext &context)
Sets the context in which this table is shown.
QString name() const
Gets the name of the field.
Definition: qgsfield.cpp:84
Utility class that encapsulates an action based on vector attributes.
bool isEmpty() const
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setCurrentIndex(int index)
This class wraps a request for features to a vector layer (or directly its vector data provider)...
void init(QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request=QgsFeatureRequest(), const QgsAttributeEditorContext &context=QgsAttributeEditorContext())
Has to be called to initialize the dual view.
Definition: qgsdualview.cpp:64
QgsFeatureIds filteredFeatures()
Definition: qgsdualview.h:131
const QString displayField() const
Returns the primary display field name used in the identify results dialog.
void filterChanged()
Is emitted, whenever the filter changes.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
QgsAction & at(int idx)
QAction * addSeparator()
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:44
Fast access to features using their ID.
iterator end()
This class caches features of a given QgsVectorLayer.
bool saveEditChanges()
saveEditChanges
void setRequest(const QgsFeatureRequest &request)
QgsAttributeTableFilterModel::FilterMode filterMode()
Definition: qgsdualview.h:98
QgsAttributeList pkAttributeList() const
Returns list of attributes making up the primary key.
void setSelectedOnTop(bool selectedOnTop)
Toggle the selectedOnTop flag.
QVariant value(const QString &key, const QVariant &defaultValue) const
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
void zoomToFeatureIds(QgsVectorLayer *layer, const QgsFeatureIds &ids)
Set canvas extent to the bounding box of a set of features.
static QgsMapLayerActionRegistry * instance()
Returns the instance pointer, creating the object on the first call.
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows.
void setCacheGeometry(bool cacheGeometry)
Enable or disable the caching of geometries.
void setFullCache(bool fullCache)
This enables or disables full caching.
void setWindowTitle(const QString &)
void displayExpressionChanged(const QString &expression)
Is emitted, whenever the display expression is successfully changed.
QgsFeatureId idxToFid(const QModelIndex &index) const
bool runable() const
Whether the action is runable on the current platform.
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void show()
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
QgsVectorDataProvider * dataProvider()
Returns the data provider.
void setFilteredFeatures(const QgsFeatureIds &filteredFeatures)
Set a list of currently visible features.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Is an interface class to abstract feature selection handling.
QObject * parent() const
Represents a vector layer which manages a vector based data sets.
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
iterator begin()
A generic dialog for building expression strings.
void setEnabled(bool)
void columnBoxInit()
Initializes widgets which depend on the attributes of this layer.
Definition: qgsdualview.cpp:99
int featureCount()
Returns the number of features on the layer.