QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 <QClipboard>
17 #include <QDialog>
18 #include <QMenu>
19 #include <QMessageBox>
20 #include <QProgressDialog>
21 #include <QGroupBox>
22 #include <QInputDialog>
23 #include <QTimer>
24 #include <QShortcut>
25 
26 #include "qgsapplication.h"
27 #include "qgsactionmanager.h"
28 #include "qgsattributetablemodel.h"
29 #include "qgsdualview.h"
31 #include "qgsfeaturelistmodel.h"
33 #include "qgsmapcanvas.h"
35 #include "qgsmessagelog.h"
36 #include "qgsvectordataprovider.h"
37 #include "qgsvectorlayercache.h"
40 #include "qgssettings.h"
41 #include "qgsscrollarea.h"
42 #include "qgsgui.h"
44 #include "qgsshortcutsmanager.h"
46 #include "qgsmapcanvasutils.h"
47 
48 
49 QgsDualView::QgsDualView( QWidget *parent )
50  : QStackedWidget( parent )
51 {
52  setupUi( this );
53  connect( mFeatureListView, &QgsFeatureListView::aboutToChangeEditSelection, this, &QgsDualView::featureListAboutToChangeEditSelection );
54  connect( mFeatureListView, &QgsFeatureListView::currentEditSelectionChanged, this, &QgsDualView::featureListCurrentEditSelectionChanged );
55  connect( mFeatureListView, &QgsFeatureListView::currentEditSelectionProgressChanged, this, &QgsDualView::updateEditSelectionProgress );
56  connect( mFeatureListView, &QgsFeatureListView::willShowContextMenu, this, &QgsDualView::widgetWillShowContextMenu );
57 
58  connect( mTableView, &QgsAttributeTableView::willShowContextMenu, this, &QgsDualView::viewWillShowContextMenu );
59  mTableView->horizontalHeader()->setContextMenuPolicy( Qt::CustomContextMenu );
60  connect( mTableView->horizontalHeader(), &QHeaderView::customContextMenuRequested, this, &QgsDualView::showViewHeaderMenu );
61  connect( mTableView, &QgsAttributeTableView::columnResized, this, &QgsDualView::tableColumnResized );
62 
63  mConditionalFormatWidgetStack->hide();
64  mConditionalFormatWidget = new QgsFieldConditionalFormatWidget( this );
65  mConditionalFormatWidgetStack->setMainPanel( mConditionalFormatWidget );
66  mConditionalFormatWidget->setDockMode( true );
67 
68  QgsSettings settings;
69  mConditionalSplitter->restoreState( settings.value( QStringLiteral( "/qgis/attributeTable/splitterState" ), QByteArray() ).toByteArray() );
70 
71  mPreviewColumnsMenu = new QMenu( this );
72  mActionPreviewColumnsMenu->setMenu( mPreviewColumnsMenu );
73 
74  // Set preview icon
75  mActionExpressionPreview->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconExpressionPreview.svg" ) ) );
76 
77  // Connect layer list preview signals
78  connect( mActionExpressionPreview, &QAction::triggered, this, &QgsDualView::previewExpressionBuilder );
79  connect( mFeatureListView, &QgsFeatureListView::displayExpressionChanged, this, &QgsDualView::previewExpressionChanged );
80 
81  // browsing toolbar
82  connect( mNextFeatureButton, &QToolButton::clicked, mFeatureListView, &QgsFeatureListView::editNextFeature );
83  connect( mPreviousFeatureButton, &QToolButton::clicked, mFeatureListView, &QgsFeatureListView::editPreviousFeature );
84  connect( mFirstFeatureButton, &QToolButton::clicked, mFeatureListView, &QgsFeatureListView::editFirstFeature );
85  connect( mLastFeatureButton, &QToolButton::clicked, mFeatureListView, &QgsFeatureListView::editLastFeature );
86 
87  auto createShortcuts = [ = ]( const QString & objectName, void ( QgsFeatureListView::* slot )() )
88  {
89  QShortcut *sc = QgsGui::shortcutsManager()->shortcutByName( objectName );
90  // do not assert for sc as it would lead to crashes in testing
91  // or when using custom widgets lib if built with Debug
92  if ( sc )
93  connect( sc, &QShortcut::activated, mFeatureListView, slot );
94  };
95  createShortcuts( QStringLiteral( "mAttributeTableFirstEditedFeature" ), &QgsFeatureListView::editFirstFeature );
96  createShortcuts( QStringLiteral( "mAttributeTablePreviousEditedFeature" ), &QgsFeatureListView::editPreviousFeature );
97  createShortcuts( QStringLiteral( "mAttributeTableNextEditedFeature" ), &QgsFeatureListView::editNextFeature );
98  createShortcuts( QStringLiteral( "mAttributeTableLastEditedFeature" ), &QgsFeatureListView::editLastFeature );
99 
100  QButtonGroup *buttonGroup = new QButtonGroup( this );
101  buttonGroup->setExclusive( false );
102  buttonGroup->addButton( mAutoPanButton, PanToFeature );
103  buttonGroup->addButton( mAutoZoomButton, ZoomToFeature );
104  FeatureListBrowsingAction action = QgsSettings().enumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), NoAction );
105  QAbstractButton *bt = buttonGroup->button( static_cast<int>( action ) );
106  if ( bt )
107  bt->setChecked( true );
108  connect( buttonGroup, qgis::overload< QAbstractButton *, bool >::of( &QButtonGroup::buttonToggled ), this, &QgsDualView::panZoomGroupButtonToggled );
109  mFlashButton->setChecked( QgsSettings().value( QStringLiteral( "/qgis/attributeTable/featureListHighlightFeature" ), true ).toBool() );
110  connect( mFlashButton, &QToolButton::clicked, this, &QgsDualView::flashButtonClicked );
111 }
112 
114 {
115  QgsSettings settings;
116  settings.setValue( QStringLiteral( "/qgis/attributeTable/splitterState" ), mConditionalSplitter->saveState() );
117 }
118 
119 void QgsDualView::init( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request,
120  const QgsAttributeEditorContext &context, bool loadFeatures )
121 {
122  if ( !layer )
123  return;
124 
125  mLayer = layer;
126  mEditorContext = context;
127 
128  initLayerCache( !( request.flags() & QgsFeatureRequest::NoGeometry ) || !request.filterRect().isNull() );
129  initModels( mapCanvas, request, loadFeatures );
130 
131  mConditionalFormatWidget->setLayer( mLayer );
132 
133  mTableView->setModel( mFilterModel );
134  mFeatureListView->setModel( mFeatureListModel );
135  delete mAttributeForm;
136  mAttributeForm = new QgsAttributeForm( mLayer, mTempAttributeFormFeature, mEditorContext );
137  mTempAttributeFormFeature = QgsFeature();
138  if ( !context.parentContext() )
139  {
140  mAttributeEditorScrollArea = new QgsScrollArea();
141  mAttributeEditorScrollArea->setWidgetResizable( true );
142  mAttributeEditor->layout()->addWidget( mAttributeEditorScrollArea );
143  mAttributeEditorScrollArea->setWidget( mAttributeForm );
144  }
145  else
146  {
147  mAttributeEditor->layout()->addWidget( mAttributeForm );
148  }
149 
150  connect( mAttributeForm, &QgsAttributeForm::widgetValueChanged, this, &QgsDualView::featureFormAttributeChanged );
151  connect( mAttributeForm, &QgsAttributeForm::modeChanged, this, &QgsDualView::formModeChanged );
153  connect( mAttributeForm, &QgsAttributeForm::flashFeatures, this, [ = ]( const QString & filter )
154  {
155  if ( QgsMapCanvas *canvas = mFilterModel->mapCanvas() )
156  {
157  QgsMapCanvasUtils::flashMatchingFeatures( canvas, mLayer, filter );
158  }
159  } );
160  connect( mAttributeForm, &QgsAttributeForm::zoomToFeatures, this, [ = ]( const QString & filter )
161  {
162  if ( QgsMapCanvas *canvas = mFilterModel->mapCanvas() )
163  {
164  QgsMapCanvasUtils::zoomToMatchingFeatures( canvas, mLayer, filter );
165  }
166  } );
167 
168  connect( mMasterModel, &QgsAttributeTableModel::modelChanged, mAttributeForm, &QgsAttributeForm::refreshFeature );
169  connect( mFilterModel, &QgsAttributeTableFilterModel::sortColumnChanged, this, &QgsDualView::onSortColumnChanged );
170 
171  if ( mFeatureListPreviewButton->defaultAction() )
172  mFeatureListView->setDisplayExpression( mDisplayExpression );
173  else
174  columnBoxInit();
175 
176  // This slows down load of the attribute table heaps and uses loads of memory.
177  //mTableView->resizeColumnsToContents();
178 
179  if ( mFeatureListModel->rowCount( ) > 0 )
180  mFeatureListView->setEditSelection( QgsFeatureIds() << mFeatureListModel->data( mFeatureListModel->index( 0, 0 ), QgsFeatureListModel::Role::FeatureRole ).value<QgsFeature>().id() );
181 
182 }
183 
184 void QgsDualView::columnBoxInit()
185 {
186  // load fields
187  QList<QgsField> fields = mLayer->fields().toList();
188 
189  QString defaultField;
190 
191  // default expression: saved value
192  QString displayExpression = mLayer->displayExpression();
193 
194  if ( displayExpression.isEmpty() )
195  {
196  // ... there isn't really much to display
197  displayExpression = QStringLiteral( "'[Please define preview text]'" );
198  }
199 
200  mFeatureListPreviewButton->addAction( mActionExpressionPreview );
201  mFeatureListPreviewButton->addAction( mActionPreviewColumnsMenu );
202 
203  const auto constFields = fields;
204  for ( const QgsField &field : constFields )
205  {
206  int fieldIndex = mLayer->fields().lookupField( field.name() );
207  if ( fieldIndex == -1 )
208  continue;
209 
210  QString fieldName = field.name();
211  if ( QgsGui::editorWidgetRegistry()->findBest( mLayer, fieldName ).type() != QLatin1String( "Hidden" ) )
212  {
213  QIcon icon = mLayer->fields().iconForField( fieldIndex );
214  QString text = mLayer->attributeDisplayName( fieldIndex );
215 
216  // Generate action for the preview popup button of the feature list
217  QAction *previewAction = new QAction( icon, text, mFeatureListPreviewButton );
218  connect( previewAction, &QAction::triggered, this, [ = ] { previewColumnChanged( previewAction, fieldName ); } );
219  mPreviewColumnsMenu->addAction( previewAction );
220 
221  if ( text == defaultField )
222  {
223  mFeatureListPreviewButton->setDefaultAction( previewAction );
224  }
225  }
226  }
227 
228  QMenu *sortMenu = new QMenu( this );
229  QAction *sortMenuAction = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "sort.svg" ) ), tr( "Sort…" ), this );
230  sortMenuAction->setMenu( sortMenu );
231 
232  QAction *sortByPreviewExpressionAsc = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "sort.svg" ) ), tr( "By Preview Expression (ascending)" ), this );
233  connect( sortByPreviewExpressionAsc, &QAction::triggered, this, [ = ]()
234  {
235  mFeatureListModel->setSortByDisplayExpression( true, Qt::AscendingOrder );
236  } );
237  sortMenu->addAction( sortByPreviewExpressionAsc );
238  QAction *sortByPreviewExpressionDesc = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "sort-reverse.svg" ) ), tr( "By Preview Expression (descending)" ), this );
239  connect( sortByPreviewExpressionDesc, &QAction::triggered, this, [ = ]()
240  {
241  mFeatureListModel->setSortByDisplayExpression( true, Qt::DescendingOrder );
242  } );
243  sortMenu->addAction( sortByPreviewExpressionDesc );
244  QAction *sortByPreviewExpressionCustom = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "mIconExpressionPreview.svg" ) ), tr( "By Custom Expression" ), this );
245  connect( sortByPreviewExpressionCustom, &QAction::triggered, this, [ = ]()
246  {
247  if ( modifySort() )
248  mFeatureListModel->setSortByDisplayExpression( false );
249  } );
250  sortMenu->addAction( sortByPreviewExpressionCustom );
251 
252  mFeatureListPreviewButton->addAction( sortMenuAction );
253 
254  QAction *separator = new QAction( mFeatureListPreviewButton );
255  separator->setSeparator( true );
256  mFeatureListPreviewButton->addAction( separator );
257  restoreRecentDisplayExpressions();
258 
259  // If there is no single field found as preview
260  if ( !mFeatureListPreviewButton->defaultAction() )
261  {
262  mFeatureListView->setDisplayExpression( displayExpression );
263  mFeatureListPreviewButton->setDefaultAction( mActionExpressionPreview );
264  setDisplayExpression( mFeatureListView->displayExpression() );
265  }
266  else
267  {
268  mFeatureListPreviewButton->defaultAction()->trigger();
269  }
270 }
271 
273 {
274  setCurrentIndex( view );
275 }
276 
278 {
279  return static_cast< QgsDualView::ViewMode >( currentIndex() );
280 }
281 
283 {
284  // cleanup any existing connections
285  switch ( mFilterModel->filterMode() )
286  {
288  disconnect( mFilterModel->mapCanvas(), &QgsMapCanvas::extentsChanged, this, &QgsDualView::extentChanged );
290  break;
291 
296  break;
297 
299  disconnect( masterModel()->layer(), &QgsVectorLayer::selectionChanged, this, &QgsDualView::updateSelectedFeatures );
300  break;
301  }
302 
303  QgsFeatureRequest r = mMasterModel->request();
305 
306  bool requiresTableReload = ( r.filterType() != QgsFeatureRequest::FilterNone || !r.filterRect().isNull() ) // previous request was subset
307  || ( needsGeometry && r.flags() & QgsFeatureRequest::NoGeometry ) // no geometry for last request
308  || ( mMasterModel->rowCount() == 0 ); // no features
309 
310  if ( !needsGeometry )
312  else
316  r.disableFilter();
317 
318  // setup new connections and filter request parameters
319  switch ( filterMode )
320  {
322  connect( mFilterModel->mapCanvas(), &QgsMapCanvas::extentsChanged, this, &QgsDualView::extentChanged );
323  if ( mFilterModel->mapCanvas() )
324  {
325  QgsRectangle rect = mFilterModel->mapCanvas()->mapSettings().mapToLayerCoordinates( mLayer, mFilterModel->mapCanvas()->extent() );
326  r.setFilterRect( rect );
327  }
329  break;
330 
335  break;
336 
338  connect( masterModel()->layer(), &QgsVectorLayer::selectionChanged, this, &QgsDualView::updateSelectedFeatures );
339  r.setFilterFids( masterModel()->layer()->selectedFeatureIds() );
340  break;
341  }
342 
343  // disable the browsing auto pan/scale if the list only shows visible items
344  switch ( filterMode )
345  {
347  setBrowsingAutoPanScaleAllowed( false );
348  break;
349 
354  setBrowsingAutoPanScaleAllowed( true );
355  break;
356  }
357 
358  if ( requiresTableReload )
359  {
360  //disconnect the connections of the current (old) filtermode before reload
361  mFilterModel->disconnectFilterModeConnections();
362 
363  mMasterModel->setRequest( r );
364  whileBlocking( mLayerCache )->setCacheGeometry( needsGeometry );
365  mMasterModel->loadLayer();
366  }
367 
368  //update filter model
369  mFilterModel->setFilterMode( filterMode );
370  emit filterChanged();
371 }
372 
373 void QgsDualView::setSelectedOnTop( bool selectedOnTop )
374 {
375  mFilterModel->setSelectedOnTop( selectedOnTop );
376 }
377 
378 void QgsDualView::initLayerCache( bool cacheGeometry )
379 {
380  // Initialize the cache
381  QgsSettings settings;
382  int cacheSize = settings.value( QStringLiteral( "qgis/attributeTableRowCache" ), "10000" ).toInt();
383  mLayerCache = new QgsVectorLayerCache( mLayer, cacheSize, this );
384  mLayerCache->setCacheGeometry( cacheGeometry );
385  if ( 0 == cacheSize || 0 == ( QgsVectorDataProvider::SelectAtId & mLayer->dataProvider()->capabilities() ) )
386  {
387  connect( mLayerCache, &QgsVectorLayerCache::invalidated, this, &QgsDualView::rebuildFullLayerCache );
388  rebuildFullLayerCache();
389  }
390 }
391 
392 void QgsDualView::initModels( QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request, bool loadFeatures )
393 {
394  delete mFeatureListModel;
395  delete mFilterModel;
396  delete mMasterModel;
397 
398  mMasterModel = new QgsAttributeTableModel( mLayerCache, this );
399  mMasterModel->setRequest( request );
400  mMasterModel->setEditorContext( mEditorContext );
401  mMasterModel->setExtraColumns( 1 ); // Add one extra column which we can "abuse" as an action column
402 
403  connect( mMasterModel, &QgsAttributeTableModel::progress, this, &QgsDualView::progress );
404  connect( mMasterModel, &QgsAttributeTableModel::finished, this, &QgsDualView::finished );
405 
407 
408  if ( loadFeatures )
409  mMasterModel->loadLayer();
410 
411  mFilterModel = new QgsAttributeTableFilterModel( mapCanvas, mMasterModel, mMasterModel );
412 
413  // The following connections to invalidate() are necessary to keep the filter model in sync
414  // see regression https://github.com/qgis/QGIS/issues/23890
415  connect( mMasterModel, &QgsAttributeTableModel::rowsRemoved, mFilterModel, &QgsAttributeTableFilterModel::invalidate );
416  connect( mMasterModel, &QgsAttributeTableModel::rowsInserted, mFilterModel, &QgsAttributeTableFilterModel::invalidate );
417 
419 
420  mFeatureListModel = new QgsFeatureListModel( mFilterModel, mFilterModel );
421  mFeatureListModel->setSortByDisplayExpression( true );
422 }
423 
424 void QgsDualView::restoreRecentDisplayExpressions()
425 {
426  const QVariantList previewExpressions = mLayer->customProperty( QStringLiteral( "dualview/previewExpressions" ) ).toList();
427 
428  for ( const QVariant &previewExpression : previewExpressions )
429  insertRecentlyUsedDisplayExpression( previewExpression.toString() );
430 }
431 
432 void QgsDualView::saveRecentDisplayExpressions() const
433 {
434  if ( ! mLayer )
435  {
436  return;
437  }
438  QList<QAction *> actions = mFeatureListPreviewButton->actions();
439 
440  // Remove existing same action
441  int index = actions.indexOf( mLastDisplayExpressionAction );
442  if ( index != -1 )
443  {
444  QVariantList previewExpressions;
445  for ( ; index < actions.length(); ++index )
446  {
447  QAction *action = actions.at( index );
448  previewExpressions << action->property( "previewExpression" );
449  }
450 
451  mLayer->setCustomProperty( QStringLiteral( "dualview/previewExpressions" ), previewExpressions );
452  }
453 }
454 
455 void QgsDualView::setDisplayExpression( const QString &expression )
456 {
457  mDisplayExpression = expression;
458  insertRecentlyUsedDisplayExpression( expression );
459 }
460 
461 void QgsDualView::insertRecentlyUsedDisplayExpression( const QString &expression )
462 {
463  QList<QAction *> actions = mFeatureListPreviewButton->actions();
464 
465  // Remove existing same action
466  int index = actions.indexOf( mLastDisplayExpressionAction );
467  if ( index != -1 )
468  {
469  for ( int i = 0; index + i < actions.length(); ++i )
470  {
471  QAction *action = actions.at( index );
472  if ( action->text() == expression || i >= 9 )
473  {
474  if ( action == mLastDisplayExpressionAction )
475  mLastDisplayExpressionAction = nullptr;
476  mFeatureListPreviewButton->removeAction( action );
477  }
478  else
479  {
480  if ( !mLastDisplayExpressionAction )
481  mLastDisplayExpressionAction = action;
482  }
483  }
484  }
485 
486  QString name = expression;
487  QIcon icon = QgsApplication::getThemeIcon( QStringLiteral( "/mIconExpressionPreview.svg" ) );
488  if ( expression.startsWith( QLatin1String( "COALESCE( \"" ) ) && expression.endsWith( QLatin1String( ", '<NULL>' )" ) ) )
489  {
490  name = expression.mid( 11, expression.length() - 24 ); // Numbers calculated from the COALESCE / <NULL> parts
491 
492  int fieldIndex = mLayer->fields().indexOf( name );
493  if ( fieldIndex != -1 )
494  {
495  name = mLayer->attributeDisplayName( fieldIndex );
496  icon = mLayer->fields().iconForField( fieldIndex );
497  }
498  else
499  {
500  name = expression;
501  }
502  }
503 
504  QAction *previewAction = new QAction( icon, name, mFeatureListPreviewButton );
505  previewAction->setProperty( "previewExpression", expression );
506  connect( previewAction, &QAction::triggered, this, [expression, this]( bool )
507  {
508  setDisplayExpression( expression );
509  mFeatureListPreviewButton->setText( expression );
510  }
511  );
512 
513  mFeatureListPreviewButton->insertAction( mLastDisplayExpressionAction, previewAction );
514  mLastDisplayExpressionAction = previewAction;
515 }
516 
517 void QgsDualView::updateEditSelectionProgress( int progress, int count )
518 {
519  mProgressCount->setText( QStringLiteral( "%1 / %2" ).arg( progress + 1 ).arg( count ) );
520  mPreviousFeatureButton->setEnabled( progress > 0 );
521  mNextFeatureButton->setEnabled( progress + 1 < count );
522  mFirstFeatureButton->setEnabled( progress > 0 );
523  mLastFeatureButton->setEnabled( progress + 1 < count );
524 }
525 
526 void QgsDualView::panOrZoomToFeature( const QgsFeatureIds &featureset )
527 {
528  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
529  if ( canvas && view() == AttributeEditor && featureset != mLastFeatureSet )
530  {
531  if ( mBrowsingAutoPanScaleAllowed )
532  {
533  if ( mAutoPanButton->isChecked() )
534  QTimer::singleShot( 0, this, [ = ]()
535  {
536  canvas->panToFeatureIds( mLayer, featureset, false );
537  } );
538  else if ( mAutoZoomButton->isChecked() )
539  QTimer::singleShot( 0, this, [ = ]()
540  {
541  canvas->zoomToFeatureIds( mLayer, featureset );
542  } );
543  }
544  if ( mFlashButton->isChecked() )
545  QTimer::singleShot( 0, this, [ = ]()
546  {
547  canvas->flashFeatureIds( mLayer, featureset );
548  } );
549  mLastFeatureSet = featureset;
550  }
551 }
552 
553 void QgsDualView::setBrowsingAutoPanScaleAllowed( bool allowed )
554 {
555  if ( mBrowsingAutoPanScaleAllowed == allowed )
556  return;
557 
558  mBrowsingAutoPanScaleAllowed = allowed;
559 
560  mAutoPanButton->setEnabled( allowed );
561  mAutoZoomButton->setEnabled( allowed );
562 
563  QString disabledHint = tr( "(disabled when attribute table only shows features visible in the current map canvas extent)" );
564 
565  mAutoPanButton->setToolTip( tr( "Automatically pan to the current feature" ) + ( allowed ? QString() : QString( ' ' ) + disabledHint ) );
566  mAutoZoomButton->setToolTip( tr( "Automatically zoom to the current feature" ) + ( allowed ? QString() : QString( ' ' ) + disabledHint ) );
567 }
568 
569 void QgsDualView::panZoomGroupButtonToggled( QAbstractButton *button, bool checked )
570 {
571  if ( button == mAutoPanButton && checked )
572  {
573  QgsSettings().setEnumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), PanToFeature );
574  mAutoZoomButton->setChecked( false );
575  }
576  else if ( button == mAutoZoomButton && checked )
577  {
578  QgsSettings().setEnumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), ZoomToFeature );
579  mAutoPanButton->setChecked( false );
580  }
581  else
582  {
583  QgsSettings().setEnumValue( QStringLiteral( "/qgis/attributeTable/featureListBrowsingAction" ), NoAction );
584  }
585 
586  if ( checked && mLayer->isSpatial() )
587  panOrZoomToFeature( mFeatureListView->currentEditSelection() );
588 }
589 
590 void QgsDualView::flashButtonClicked( bool clicked )
591 {
592  QgsSettings().setValue( QStringLiteral( "/qgis/attributeTable/featureListHighlightFeature" ), clicked );
593  if ( !clicked )
594  return;
595 
596  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
597 
598  if ( canvas )
599  canvas->flashFeatureIds( mLayer, mFeatureListView->currentEditSelection() );
600 }
601 
602 void QgsDualView::featureListAboutToChangeEditSelection( bool &ok )
603 {
604  if ( mLayer->isEditable() && !mAttributeForm->save() )
605  ok = false;
606 }
607 
608 void QgsDualView::featureListCurrentEditSelectionChanged( const QgsFeature &feat )
609 {
610  if ( !mAttributeForm )
611  {
612  mTempAttributeFormFeature = feat;
613  }
614  else if ( !mLayer->isEditable() || mAttributeForm->save() )
615  {
616  mAttributeForm->setFeature( feat );
617  QgsFeatureIds featureset;
618  featureset << feat.id();
619  setCurrentEditSelection( featureset );
620 
621  if ( mLayer->isSpatial() )
622  panOrZoomToFeature( featureset );
623 
624  }
625  else
626  {
627  // Couldn't save feature
628  }
629 }
630 
632 {
633  mFeatureListView->setCurrentFeatureEdited( false );
634  mFeatureListView->setEditSelection( fids );
635 }
636 
638 {
639  return mAttributeForm->save();
640 }
641 
643 {
644  mConditionalFormatWidgetStack->setVisible( !mConditionalFormatWidgetStack->isVisible() );
645 }
646 
648 {
649  if ( enabled )
650  {
651  mPreviousView = view();
653  }
654  else
655  setView( mPreviousView );
656 
658 }
659 
660 void QgsDualView::toggleSearchMode( bool enabled )
661 {
662  if ( enabled )
663  {
666  }
667  else
668  {
670  }
671 }
672 
673 void QgsDualView::previewExpressionBuilder()
674 {
675  // Show expression builder
677 
678  QgsExpressionBuilderDialog dlg( mLayer, mFeatureListView->displayExpression(), this, QStringLiteral( "generic" ), context );
679  dlg.setWindowTitle( tr( "Expression Based Preview" ) );
680  dlg.setExpressionText( mFeatureListView->displayExpression() );
681 
682  if ( dlg.exec() == QDialog::Accepted )
683  {
684  mFeatureListView->setDisplayExpression( dlg.expressionText() );
685  mFeatureListPreviewButton->setDefaultAction( mActionExpressionPreview );
686  mFeatureListPreviewButton->setPopupMode( QToolButton::MenuButtonPopup );
687  }
688 
689  setDisplayExpression( mFeatureListView->displayExpression() );
690 }
691 
692 void QgsDualView::previewColumnChanged( QAction *previewAction, const QString &expression )
693 {
694  if ( !mFeatureListView->setDisplayExpression( QStringLiteral( "COALESCE( \"%1\", '<NULL>' )" ).arg( expression ) ) )
695  {
696  QMessageBox::warning( this,
697  tr( "Column Preview" ),
698  tr( "Could not set column '%1' as preview column.\nParser error:\n%2" )
699  .arg( previewAction->text(), mFeatureListView->parserErrorString() )
700  );
701  }
702  else
703  {
704  mFeatureListPreviewButton->setText( previewAction->text() );
705  mFeatureListPreviewButton->setIcon( previewAction->icon() );
706  mFeatureListPreviewButton->setPopupMode( QToolButton::InstantPopup );
707  }
708 
709  setDisplayExpression( mFeatureListView->displayExpression() );
710 }
711 
713 {
714  return mMasterModel->rowCount();
715 }
716 
718 {
719  return mFilterModel->rowCount();
720 }
721 
723 {
724  const QModelIndex currentIndex = mTableView->currentIndex();
725  if ( !currentIndex.isValid() )
726  {
727  return;
728  }
729 
730  QVariant var = mMasterModel->data( currentIndex, Qt::DisplayRole );
731  QApplication::clipboard()->setText( var.toString() );
732 }
733 
735 {
736  if ( mProgressDlg )
737  mProgressDlg->cancel();
738 }
739 
740 void QgsDualView::parentFormValueChanged( const QString &attribute, const QVariant &newValue )
741 {
742  if ( mAttributeForm )
743  {
744  mAttributeForm->parentFormValueChanged( attribute, newValue );
745  }
746 }
747 
748 void QgsDualView::hideEvent( QHideEvent *event )
749 {
750  Q_UNUSED( event )
751  saveRecentDisplayExpressions();
752 }
753 
754 void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &masterIndex )
755 {
756  if ( !menu )
757  {
758  return;
759  }
760 
761  QAction *copyContentAction = menu->addAction( tr( "Copy Cell Content" ) );
762  menu->addAction( copyContentAction );
763  connect( copyContentAction, &QAction::triggered, this, [masterIndex, this]
764  {
765  QVariant var = mMasterModel->data( masterIndex, Qt::DisplayRole );
766  QApplication::clipboard()->setText( var.toString() );
767  } );
768 
769  QgsVectorLayer *vl = mFilterModel->layer();
770  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
771  if ( canvas && vl && vl->geometryType() != QgsWkbTypes::NullGeometry )
772  {
773  QAction *zoomToFeatureAction = menu->addAction( tr( "Zoom to Feature" ) );
774  connect( zoomToFeatureAction, &QAction::triggered, this, &QgsDualView::zoomToCurrentFeature );
775 
776  QAction *panToFeatureAction = menu->addAction( tr( "Pan to Feature" ) );
777  connect( panToFeatureAction, &QAction::triggered, this, &QgsDualView::panToCurrentFeature );
778 
779  QAction *flashFeatureAction = menu->addAction( tr( "Flash Feature" ) );
780  connect( flashFeatureAction, &QAction::triggered, this, &QgsDualView::flashCurrentFeature );
781  }
782 
783  //add user-defined actions to context menu
784  const QList<QgsAction> actions = mLayer->actions()->actions( QStringLiteral( "Field" ) );
785  if ( !actions.isEmpty() )
786  {
787  QAction *a = menu->addAction( tr( "Run Layer Action" ) );
788  a->setEnabled( false );
789 
790  for ( const QgsAction &action : actions )
791  {
792  if ( !action.runable() )
793  continue;
794 
795  if ( vl && !vl->isEditable() && action.isEnabledOnlyWhenEditable() )
796  continue;
797 
798  QgsAttributeTableAction *a = new QgsAttributeTableAction( action.name(), this, action.id(), masterIndex );
799  menu->addAction( action.name(), a, &QgsAttributeTableAction::execute );
800  }
801  }
802  QModelIndex rowSourceIndex = mMasterModel->index( masterIndex.row(), 0 );
803  if ( ! rowSourceIndex.isValid() )
804  {
805  return;
806  }
807 
808  //add actions from QgsMapLayerActionRegistry to context menu
809  const QList<QgsMapLayerAction *> registeredActions = QgsGui::mapLayerActionRegistry()->mapLayerActions( mLayer, QgsMapLayerAction::Layer | QgsMapLayerAction::SingleFeature );
810  if ( !registeredActions.isEmpty() )
811  {
812  //add a separator between user defined and standard actions
813  menu->addSeparator();
814 
815  for ( QgsMapLayerAction *action : registeredActions )
816  {
817  QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction( action->text(), this, action, rowSourceIndex );
818  menu->addAction( action->text(), a, &QgsAttributeTableMapLayerAction::execute );
819  }
820  }
821 
822  // entries for multiple features layer actions
823  // only show if the context menu is shown over a selected row
824  const QgsFeatureId currentFid = mMasterModel->rowToId( masterIndex.row() );
825  if ( mLayer->selectedFeatureCount() > 1 && mLayer->selectedFeatureIds().contains( currentFid ) )
826  {
827  const QList<QgsMapLayerAction *> registeredActions = QgsGui::mapLayerActionRegistry()->mapLayerActions( mLayer, QgsMapLayerAction::MultipleFeatures );
828  if ( !registeredActions.isEmpty() )
829  {
830  menu->addSeparator();
831  QAction *action = menu->addAction( tr( "Actions on Selection (%1)" ).arg( mLayer->selectedFeatureCount() ) );
832  action->setEnabled( false );
833 
834  for ( QgsMapLayerAction *action : registeredActions )
835  {
836  menu->addAction( action->text(), action, [ = ]() {action->triggerForFeatures( mLayer, mLayer->selectedFeatures() );} );
837  }
838  }
839  }
840 
841  menu->addSeparator();
842  QgsAttributeTableAction *a = new QgsAttributeTableAction( tr( "Open Form" ), this, QString(), rowSourceIndex );
843  menu->addAction( tr( "Open Form…" ), a, &QgsAttributeTableAction::featureForm );
844 }
845 
846 
847 void QgsDualView::widgetWillShowContextMenu( QgsActionMenu *menu, const QModelIndex &atIndex )
848 {
849  emit showContextMenuExternally( menu, mFilterModel->rowToId( atIndex ) );
850 }
851 
852 
853 void QgsDualView::showViewHeaderMenu( QPoint point )
854 {
855  int col = mTableView->columnAt( point.x() );
856 
857  delete mHorizontalHeaderMenu;
858  mHorizontalHeaderMenu = new QMenu( this );
859 
860  QAction *hide = new QAction( tr( "&Hide Column" ), mHorizontalHeaderMenu );
861  connect( hide, &QAction::triggered, this, &QgsDualView::hideColumn );
862  hide->setData( col );
863  mHorizontalHeaderMenu->addAction( hide );
864  QAction *setWidth = new QAction( tr( "&Set Width…" ), mHorizontalHeaderMenu );
865  connect( setWidth, &QAction::triggered, this, &QgsDualView::resizeColumn );
866  setWidth->setData( col );
867  mHorizontalHeaderMenu->addAction( setWidth );
868  QAction *optimizeWidth = new QAction( tr( "&Autosize" ), mHorizontalHeaderMenu );
869  connect( optimizeWidth, &QAction::triggered, this, &QgsDualView::autosizeColumn );
870  optimizeWidth->setData( col );
871  mHorizontalHeaderMenu->addAction( optimizeWidth );
872 
873  mHorizontalHeaderMenu->addSeparator();
874  QAction *organize = new QAction( tr( "&Organize Columns…" ), mHorizontalHeaderMenu );
875  connect( organize, &QAction::triggered, this, &QgsDualView::organizeColumns );
876  mHorizontalHeaderMenu->addAction( organize );
877  QAction *sort = new QAction( tr( "&Sort…" ), mHorizontalHeaderMenu );
878  connect( sort, &QAction::triggered, this, [ = ]() {modifySort();} );
879  mHorizontalHeaderMenu->addAction( sort );
880 
881  mHorizontalHeaderMenu->popup( mTableView->horizontalHeader()->mapToGlobal( point ) );
882 }
883 
884 void QgsDualView::organizeColumns()
885 {
886  if ( !mLayer )
887  {
888  return;
889  }
890 
891  QgsOrganizeTableColumnsDialog dialog( mLayer, attributeTableConfig(), this );
892  if ( dialog.exec() == QDialog::Accepted )
893  {
894  QgsAttributeTableConfig config = dialog.config();
895  setAttributeTableConfig( config );
896  }
897 }
898 
899 void QgsDualView::tableColumnResized( int column, int width )
900 {
901  QgsAttributeTableConfig config = mConfig;
902  int sourceCol = config.mapVisibleColumnToIndex( column );
903  if ( sourceCol >= 0 && config.columnWidth( sourceCol ) != width )
904  {
905  config.setColumnWidth( sourceCol, width );
906  setAttributeTableConfig( config );
907  }
908 }
909 
910 void QgsDualView::hideColumn()
911 {
912  QAction *action = qobject_cast<QAction *>( sender() );
913  int col = action->data().toInt();
914  QgsAttributeTableConfig config = mConfig;
915  int sourceCol = mConfig.mapVisibleColumnToIndex( col );
916  if ( sourceCol >= 0 )
917  {
918  config.setColumnHidden( sourceCol, true );
919  setAttributeTableConfig( config );
920  }
921 }
922 
923 void QgsDualView::resizeColumn()
924 {
925  QAction *action = qobject_cast<QAction *>( sender() );
926  int col = action->data().toInt();
927  if ( col < 0 )
928  return;
929 
930  QgsAttributeTableConfig config = mConfig;
931  int sourceCol = config.mapVisibleColumnToIndex( col );
932  if ( sourceCol >= 0 )
933  {
934  bool ok = false;
935  int width = QInputDialog::getInt( this, tr( "Set column width" ), tr( "Enter column width" ),
936  mTableView->columnWidth( col ),
937  0, 1000, 10, &ok );
938  if ( ok )
939  {
940  config.setColumnWidth( sourceCol, width );
941  setAttributeTableConfig( config );
942  }
943  }
944 }
945 
946 void QgsDualView::autosizeColumn()
947 {
948  QAction *action = qobject_cast<QAction *>( sender() );
949  int col = action->data().toInt();
950  mTableView->resizeColumnToContents( col );
951 }
952 
953 bool QgsDualView::modifySort()
954 {
955  if ( !mLayer )
956  return false;
957 
958  QgsAttributeTableConfig config = mConfig;
959 
960  QDialog orderByDlg;
961  orderByDlg.setWindowTitle( tr( "Configure Attribute Table Sort Order" ) );
962  QDialogButtonBox *dialogButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
963  QGridLayout *layout = new QGridLayout();
964  connect( dialogButtonBox, &QDialogButtonBox::accepted, &orderByDlg, &QDialog::accept );
965  connect( dialogButtonBox, &QDialogButtonBox::rejected, &orderByDlg, &QDialog::reject );
966  orderByDlg.setLayout( layout );
967 
968  QGroupBox *sortingGroupBox = new QGroupBox();
969  sortingGroupBox->setTitle( tr( "Defined sort order in attribute table" ) );
970  sortingGroupBox->setCheckable( true );
971  sortingGroupBox->setChecked( !sortExpression().isEmpty() );
972  layout->addWidget( sortingGroupBox );
973  sortingGroupBox->setLayout( new QGridLayout() );
974 
975  QgsExpressionBuilderWidget *expressionBuilder = new QgsExpressionBuilderWidget();
977 
978  expressionBuilder->initWithLayer( mLayer, context, QStringLiteral( "generic" ) );
979  expressionBuilder->setExpressionText( sortExpression().isEmpty() ? mLayer->displayExpression() : sortExpression() );
980 
981  sortingGroupBox->layout()->addWidget( expressionBuilder );
982 
983  QCheckBox *cbxSortAscending = new QCheckBox( tr( "Sort ascending" ) );
984  cbxSortAscending->setChecked( config.sortOrder() == Qt::AscendingOrder );
985  sortingGroupBox->layout()->addWidget( cbxSortAscending );
986 
987  layout->addWidget( dialogButtonBox );
988  if ( orderByDlg.exec() )
989  {
990  Qt::SortOrder sortOrder = cbxSortAscending->isChecked() ? Qt::AscendingOrder : Qt::DescendingOrder;
991  if ( sortingGroupBox->isChecked() )
992  {
993  setSortExpression( expressionBuilder->expressionText(), sortOrder );
994  config.setSortExpression( expressionBuilder->expressionText() );
995  config.setSortOrder( sortOrder );
996  }
997  else
998  {
999  setSortExpression( QString(), sortOrder );
1000  config.setSortExpression( QString() );
1001  }
1002 
1003  setAttributeTableConfig( config );
1004  return true;
1005  }
1006  else
1007  {
1008  return false;
1009  }
1010 
1011 }
1012 
1013 void QgsDualView::zoomToCurrentFeature()
1014 {
1015  QModelIndex currentIndex = mTableView->currentIndex();
1016  if ( !currentIndex.isValid() )
1017  {
1018  return;
1019  }
1020 
1021  QgsFeatureIds ids;
1022  ids.insert( mFilterModel->rowToId( currentIndex ) );
1023  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
1024  if ( canvas )
1025  {
1026  canvas->zoomToFeatureIds( mLayer, ids );
1027  }
1028 }
1029 
1030 void QgsDualView::panToCurrentFeature()
1031 {
1032  QModelIndex currentIndex = mTableView->currentIndex();
1033  if ( !currentIndex.isValid() )
1034  {
1035  return;
1036  }
1037 
1038  QgsFeatureIds ids;
1039  ids.insert( mFilterModel->rowToId( currentIndex ) );
1040  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
1041  if ( canvas )
1042  {
1043  canvas->panToFeatureIds( mLayer, ids );
1044  }
1045 }
1046 
1047 void QgsDualView::flashCurrentFeature()
1048 {
1049  QModelIndex currentIndex = mTableView->currentIndex();
1050  if ( !currentIndex.isValid() )
1051  {
1052  return;
1053  }
1054 
1055  QgsFeatureIds ids;
1056  ids.insert( mFilterModel->rowToId( currentIndex ) );
1057  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
1058  if ( canvas )
1059  {
1060  canvas->flashFeatureIds( mLayer, ids );
1061  }
1062 }
1063 
1064 void QgsDualView::rebuildFullLayerCache()
1065 {
1066  connect( mLayerCache, &QgsVectorLayerCache::progress, this, &QgsDualView::progress, Qt::UniqueConnection );
1067  connect( mLayerCache, &QgsVectorLayerCache::finished, this, &QgsDualView::finished, Qt::UniqueConnection );
1068 
1069  mLayerCache->setFullCache( true );
1070 }
1071 
1072 void QgsDualView::previewExpressionChanged( const QString &expression )
1073 {
1074  mLayer->setDisplayExpression( expression );
1075 }
1076 
1077 void QgsDualView::onSortColumnChanged()
1078 {
1080  if ( cfg.sortExpression() != mFilterModel->sortExpression() ||
1081  cfg.sortOrder() != mFilterModel->sortOrder() )
1082  {
1083  cfg.setSortExpression( mFilterModel->sortExpression() );
1084  cfg.setSortOrder( mFilterModel->sortOrder() );
1085  setAttributeTableConfig( cfg );
1086  }
1087 }
1088 
1089 void QgsDualView::updateSelectedFeatures()
1090 {
1091  QgsFeatureRequest r = mMasterModel->request();
1093  return; // already requested all features
1094 
1095  r.setFilterFids( masterModel()->layer()->selectedFeatureIds() );
1096  mMasterModel->setRequest( r );
1097  mMasterModel->loadLayer();
1098  emit filterChanged();
1099 }
1100 
1101 void QgsDualView::extentChanged()
1102 {
1103  QgsFeatureRequest r = mMasterModel->request();
1104  if ( mFilterModel->mapCanvas() && ( r.filterType() != QgsFeatureRequest::FilterNone || !r.filterRect().isNull() ) )
1105  {
1106  QgsRectangle rect = mFilterModel->mapCanvas()->mapSettings().mapToLayerCoordinates( mLayer, mFilterModel->mapCanvas()->extent() );
1107  r.setFilterRect( rect );
1108  mMasterModel->setRequest( r );
1109  mMasterModel->loadLayer();
1110  }
1111  emit filterChanged();
1112 }
1113 
1114 void QgsDualView::featureFormAttributeChanged( const QString &attribute, const QVariant &value, bool attributeChanged )
1115 {
1116  Q_UNUSED( attribute )
1117  Q_UNUSED( value )
1118  if ( attributeChanged )
1119  mFeatureListView->setCurrentFeatureEdited( true );
1120 }
1121 
1122 void QgsDualView::setFilteredFeatures( const QgsFeatureIds &filteredFeatures )
1123 {
1124  mFilterModel->setFilteredFeatures( filteredFeatures );
1125 }
1126 
1127 void QgsDualView::filterFeatures( const QgsExpression &filterExpression, const QgsExpressionContext &context )
1128 {
1129  mFilterModel->setFilterExpression( filterExpression, context );
1130  mFilterModel->filterFeatures();
1131 }
1132 
1133 
1135 {
1136  mMasterModel->setRequest( request );
1137 }
1138 
1140 {
1141  mTableView->setFeatureSelectionManager( featureSelectionManager );
1142  mFeatureListView->setFeatureSelectionManager( featureSelectionManager );
1143 
1144  if ( mFeatureSelectionManager && mFeatureSelectionManager->parent() == this )
1145  delete mFeatureSelectionManager;
1146 
1147  mFeatureSelectionManager = featureSelectionManager;
1148 }
1149 
1151 {
1152  mConfig = config;
1153  mConfig.update( mLayer->fields() );
1154  mLayer->setAttributeTableConfig( mConfig );
1155  mFilterModel->setAttributeTableConfig( mConfig );
1156  mTableView->setAttributeTableConfig( mConfig );
1157 }
1158 
1159 void QgsDualView::setSortExpression( const QString &sortExpression, Qt::SortOrder sortOrder )
1160 {
1161  if ( sortExpression.isNull() )
1162  mFilterModel->sort( -1 );
1163  else
1164  mFilterModel->sort( sortExpression, sortOrder );
1165 
1166  mConfig.setSortExpression( sortExpression );
1167  mConfig.setSortOrder( sortOrder );
1168  setAttributeTableConfig( mConfig );
1169 }
1170 
1172 {
1173  return mFilterModel->sortExpression();
1174 }
1175 
1177 {
1178  return mConfig;
1179 }
1180 
1181 void QgsDualView::progress( int i, bool &cancel )
1182 {
1183  if ( !mProgressDlg )
1184  {
1185  mProgressDlg = new QProgressDialog( tr( "Loading features…" ), tr( "Abort" ), 0, 0, this );
1186  mProgressDlg->setWindowTitle( tr( "Attribute Table" ) );
1187  mProgressDlg->setWindowModality( Qt::WindowModal );
1188  mProgressDlg->show();
1189  }
1190 
1191  mProgressDlg->setLabelText( tr( "%1 features loaded." ).arg( i ) );
1192  QCoreApplication::processEvents();
1193 
1194  cancel = mProgressDlg && mProgressDlg->wasCanceled();
1195 }
1196 
1197 void QgsDualView::finished()
1198 {
1199  delete mProgressDlg;
1200  mProgressDlg = nullptr;
1201 }
1202 
1203 /*
1204  * QgsAttributeTableAction
1205  */
1206 
1208 {
1209  mDualView->masterModel()->executeAction( mAction, mFieldIdx );
1210 }
1211 
1213 {
1214  QgsFeatureIds editedIds;
1215  editedIds << mDualView->masterModel()->rowToId( mFieldIdx.row() );
1216  mDualView->setCurrentEditSelection( editedIds );
1217  mDualView->setView( QgsDualView::AttributeEditor );
1218 }
1219 
1220 /*
1221  * QgsAttributeTableMapLayerAction
1222  */
1223 
1225 {
1226  mDualView->masterModel()->executeMapLayerAction( mAction, mFieldIdx );
1227 }
QgsFeatureRequest::NoGeometry
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
Definition: qgsfeaturerequest.h:81
QgsAttributeTableConfig::sortOrder
Qt::SortOrder sortOrder() const
Gets the sort order.
Definition: qgsattributetableconfig.cpp:233
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:370
QgsAttributeEditorContext::SingleEditMode
@ SingleEditMode
Single edit mode, for editing a single feature.
Definition: qgsattributeeditorcontext.h:49
QgsAttributeTableFilterModel::ShowAll
@ ShowAll
Show all features.
Definition: qgsattributetablefiltermodel.h:46
qgsexpressioncontextutils.h
QgsAttributeForm::modeChanged
void modeChanged(QgsAttributeEditorContext::Mode mode)
Emitted when the form changes mode.
QgsGui::editorWidgetRegistry
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories.
Definition: qgsgui.cpp:74
QgsAttributeForm::flashFeatures
void flashFeatures(const QString &filter)
Emitted when the user chooses to flash a filtered set of features.
QgsFeatureListView::displayExpressionChanged
void displayExpressionChanged(const QString &expression)
Emitted whenever the display expression is successfully changed.
QgsDualView::copyCellContent
void copyCellContent() const
Copy the content of the selected cell in the clipboard.
Definition: qgsdualview.cpp:722
QgsFeature::id
Q_GADGET QgsFeatureId id
Definition: qgsfeature.h:64
QgsAttributeTableAction::featureForm
void featureForm()
Definition: qgsdualview.cpp:1212
QgsFeatureListView::editPreviousFeature
void editPreviousFeature()
editPreviousFeature will try to edit previous feature of the list
Definition: qgsfeaturelistview.h:204
QgsMapCanvas::extent
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
Definition: qgsmapcanvas.cpp:1056
QgsAttributeTableConfig::sortExpression
QString sortExpression() const
Gets the expression used for sorting.
Definition: qgsattributetableconfig.cpp:198
QgsDualView::NoAction
@ NoAction
No action is done.
Definition: qgsdualview.h:73
QgsMapSettings::mapToLayerCoordinates
QgsPointXY mapToLayerCoordinates(const QgsMapLayer *layer, QgsPointXY point) const
transform point coordinates from output CRS to layer's CRS
Definition: qgsmapsettings.cpp:537
QgsMapLayerAction
An action which can run on map layers.
Definition: qgsmaplayeractionregistry.h:35
qgsvectorlayercache.h
QgsApplication::getThemeIcon
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
Definition: qgsapplication.cpp:626
QgsMapLayerAction::SingleFeature
@ SingleFeature
Definition: qgsmaplayeractionregistry.h:42
QgsAttributeTableFilterModel::sortExpression
QString sortExpression() const
The expression which is used to sort the attribute table.
Definition: qgsattributetablefiltermodel.cpp:257
qgsshortcutsmanager.h
QgsVectorLayerCache
This class caches features of a given QgsVectorLayer.
Definition: qgsvectorlayercache.h:46
QgsSettings::value
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
Definition: qgssettings.cpp:174
QgsDualView::QgsDualView
QgsDualView(QWidget *parent=nullptr)
Constructor.
Definition: qgsdualview.cpp:49
QgsAttributeTableFilterModel::visibleReloaded
void visibleReloaded()
Emitted when the the visible features on extend are reloaded (the list is created)
QgsAttributeTableModel::progress
void progress(int i, bool &cancel)
qgsmapcanvas.h
QgsWkbTypes::NullGeometry
@ NullGeometry
Definition: qgswkbtypes.h:146
QgsExpressionBuilderWidget
A reusable widget that can be used to build a expression string.
Definition: qgsexpressionbuilderwidget.h:43
QgsPanelWidget::setDockMode
virtual void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
Definition: qgspanelwidget.cpp:44
QgsDualView::view
ViewMode view() const
Returns the current view mode.
Definition: qgsdualview.cpp:277
QgsGui::mapLayerActionRegistry
static QgsMapLayerActionRegistry * mapLayerActionRegistry()
Returns the global map layer action registry, used for registering map layer actions.
Definition: qgsgui.cpp:94
QgsDualView::formModeChanged
void formModeChanged(QgsAttributeEditorContext::Mode mode)
Emitted when the form changes mode.
QgsMapCanvas::mapSettings
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
Definition: qgsmapcanvas.cpp:391
QgsAttributeTableConfig::setSortOrder
void setSortOrder(Qt::SortOrder sortOrder)
Set the sort order.
Definition: qgsattributetableconfig.cpp:238
QgsFeatureRequest::flags
const Flags & flags() const
Definition: qgsfeaturerequest.h:503
qgsmapcanvasutils.h
QgsFeatureRequest::filterRect
const QgsRectangle & filterRect() const
Returns the rectangle from which features will be taken.
Definition: qgsfeaturerequest.h:335
QgsDualView::PanToFeature
@ PanToFeature
The map is panned to the center of the feature bounding-box.
Definition: qgsdualview.h:74
qgsgui.h
QgsDualView::setMultiEditEnabled
void setMultiEditEnabled(bool enabled)
Sets whether multi edit mode is enabled.
Definition: qgsdualview.cpp:647
QgsFieldConditionalFormatWidget::setLayer
void setLayer(QgsVectorLayer *layer)
Sets the vector layer associated with the widget.
Definition: qgsfieldconditionalformatwidget.cpp:48
QgsAttributeTableFilterModel::ShowFilteredList
@ ShowFilteredList
Show only features whose ids are on the filter list. {.
Definition: qgsattributetablefiltermodel.h:49
QgsFeatureRequest::filterType
FilterType filterType() const
Returns the filter type which is currently set on this request.
Definition: qgsfeaturerequest.h:312
QgsDualView::setView
void setView(ViewMode view)
Change the current view mode.
Definition: qgsdualview.cpp:272
QgsAttributeTableConfig::columnWidth
int columnWidth(int column) const
Returns the width of a column, or -1 if column should use default width.
Definition: qgsattributetableconfig.cpp:208
QgsAttributeForm::setFeature
void setFeature(const QgsFeature &feature)
Update all editors to correspond to a different feature.
Definition: qgsattributeform.cpp:281
QgsExpressionBuilderWidget::initWithLayer
void initWithLayer(QgsVectorLayer *layer, const QgsExpressionContext &context=QgsExpressionContext(), const QString &recentCollection=QStringLiteral("generic"), const Flags &flags=LoadAll)
Initialize with a layer.
Definition: qgsexpressionbuilderwidget.cpp:265
QgsMapLayerAction::MultipleFeatures
@ MultipleFeatures
Definition: qgsmaplayeractionregistry.h:43
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:85
QgsDualView::filterChanged
void filterChanged()
Emitted whenever the filter changes.
QgsAttributeTableFilterModel::sort
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
Sort by the given column using the given order.
Definition: qgsattributetablefiltermodel.cpp:77
QgsDualView::attributeTableConfig
QgsAttributeTableConfig attributeTableConfig() const
The config used for the attribute table.
Definition: qgsdualview.cpp:1176
qgsdualview.h
QgsDualView::setFilteredFeatures
Q_DECL_DEPRECATED void setFilteredFeatures(const QgsFeatureIds &filteredFeatures)
Set a list of currently visible features.
Definition: qgsdualview.cpp:1122
QgsAttributeForm::save
bool save()
Save all the values from the editors to the layer.
Definition: qgsattributeform.cpp:738
QgsAttributeTableModel::modelChanged
void modelChanged()
Model has been changed.
QgsDualView::init
void init(QgsVectorLayer *layer, QgsMapCanvas *mapCanvas, const QgsFeatureRequest &request=QgsFeatureRequest(), const QgsAttributeEditorContext &context=QgsAttributeEditorContext(), bool loadFeatures=true)
Has to be called to initialize the dual view.
Definition: qgsdualview.cpp:119
QgsAttributeTableFilterModel::ShowEdited
@ ShowEdited
Show only features which have unsaved changes.
Definition: qgsattributetablefiltermodel.h:50
QgsExpressionContextUtils::globalProjectLayerScopes
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
Definition: qgsexpressioncontextutils.cpp:307
QgsSettings
This class is a composition of two QSettings instances:
Definition: qgssettings.h:62
QgsAttributeEditorContext::SearchMode
@ SearchMode
Form values are used for searching/filtering the layer.
Definition: qgsattributeeditorcontext.h:54
qgsfeaturelistmodel.h
QgsFeatureListView
Shows a list of features and renders a edit button next to each feature.
Definition: qgsfeaturelistview.h:46
QgsAttributeForm::zoomToFeatures
void zoomToFeatures(const QString &filter)
Emitted when the user chooses to zoom to a filtered set of features.
field
const QgsField & field
Definition: qgsfield.h:456
QgsDualView::toggleSearchMode
void toggleSearchMode(bool enabled)
Toggles whether search mode should be enabled in the form.
Definition: qgsdualview.cpp:660
QgsVectorLayerCache::invalidated
void invalidated()
The cache has been invalidated and cleared.
QgsAttributeTableModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows.
Definition: qgsattributetablemodel.cpp:584
QgsAttributeTableModel::executeAction
void executeAction(QUuid action, const QModelIndex &idx) const
Execute an action.
Definition: qgsattributetablemodel.cpp:853
QgsField::name
QString name
Definition: qgsfield.h:59
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsFeatureListModel::data
QVariant data(const QModelIndex &index, int role) const override
Definition: qgsfeaturelistmodel.cpp:60
QgsFeatureListModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: qgsfeaturelistmodel.cpp:413
QgsFeatureRequest::disableFilter
QgsFeatureRequest & disableFilter()
Disables filter conditions.
Definition: qgsfeaturerequest.h:446
QgsDualView::cancelProgress
void cancelProgress()
Cancel the progress dialog (if any)
Definition: qgsdualview.cpp:734
QgsFieldConditionalFormatWidget
A widget for customizing conditional formatting options.
Definition: qgsfieldconditionalformatwidget.h:36
QgsAttributeTableModel::executeMapLayerAction
void executeMapLayerAction(QgsMapLayerAction *action, const QModelIndex &idx) const
Execute a QgsMapLayerAction.
Definition: qgsattributetablemodel.cpp:859
QgsAttributeTableFilterModel::mapCanvas
QgsMapCanvas * mapCanvas() const
Returns the map canvas.
Definition: qgsattributetablefiltermodel.h:213
QgsDualView::FeatureListBrowsingAction
FeatureListBrowsingAction
Action on the map canvas when browsing the list of features.
Definition: qgsdualview.h:72
qgsapplication.h
QgsDualView::masterModel
QgsAttributeTableModel * masterModel() const
Returns the model which has the information about all features (not only filtered)
Definition: qgsdualview.h:182
QgsVectorDataProvider::SelectAtId
@ SelectAtId
Fast access to features using their ID.
Definition: qgsvectordataprovider.h:81
QgsFeatureListView::editLastFeature
void editLastFeature()
editLastFeature will try to edit the last feature of the list
Definition: qgsfeaturelistview.h:210
QgsFeatureRequest::setFilterRect
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
Definition: qgsfeaturerequest.cpp:92
qgsifeatureselectionmanager.h
QgsDualView::filteredFeatures
QgsFeatureIds filteredFeatures()
Gets a list of currently visible feature ids.
Definition: qgsdualview.h:175
QgsAttributeForm::parentFormValueChanged
void parentFormValueChanged(const QString &attribute, const QVariant &newValue)
Is called in embedded forms when an attribute value in the parent form has changed to newValue.
Definition: qgsattributeform.cpp:1287
QgsAttributeTableConfig
This is a container for configuration of the attribute table.
Definition: qgsattributetableconfig.h:37
QgsFeatureRequest
This class wraps a request for features to a vector layer (or directly its vector data provider).
Definition: qgsfeaturerequest.h:76
QgsDualView::saveEditChanges
bool saveEditChanges()
saveEditChanges
Definition: qgsdualview.cpp:637
QgsAttributeForm::refreshFeature
void refreshFeature()
reload current feature
Definition: qgsattributeform.cpp:1273
QgsVectorLayerCache::finished
void finished()
When filling the cache, this signal gets emitted once the cache is fully initialized.
QgsVectorLayerCache::progress
void progress(int i, bool &cancel)
When filling the cache, this signal gets emitted periodically to notify about the progress and to be ...
QgsDualView::ZoomToFeature
@ ZoomToFeature
The map is zoomed to contained the feature bounding-box.
Definition: qgsdualview.h:75
qgsscrollarea.h
QgsAttributeTableFilterModel::featuresFiltered
void featuresFiltered()
Emitted when the filtering of the features has been done.
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:262
QgsAttributeTableAction::execute
void execute()
Definition: qgsdualview.cpp:1207
QgsAttributeTableConfig::mapVisibleColumnToIndex
int mapVisibleColumnToIndex(int visibleColumn) const
Maps a visible column index to its original column index.
Definition: qgsattributetableconfig.cpp:30
qgsactionmanager.h
QgsVectorLayer::selectionChanged
void selectionChanged(const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect)
Emitted when selection was changed.
QgsAttributeTableModel::rowToId
QgsFeatureId rowToId(int row) const
Maps row to feature id.
Definition: qgsattributetablemodel.cpp:562
QgsShortcutsManager::shortcutByName
QShortcut * shortcutByName(const QString &name) const
Returns a shortcut by its name, or nullptr if nothing found.
Definition: qgsshortcutsmanager.cpp:302
QgsAttributeTableModel::setRequest
void setRequest(const QgsFeatureRequest &request)
Set a request that will be used to fill this attribute table model.
Definition: qgsattributetablemodel.cpp:978
QgsAttributeTableFilterModel::sortColumnChanged
void sortColumnChanged(int column, Qt::SortOrder order)
Emitted whenever the sort column is changed.
QgsAttributeTableFilterModel::layer
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
Definition: qgsattributetablefiltermodel.h:150
QgsMapLayerAction::Layer
@ Layer
Definition: qgsmaplayeractionregistry.h:41
QgsAttributeTableModel
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
Definition: qgsattributetablemodel.h:50
QgsExpressionBuilderDialog
A generic dialog for building expression strings.
Definition: qgsexpressionbuilderdialog.h:31
QgsAttributeTableAction
Definition: qgsdualview.h:445
QgsDualView::setAttributeTableConfig
void setAttributeTableConfig(const QgsAttributeTableConfig &config)
Set the attribute table config which should be used to control the appearance of the attribute table.
Definition: qgsdualview.cpp:1150
QgsSettings::setEnumValue
void setEnumValue(const QString &key, const T &value, const Section section=NoSection)
Set the value of a setting based on an enum.
Definition: qgssettings.h:304
QgsFieldConditionalFormatWidget::rulesUpdated
void rulesUpdated(const QString &fieldName)
Emitted when the conditional styling rules are updated.
QgsMapCanvas::extentsChanged
void extentsChanged()
Emitted when the extents of the map change.
QgsDualView::filterMode
QgsAttributeTableFilterModel::FilterMode filterMode()
Gets the filter mode.
Definition: qgsdualview.h:130
QgsDualView::AttributeEditor
@ AttributeEditor
Show a list of the features, where one can be chosen and the according attribute dialog will be prese...
Definition: qgsdualview.h:65
QgsAttributeTableFilterModel::setAttributeTableConfig
void setAttributeTableConfig(const QgsAttributeTableConfig &config)
Set the attribute table configuration to control which fields are shown, in which order they are show...
Definition: qgsattributetablefiltermodel.cpp:144
QgsAttributeEditorContext::MultiEditMode
@ MultiEditMode
Multi edit mode, for editing fields of multiple features at once.
Definition: qgsattributeeditorcontext.h:53
qgsvectordataprovider.h
QgsDualView::setSelectedOnTop
void setSelectedOnTop(bool selectedOnTop)
Toggle the selectedOnTop flag.
Definition: qgsdualview.cpp:373
QgsMapLayerActionRegistry::mapLayerActions
QList< QgsMapLayerAction * > mapLayerActions(QgsMapLayer *layer, QgsMapLayerAction::Targets targets=QgsMapLayerAction::AllActions)
Returns the map layer actions which can run on the specified layer.
Definition: qgsmaplayeractionregistry.cpp:125
QgsDualView::setSortExpression
void setSortExpression(const QString &sortExpression, Qt::SortOrder sortOrder=Qt::AscendingOrder)
Set the expression used for sorting the table and feature list.
Definition: qgsdualview.cpp:1159
QgsAttributeTableConfig::setColumnWidth
void setColumnWidth(int column, int width)
Sets the width of a column.
Definition: qgsattributetableconfig.cpp:213
QgsActionMenu
This class is a menu that is populated automatically with the actions defined for a given layer.
Definition: qgsactionmenu.h:38
QgsAttributeTableFilterModel::setSelectedOnTop
void setSelectedOnTop(bool selectedOnTop)
Changes the sort order of the features.
Definition: qgsattributetablefiltermodel.cpp:262
QgsFeatureRequest::setFilterFids
QgsFeatureRequest & setFilterFids(const QgsFeatureIds &fids)
Sets feature IDs that should be fetched.
Definition: qgsfeaturerequest.cpp:105
QgsAttributeTableModel::finished
void finished()
QgsDualView::hideEvent
void hideEvent(QHideEvent *event) override
Definition: qgsdualview.cpp:748
QgsAttributeTableFilterModel::rowToId
QgsFeatureId rowToId(const QModelIndex &row)
Returns the feature id for a given model index.
Definition: qgsattributetablefiltermodel.cpp:642
qgsattributetablemodel.h
QgsSettings::setValue
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Definition: qgssettings.cpp:289
qgsmaplayeractionregistry.h
QgsAttributeTableModel::loadLayer
virtual void loadLayer()
Loads the layer into the model Preferably to be called, before using this model as source for any oth...
Definition: qgsattributetablemodel.cpp:435
QgsDualView::setFilterMode
void setFilterMode(QgsAttributeTableFilterModel::FilterMode filterMode)
Set the filter mode.
Definition: qgsdualview.cpp:282
QgsMapCanvas::panToFeatureIds
void panToFeatureIds(QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter=true)
Centers canvas extent to feature ids.
Definition: qgsmapcanvas.cpp:1367
QgsFeatureIds
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
QgsDualView::setCurrentEditSelection
void setCurrentEditSelection(const QgsFeatureIds &fids)
Set the current edit selection in the AttributeEditor mode.
Definition: qgsdualview.cpp:631
qgsorganizetablecolumnsdialog.h
QgsDualView::ViewMode
ViewMode
The view modes, in which this widget can present information.
Definition: qgsdualview.h:53
QgsScrollArea
A QScrollArea subclass with improved scrolling behavior.
Definition: qgsscrollarea.h:42
QgsAction
Utility class that encapsulates an action based on vector attributes.
Definition: qgsaction.h:36
QgsMapCanvas::flashFeatureIds
void flashFeatureIds(QgsVectorLayer *layer, const QgsFeatureIds &ids, const QColor &startColor=QColor(255, 0, 0, 255), const QColor &endColor=QColor(255, 0, 0, 0), int flashes=3, int duration=500)
Causes a set of features with matching ids from a vector layer to flash within the canvas.
Definition: qgsmapcanvas.cpp:1448
QgsAttributeTableFilterModel::setFilterMode
void setFilterMode(FilterMode filterMode)
Set the filter mode the filter will use.
Definition: qgsattributetablefiltermodel.cpp:328
QgsAttributeTableFilterModel
Definition: qgsattributetablefiltermodel.h:36
QgsAttributeTableFilterModel::disconnectFilterModeConnections
void disconnectFilterModeConnections()
Disconnect the connections set for the current filterMode.
Definition: qgsattributetablefiltermodel.cpp:339
QgsAttributeTableConfig::setColumnHidden
void setColumnHidden(int column, bool hidden)
Sets whether the specified column should be hidden.
Definition: qgsattributetableconfig.cpp:223
QgsVectorLayerCache::setFullCache
void setFullCache(bool fullCache)
This enables or disables full caching.
Definition: qgsvectorlayercache.cpp:87
QgsAttributeTableMapLayerAction::execute
void execute()
Definition: qgsdualview.cpp:1224
qgseditorwidgetregistry.h
QgsAttributeForm::setMode
void setMode(QgsAttributeEditorContext::Mode mode)
Sets the current mode of the form.
Definition: qgsattributeform.cpp:131
QgsAttributeTableModel::data
QVariant data(const QModelIndex &index, int role) const override
Returns data on the given index.
Definition: qgsattributetablemodel.cpp:636
QgsAttributeTableFilterModel::ShowSelected
@ ShowSelected
Show only selected features.
Definition: qgsattributetablefiltermodel.h:47
QgsAttributeTableModel::fieldConditionalStyleChanged
void fieldConditionalStyleChanged(const QString &fieldName)
Handles updating the model when the conditional style for a field changes.
Definition: qgsattributetablemodel.cpp:488
QgsDualView::sortExpression
QString sortExpression() const
Gets the expression used for sorting the table and feature list.
Definition: qgsdualview.cpp:1171
QgsAttributeTableFilterModel::setFilterExpression
void setFilterExpression(const QgsExpression &expression, const QgsExpressionContext &context)
Set the expression and the context to be stored in case of the features need to be filtered again (li...
Definition: qgsattributetablefiltermodel.cpp:241
QgsFeatureListModel
Definition: qgsfeaturelistmodel.h:39
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsAttributeTableFilterModel::filterFeatures
void filterFeatures()
Updates the filtered features in the filter model.
Definition: qgsattributetablefiltermodel.cpp:470
QgsDualView::parentFormValueChanged
void parentFormValueChanged(const QString &attribute, const QVariant &value)
Called in embedded forms when an attribute value in the parent form has changed.
Definition: qgsdualview.cpp:740
QgsFeatureListView::currentEditSelectionChanged
void currentEditSelectionChanged(QgsFeature &feat)
Emitted whenever the current edit selection has been changed.
QgsFeatureListView::willShowContextMenu
void willShowContextMenu(QgsActionMenu *menu, const QModelIndex &atIndex)
Emitted when the context menu is created to add the specific actions to it.
qgssettings.h
QgsDualView::setFeatureSelectionManager
void setFeatureSelectionManager(QgsIFeatureSelectionManager *featureSelectionManager)
Set the feature selection model.
Definition: qgsdualview.cpp:1139
QgsVectorLayerCache::setCacheGeometry
void setCacheGeometry(bool cacheGeometry)
Enable or disable the caching of geometries.
Definition: qgsvectorlayercache.cpp:63
QgsAttributeTableFilterModel::setFilteredFeatures
virtual void setFilteredFeatures(const QgsFeatureIds &ids)
Specify a list of features, which the filter will accept.
Definition: qgsattributetablefiltermodel.cpp:309
QgsAttributeTableModel::setExtraColumns
void setExtraColumns(int extraColumns)
Empty extra columns to announce from this model.
Definition: qgsattributetablemodel.cpp:99
QgsDualView::~QgsDualView
~QgsDualView() override
Definition: qgsdualview.cpp:113
QgsDualView::featureCount
int featureCount()
Returns the number of features on the layer.
Definition: qgsdualview.cpp:712
QgsAttributeForm::filterExpressionSet
void filterExpressionSet(const QString &expression, QgsAttributeForm::FilterType type)
Emitted when a filter expression is set using the form.
QgsDualView::filteredFeatureCount
int filteredFeatureCount()
Returns the number of features which are currently visible, according to the filter restrictions.
Definition: qgsdualview.cpp:717
QgsDualView::filterFeatures
void filterFeatures(const QgsExpression &filterExpression, const QgsExpressionContext &context)
Sets the expression and Updates the filtered features in the filter model.
Definition: qgsdualview.cpp:1127
QgsGui::shortcutsManager
static QgsShortcutsManager * shortcutsManager()
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.
Definition: qgsgui.cpp:84
QgsFeatureRequest::FilterNone
@ FilterNone
No filter is applied.
Definition: qgsfeaturerequest.h:92
QgsAttributeForm::widgetValueChanged
void widgetValueChanged(const QString &attribute, const QVariant &value, bool attributeChanged)
Notifies about changes of attributes.
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:56
QgsFeatureListModel::setSortByDisplayExpression
void setSortByDisplayExpression(bool sortByDisplayExpression, Qt::SortOrder order=Qt::AscendingOrder)
Sort this model by its display expression.
Definition: qgsfeaturelistmodel.cpp:297
QgsDualView::filterExpressionSet
void filterExpressionSet(const QString &expression, QgsAttributeForm::FilterType type)
Emitted when a filter expression is set using the view.
QgsDualView::showContextMenuExternally
void showContextMenuExternally(QgsActionMenu *menu, QgsFeatureId fid)
Emitted when selecting context menu on the feature list to create the context menu individually.
QgsFeatureListView::editFirstFeature
void editFirstFeature()
editFirstFeature will try to edit the first feature of the list
Definition: qgsfeaturelistview.h:192
QgsAttributeForm
Definition: qgsattributeform.h:45
QgsAttributeTableView::willShowContextMenu
void willShowContextMenu(QMenu *menu, const QModelIndex &atIndex)
Emitted in order to provide a hook to add additional* menu entries to the context menu.
QgsAttributeTableFilterModel::filterMode
FilterMode filterMode()
The current filterModel.
Definition: qgsattributetablefiltermodel.h:143
QgsMapCanvas::zoomToFeatureIds
void zoomToFeatureIds(QgsVectorLayer *layer, const QgsFeatureIds &ids)
Set canvas extent to the bounding box of a set of features.
Definition: qgsmapcanvas.cpp:1343
QgsIFeatureSelectionManager
Is an interface class to abstract feature selection handling.
Definition: qgsifeatureselectionmanager.h:32
qgsfieldconditionalformatwidget.h
QgsSettings::enumValue
T enumValue(const QString &key, const T &defaultValue, const Section section=NoSection)
Returns the setting value for a setting based on an enum.
Definition: qgssettings.h:252
QgsExpressionBuilderWidget::setExpressionText
void setExpressionText(const QString &expression)
Sets the expression string for the widget.
Definition: qgsexpressionbuilderwidget.cpp:611
QgsAttributeEditorContext::parentContext
const QgsAttributeEditorContext * parentContext() const
Definition: qgsattributeeditorcontext.h:230
QgsAttributeTableMapLayerAction
Definition: qgsdualview.h:477
QgsAttributeTableModel::request
const QgsFeatureRequest & request() const
Gets the the feature request.
Definition: qgsattributetablemodel.cpp:985
QgsExpression
Class for parsing and evaluation of expressions (formerly called "search strings").
Definition: qgsexpression.h:105
QgsAttributeEditorContext
This class contains context information for attribute editor widgets.
Definition: qgsattributeeditorcontext.h:41
QgsAttributeTableConfig::setSortExpression
void setSortExpression(const QString &sortExpression)
Set the sort expression used for sorting.
Definition: qgsattributetableconfig.cpp:203
QgsAttributeTableFilterModel::FilterMode
FilterMode
The filter mode defines how the rows should be filtered.
Definition: qgsattributetablefiltermodel.h:45
QgsExpressionBuilderWidget::expressionText
QString expressionText()
Gets the expression string that has been set in the expression area.
Definition: qgsexpressionbuilderwidget.cpp:606
QgsDualView::setRequest
void setRequest(const QgsFeatureRequest &request)
Set the request.
Definition: qgsdualview.cpp:1134
QgsAttributeTableModel::setEditorContext
void setEditorContext(const QgsAttributeEditorContext &context)
Sets the context in which this table is shown.
Definition: qgsattributetablemodel.h:237
QgsFeatureRequest::setFlags
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
Definition: qgsfeaturerequest.cpp:179
QgsFeatureListView::editNextFeature
void editNextFeature()
editNextFeature will try to edit next feature of the list
Definition: qgsfeaturelistview.h:198
QgsAttributeTableView::columnResized
void columnResized(int column, int width)
Emitted when a column in the view has been resized.
QgsFeatureListView::currentEditSelectionProgressChanged
void currentEditSelectionProgressChanged(int progress, int count)
Emitted whenever the current edit selection has been changed.
QgsFeatureListView::aboutToChangeEditSelection
void aboutToChangeEditSelection(bool &ok)
QgsRectangle::isNull
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
Definition: qgsrectangle.h:447
QgsDualView::displayExpressionChanged
void displayExpressionChanged(const QString &expression)
Emitted whenever the display expression is successfully changed.
QgsDualView::openConditionalStyles
void openConditionalStyles()
Definition: qgsdualview.cpp:642
QgsAttributeTableFilterModel::ShowVisible
@ ShowVisible
Show only visible features (depends on the map canvas)
Definition: qgsattributetablefiltermodel.h:48
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition: qgsfeatureid.h:28
qgsmessagelog.h
qgsexpressionbuilderdialog.h
QgsField
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:50
QgsAttributeTableConfig::update
void update(const QgsFields &fields)
Update the configuration with the given fields.
Definition: qgsattributetableconfig.cpp:50