QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 )
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  panOrZoomToFeature( featureset );
622 
623  }
624  else
625  {
626  // Couldn't save feature
627  }
628 }
629 
631 {
632  mFeatureListView->setCurrentFeatureEdited( false );
633  mFeatureListView->setEditSelection( fids );
634 }
635 
637 {
638  return mAttributeForm->save();
639 }
640 
642 {
643  mConditionalFormatWidgetStack->setVisible( !mConditionalFormatWidgetStack->isVisible() );
644 }
645 
647 {
648  if ( enabled )
649  {
650  mPreviousView = view();
652  }
653  else
654  setView( mPreviousView );
655 
657 }
658 
659 void QgsDualView::toggleSearchMode( bool enabled )
660 {
661  if ( enabled )
662  {
665  }
666  else
667  {
669  }
670 }
671 
672 void QgsDualView::previewExpressionBuilder()
673 {
674  // Show expression builder
676 
677  QgsExpressionBuilderDialog dlg( mLayer, mFeatureListView->displayExpression(), this, QStringLiteral( "generic" ), context );
678  dlg.setWindowTitle( tr( "Expression Based Preview" ) );
679  dlg.setExpressionText( mFeatureListView->displayExpression() );
680 
681  if ( dlg.exec() == QDialog::Accepted )
682  {
683  mFeatureListView->setDisplayExpression( dlg.expressionText() );
684  mFeatureListPreviewButton->setDefaultAction( mActionExpressionPreview );
685  mFeatureListPreviewButton->setPopupMode( QToolButton::MenuButtonPopup );
686  }
687 
688  setDisplayExpression( mFeatureListView->displayExpression() );
689 }
690 
691 void QgsDualView::previewColumnChanged( QAction *previewAction, const QString &expression )
692 {
693  if ( !mFeatureListView->setDisplayExpression( QStringLiteral( "COALESCE( \"%1\", '<NULL>' )" ).arg( expression ) ) )
694  {
695  QMessageBox::warning( this,
696  tr( "Column Preview" ),
697  tr( "Could not set column '%1' as preview column.\nParser error:\n%2" )
698  .arg( previewAction->text(), mFeatureListView->parserErrorString() )
699  );
700  }
701  else
702  {
703  mFeatureListPreviewButton->setText( previewAction->text() );
704  mFeatureListPreviewButton->setIcon( previewAction->icon() );
705  mFeatureListPreviewButton->setPopupMode( QToolButton::InstantPopup );
706  }
707 
708  setDisplayExpression( mFeatureListView->displayExpression() );
709 }
710 
712 {
713  return mMasterModel->rowCount();
714 }
715 
717 {
718  return mFilterModel->rowCount();
719 }
720 
722 {
723  const QModelIndex currentIndex = mTableView->currentIndex();
724  if ( !currentIndex.isValid() )
725  {
726  return;
727  }
728 
729  QVariant var = mMasterModel->data( currentIndex, Qt::DisplayRole );
730  QApplication::clipboard()->setText( var.toString() );
731 }
732 
734 {
735  if ( mProgressDlg )
736  mProgressDlg->cancel();
737 }
738 
739 void QgsDualView::parentFormValueChanged( const QString &attribute, const QVariant &newValue )
740 {
741  if ( mAttributeForm )
742  {
743  mAttributeForm->parentFormValueChanged( attribute, newValue );
744  }
745 }
746 
747 void QgsDualView::hideEvent( QHideEvent *event )
748 {
749  Q_UNUSED( event )
750  saveRecentDisplayExpressions();
751 }
752 
753 void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &masterIndex )
754 {
755  if ( !menu )
756  {
757  return;
758  }
759 
760  QAction *copyContentAction = menu->addAction( tr( "Copy Cell Content" ) );
761  menu->addAction( copyContentAction );
762  connect( copyContentAction, &QAction::triggered, this, [masterIndex, this]
763  {
764  QVariant var = mMasterModel->data( masterIndex, Qt::DisplayRole );
765  QApplication::clipboard()->setText( var.toString() );
766  } );
767 
768  QgsVectorLayer *vl = mFilterModel->layer();
769  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
770  if ( canvas && vl && vl->geometryType() != QgsWkbTypes::NullGeometry )
771  {
772  QAction *zoomToFeatureAction = menu->addAction( tr( "Zoom to Feature" ) );
773  connect( zoomToFeatureAction, &QAction::triggered, this, &QgsDualView::zoomToCurrentFeature );
774 
775  QAction *panToFeatureAction = menu->addAction( tr( "Pan to Feature" ) );
776  connect( panToFeatureAction, &QAction::triggered, this, &QgsDualView::panToCurrentFeature );
777 
778  QAction *flashFeatureAction = menu->addAction( tr( "Flash Feature" ) );
779  connect( flashFeatureAction, &QAction::triggered, this, &QgsDualView::flashCurrentFeature );
780  }
781 
782  //add user-defined actions to context menu
783  const QList<QgsAction> actions = mLayer->actions()->actions( QStringLiteral( "Field" ) );
784  if ( !actions.isEmpty() )
785  {
786  QAction *a = menu->addAction( tr( "Run Layer Action" ) );
787  a->setEnabled( false );
788 
789  for ( const QgsAction &action : actions )
790  {
791  if ( !action.runable() )
792  continue;
793 
794  if ( vl && !vl->isEditable() && action.isEnabledOnlyWhenEditable() )
795  continue;
796 
797  QgsAttributeTableAction *a = new QgsAttributeTableAction( action.name(), this, action.id(), masterIndex );
798  menu->addAction( action.name(), a, &QgsAttributeTableAction::execute );
799  }
800  }
801  QModelIndex rowSourceIndex = mMasterModel->index( masterIndex.row(), 0 );
802  if ( ! rowSourceIndex.isValid() )
803  {
804  return;
805  }
806 
807  //add actions from QgsMapLayerActionRegistry to context menu
808  const QList<QgsMapLayerAction *> registeredActions = QgsGui::mapLayerActionRegistry()->mapLayerActions( mLayer, QgsMapLayerAction::Layer | QgsMapLayerAction::SingleFeature );
809  if ( !registeredActions.isEmpty() )
810  {
811  //add a separator between user defined and standard actions
812  menu->addSeparator();
813 
814  for ( QgsMapLayerAction *action : registeredActions )
815  {
816  QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction( action->text(), this, action, rowSourceIndex );
817  menu->addAction( action->text(), a, &QgsAttributeTableMapLayerAction::execute );
818  }
819  }
820 
821  // entries for multiple features layer actions
822  // only show if the context menu is shown over a selected row
823  const QgsFeatureId currentFid = mMasterModel->rowToId( masterIndex.row() );
824  if ( mLayer->selectedFeatureCount() > 1 && mLayer->selectedFeatureIds().contains( currentFid ) )
825  {
826  const QList<QgsMapLayerAction *> registeredActions = QgsGui::mapLayerActionRegistry()->mapLayerActions( mLayer, QgsMapLayerAction::MultipleFeatures );
827  if ( !registeredActions.isEmpty() )
828  {
829  menu->addSeparator();
830  QAction *action = menu->addAction( tr( "Actions on Selection (%1)" ).arg( mLayer->selectedFeatureCount() ) );
831  action->setEnabled( false );
832 
833  for ( QgsMapLayerAction *action : registeredActions )
834  {
835  menu->addAction( action->text(), action, [ = ]() {action->triggerForFeatures( mLayer, mLayer->selectedFeatures() );} );
836  }
837  }
838  }
839 
840  menu->addSeparator();
841  QgsAttributeTableAction *a = new QgsAttributeTableAction( tr( "Open Form" ), this, QString(), rowSourceIndex );
842  menu->addAction( tr( "Open Form…" ), a, &QgsAttributeTableAction::featureForm );
843 }
844 
845 
846 void QgsDualView::widgetWillShowContextMenu( QgsActionMenu *menu, const QModelIndex &atIndex )
847 {
848  emit showContextMenuExternally( menu, mFilterModel->rowToId( atIndex ) );
849 }
850 
851 
852 void QgsDualView::showViewHeaderMenu( QPoint point )
853 {
854  int col = mTableView->columnAt( point.x() );
855 
856  delete mHorizontalHeaderMenu;
857  mHorizontalHeaderMenu = new QMenu( this );
858 
859  QAction *hide = new QAction( tr( "&Hide Column" ), mHorizontalHeaderMenu );
860  connect( hide, &QAction::triggered, this, &QgsDualView::hideColumn );
861  hide->setData( col );
862  mHorizontalHeaderMenu->addAction( hide );
863  QAction *setWidth = new QAction( tr( "&Set Width…" ), mHorizontalHeaderMenu );
864  connect( setWidth, &QAction::triggered, this, &QgsDualView::resizeColumn );
865  setWidth->setData( col );
866  mHorizontalHeaderMenu->addAction( setWidth );
867  QAction *optimizeWidth = new QAction( tr( "&Autosize" ), mHorizontalHeaderMenu );
868  connect( optimizeWidth, &QAction::triggered, this, &QgsDualView::autosizeColumn );
869  optimizeWidth->setData( col );
870  mHorizontalHeaderMenu->addAction( optimizeWidth );
871 
872  mHorizontalHeaderMenu->addSeparator();
873  QAction *organize = new QAction( tr( "&Organize Columns…" ), mHorizontalHeaderMenu );
874  connect( organize, &QAction::triggered, this, &QgsDualView::organizeColumns );
875  mHorizontalHeaderMenu->addAction( organize );
876  QAction *sort = new QAction( tr( "&Sort…" ), mHorizontalHeaderMenu );
877  connect( sort, &QAction::triggered, this, [ = ]() {modifySort();} );
878  mHorizontalHeaderMenu->addAction( sort );
879 
880  mHorizontalHeaderMenu->popup( mTableView->horizontalHeader()->mapToGlobal( point ) );
881 }
882 
883 void QgsDualView::organizeColumns()
884 {
885  if ( !mLayer )
886  {
887  return;
888  }
889 
890  QgsOrganizeTableColumnsDialog dialog( mLayer, attributeTableConfig(), this );
891  if ( dialog.exec() == QDialog::Accepted )
892  {
893  QgsAttributeTableConfig config = dialog.config();
894  setAttributeTableConfig( config );
895  }
896 }
897 
898 void QgsDualView::tableColumnResized( int column, int width )
899 {
900  QgsAttributeTableConfig config = mConfig;
901  int sourceCol = config.mapVisibleColumnToIndex( column );
902  if ( sourceCol >= 0 && config.columnWidth( sourceCol ) != width )
903  {
904  config.setColumnWidth( sourceCol, width );
905  setAttributeTableConfig( config );
906  }
907 }
908 
909 void QgsDualView::hideColumn()
910 {
911  QAction *action = qobject_cast<QAction *>( sender() );
912  int col = action->data().toInt();
913  QgsAttributeTableConfig config = mConfig;
914  int sourceCol = mConfig.mapVisibleColumnToIndex( col );
915  if ( sourceCol >= 0 )
916  {
917  config.setColumnHidden( sourceCol, true );
918  setAttributeTableConfig( config );
919  }
920 }
921 
922 void QgsDualView::resizeColumn()
923 {
924  QAction *action = qobject_cast<QAction *>( sender() );
925  int col = action->data().toInt();
926  if ( col < 0 )
927  return;
928 
929  QgsAttributeTableConfig config = mConfig;
930  int sourceCol = config.mapVisibleColumnToIndex( col );
931  if ( sourceCol >= 0 )
932  {
933  bool ok = false;
934  int width = QInputDialog::getInt( this, tr( "Set column width" ), tr( "Enter column width" ),
935  mTableView->columnWidth( col ),
936  0, 1000, 10, &ok );
937  if ( ok )
938  {
939  config.setColumnWidth( sourceCol, width );
940  setAttributeTableConfig( config );
941  }
942  }
943 }
944 
945 void QgsDualView::autosizeColumn()
946 {
947  QAction *action = qobject_cast<QAction *>( sender() );
948  int col = action->data().toInt();
949  mTableView->resizeColumnToContents( col );
950 }
951 
952 bool QgsDualView::modifySort()
953 {
954  if ( !mLayer )
955  return false;
956 
957  QgsAttributeTableConfig config = mConfig;
958 
959  QDialog orderByDlg;
960  orderByDlg.setWindowTitle( tr( "Configure Attribute Table Sort Order" ) );
961  QDialogButtonBox *dialogButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
962  QGridLayout *layout = new QGridLayout();
963  connect( dialogButtonBox, &QDialogButtonBox::accepted, &orderByDlg, &QDialog::accept );
964  connect( dialogButtonBox, &QDialogButtonBox::rejected, &orderByDlg, &QDialog::reject );
965  orderByDlg.setLayout( layout );
966 
967  QGroupBox *sortingGroupBox = new QGroupBox();
968  sortingGroupBox->setTitle( tr( "Defined sort order in attribute table" ) );
969  sortingGroupBox->setCheckable( true );
970  sortingGroupBox->setChecked( !sortExpression().isEmpty() );
971  layout->addWidget( sortingGroupBox );
972  sortingGroupBox->setLayout( new QGridLayout() );
973 
974  QgsExpressionBuilderWidget *expressionBuilder = new QgsExpressionBuilderWidget();
976 
977  expressionBuilder->initWithLayer( mLayer, context, QStringLiteral( "generic" ) );
978  expressionBuilder->setExpressionText( sortExpression().isEmpty() ? mLayer->displayExpression() : sortExpression() );
979 
980  sortingGroupBox->layout()->addWidget( expressionBuilder );
981 
982  QCheckBox *cbxSortAscending = new QCheckBox( tr( "Sort ascending" ) );
983  cbxSortAscending->setChecked( config.sortOrder() == Qt::AscendingOrder );
984  sortingGroupBox->layout()->addWidget( cbxSortAscending );
985 
986  layout->addWidget( dialogButtonBox );
987  if ( orderByDlg.exec() )
988  {
989  Qt::SortOrder sortOrder = cbxSortAscending->isChecked() ? Qt::AscendingOrder : Qt::DescendingOrder;
990  if ( sortingGroupBox->isChecked() )
991  {
992  setSortExpression( expressionBuilder->expressionText(), sortOrder );
993  config.setSortExpression( expressionBuilder->expressionText() );
994  config.setSortOrder( sortOrder );
995  }
996  else
997  {
998  setSortExpression( QString(), sortOrder );
999  config.setSortExpression( QString() );
1000  }
1001 
1002  setAttributeTableConfig( config );
1003  return true;
1004  }
1005  else
1006  {
1007  return false;
1008  }
1009 
1010 }
1011 
1012 void QgsDualView::zoomToCurrentFeature()
1013 {
1014  QModelIndex currentIndex = mTableView->currentIndex();
1015  if ( !currentIndex.isValid() )
1016  {
1017  return;
1018  }
1019 
1020  QgsFeatureIds ids;
1021  ids.insert( mFilterModel->rowToId( currentIndex ) );
1022  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
1023  if ( canvas )
1024  {
1025  canvas->zoomToFeatureIds( mLayer, ids );
1026  }
1027 }
1028 
1029 void QgsDualView::panToCurrentFeature()
1030 {
1031  QModelIndex currentIndex = mTableView->currentIndex();
1032  if ( !currentIndex.isValid() )
1033  {
1034  return;
1035  }
1036 
1037  QgsFeatureIds ids;
1038  ids.insert( mFilterModel->rowToId( currentIndex ) );
1039  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
1040  if ( canvas )
1041  {
1042  canvas->panToFeatureIds( mLayer, ids );
1043  }
1044 }
1045 
1046 void QgsDualView::flashCurrentFeature()
1047 {
1048  QModelIndex currentIndex = mTableView->currentIndex();
1049  if ( !currentIndex.isValid() )
1050  {
1051  return;
1052  }
1053 
1054  QgsFeatureIds ids;
1055  ids.insert( mFilterModel->rowToId( currentIndex ) );
1056  QgsMapCanvas *canvas = mFilterModel->mapCanvas();
1057  if ( canvas )
1058  {
1059  canvas->flashFeatureIds( mLayer, ids );
1060  }
1061 }
1062 
1063 void QgsDualView::rebuildFullLayerCache()
1064 {
1065  connect( mLayerCache, &QgsVectorLayerCache::progress, this, &QgsDualView::progress, Qt::UniqueConnection );
1066  connect( mLayerCache, &QgsVectorLayerCache::finished, this, &QgsDualView::finished, Qt::UniqueConnection );
1067 
1068  mLayerCache->setFullCache( true );
1069 }
1070 
1071 void QgsDualView::previewExpressionChanged( const QString &expression )
1072 {
1073  mLayer->setDisplayExpression( expression );
1074 }
1075 
1076 void QgsDualView::onSortColumnChanged()
1077 {
1079  if ( cfg.sortExpression() != mFilterModel->sortExpression() ||
1080  cfg.sortOrder() != mFilterModel->sortOrder() )
1081  {
1082  cfg.setSortExpression( mFilterModel->sortExpression() );
1083  cfg.setSortOrder( mFilterModel->sortOrder() );
1084  setAttributeTableConfig( cfg );
1085  }
1086 }
1087 
1088 void QgsDualView::updateSelectedFeatures()
1089 {
1090  QgsFeatureRequest r = mMasterModel->request();
1092  return; // already requested all features
1093 
1094  r.setFilterFids( masterModel()->layer()->selectedFeatureIds() );
1095  mMasterModel->setRequest( r );
1096  mMasterModel->loadLayer();
1097  emit filterChanged();
1098 }
1099 
1100 void QgsDualView::extentChanged()
1101 {
1102  QgsFeatureRequest r = mMasterModel->request();
1103  if ( mFilterModel->mapCanvas() && ( r.filterType() != QgsFeatureRequest::FilterNone || !r.filterRect().isNull() ) )
1104  {
1105  QgsRectangle rect = mFilterModel->mapCanvas()->mapSettings().mapToLayerCoordinates( mLayer, mFilterModel->mapCanvas()->extent() );
1106  r.setFilterRect( rect );
1107  mMasterModel->setRequest( r );
1108  mMasterModel->loadLayer();
1109  }
1110  emit filterChanged();
1111 }
1112 
1113 void QgsDualView::featureFormAttributeChanged( const QString &attribute, const QVariant &value, bool attributeChanged )
1114 {
1115  Q_UNUSED( attribute )
1116  Q_UNUSED( value )
1117  if ( attributeChanged )
1118  mFeatureListView->setCurrentFeatureEdited( true );
1119 }
1120 
1121 void QgsDualView::setFilteredFeatures( const QgsFeatureIds &filteredFeatures )
1122 {
1123  mFilterModel->setFilteredFeatures( filteredFeatures );
1124 }
1125 
1126 void QgsDualView::filterFeatures( const QgsExpression &filterExpression, const QgsExpressionContext &context )
1127 {
1128  mFilterModel->setFilterExpression( filterExpression, context );
1129  mFilterModel->filterFeatures();
1130 }
1131 
1132 
1134 {
1135  mMasterModel->setRequest( request );
1136 }
1137 
1139 {
1140  mTableView->setFeatureSelectionManager( featureSelectionManager );
1141  mFeatureListView->setFeatureSelectionManager( featureSelectionManager );
1142 
1143  if ( mFeatureSelectionManager && mFeatureSelectionManager->parent() == this )
1144  delete mFeatureSelectionManager;
1145 
1146  mFeatureSelectionManager = featureSelectionManager;
1147 }
1148 
1150 {
1151  mConfig = config;
1152  mConfig.update( mLayer->fields() );
1153  mLayer->setAttributeTableConfig( mConfig );
1154  mFilterModel->setAttributeTableConfig( mConfig );
1155  mTableView->setAttributeTableConfig( mConfig );
1156 }
1157 
1158 void QgsDualView::setSortExpression( const QString &sortExpression, Qt::SortOrder sortOrder )
1159 {
1160  if ( sortExpression.isNull() )
1161  mFilterModel->sort( -1 );
1162  else
1163  mFilterModel->sort( sortExpression, sortOrder );
1164 
1165  mConfig.setSortExpression( sortExpression );
1166  mConfig.setSortOrder( sortOrder );
1167  setAttributeTableConfig( mConfig );
1168 }
1169 
1171 {
1172  return mFilterModel->sortExpression();
1173 }
1174 
1176 {
1177  return mConfig;
1178 }
1179 
1180 void QgsDualView::progress( int i, bool &cancel )
1181 {
1182  if ( !mProgressDlg )
1183  {
1184  mProgressDlg = new QProgressDialog( tr( "Loading features…" ), tr( "Abort" ), 0, 0, this );
1185  mProgressDlg->setWindowTitle( tr( "Attribute Table" ) );
1186  mProgressDlg->setWindowModality( Qt::WindowModal );
1187  mProgressDlg->show();
1188  }
1189 
1190  mProgressDlg->setLabelText( tr( "%1 features loaded." ).arg( i ) );
1191  QCoreApplication::processEvents();
1192 
1193  cancel = mProgressDlg && mProgressDlg->wasCanceled();
1194 }
1195 
1196 void QgsDualView::finished()
1197 {
1198  delete mProgressDlg;
1199  mProgressDlg = nullptr;
1200 }
1201 
1202 /*
1203  * QgsAttributeTableAction
1204  */
1205 
1207 {
1208  mDualView->masterModel()->executeAction( mAction, mFieldIdx );
1209 }
1210 
1212 {
1213  QgsFeatureIds editedIds;
1214  editedIds << mDualView->masterModel()->rowToId( mFieldIdx.row() );
1215  mDualView->setCurrentEditSelection( editedIds );
1216  mDualView->setView( QgsDualView::AttributeEditor );
1217 }
1218 
1219 /*
1220  * QgsAttributeTableMapLayerAction
1221  */
1222 
1224 {
1225  mDualView->masterModel()->executeMapLayerAction( mAction, mFieldIdx );
1226 }
QgsFeatureRequest::NoGeometry
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
Definition: qgsfeaturerequest.h:107
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:369
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:73
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:721
QgsAttributeTableAction::featureForm
void featureForm()
Definition: qgsdualview.cpp:1211
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:1049
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:516
QgsMapLayerAction
Definition: qgsmaplayeractionregistry.h:34
qgsvectorlayercache.h
QgsApplication::getThemeIcon
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
Definition: qgsapplication.cpp:605
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
The cached features can be indexed by QgsAbstractCacheIndex.
Definition: qgsvectorlayercache.h:45
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:145
QgsExpressionBuilderWidget
Definition: qgsexpressionbuilderwidget.h:42
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:93
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:390
QgsAttributeTableConfig::setSortOrder
void setSortOrder(Qt::SortOrder sortOrder)
Set the sort order.
Definition: qgsattributetableconfig.cpp:238
QgsFeatureRequest::flags
const Flags & flags() const
Definition: qgsfeaturerequest.h:516
qgsmapcanvasutils.h
QgsFeatureRequest::filterRect
const QgsRectangle & filterRect() const
Returns the rectangle from which features will be taken.
Definition: qgsfeaturerequest.h:348
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:646
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:325
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:271
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:266
QgsMapLayerAction::MultipleFeatures
@ MultipleFeatures
Definition: qgsmaplayeractionregistry.h:43
QgsMapCanvas
Definition: qgsmapcanvas.h:83
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:1175
qgsdualview.h
QgsDualView::setFilteredFeatures
Q_DECL_DEPRECATED void setFilteredFeatures(const QgsFeatureIds &filteredFeatures)
Set a list of currently visible features.
Definition: qgsdualview.cpp:1121
QgsAttributeForm::save
bool save()
Save all the values from the editors to the layer.
Definition: qgsattributeform.cpp:721
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:306
QgsSettings
Definition: qgssettings.h:61
QgsAttributeEditorContext::SearchMode
@ SearchMode
Form values are used for searching/filtering the layer.
Definition: qgsattributeeditorcontext.h:53
qgsfeaturelistmodel.h
QgsFeatureListView
Definition: qgsfeaturelistview.h:45
QgsAttributeForm::zoomToFeatures
void zoomToFeatures(const QString &filter)
Emitted when the user chooses to zoom to a filtered set of features.
QgsDualView::toggleSearchMode
void toggleSearchMode(bool enabled)
Toggles whether search mode should be enabled in the form.
Definition: qgsdualview.cpp:659
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:840
QgsRectangle
Definition: qgsrectangle.h:41
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:400
QgsFeatureRequest::disableFilter
QgsFeatureRequest & disableFilter()
Disables filter conditions.
Definition: qgsfeaturerequest.h:459
QgsDualView::cancelProgress
void cancelProgress()
Cancel the progress dialog (if any)
Definition: qgsdualview.cpp:733
QgsFieldConditionalFormatWidget
Definition: qgsfieldconditionalformatwidget.h:35
QgsAttributeTableModel::executeMapLayerAction
void executeMapLayerAction(QgsMapLayerAction *action, const QModelIndex &idx) const
Execute a QgsMapLayerAction.
Definition: qgsattributetablemodel.cpp:846
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:71
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:97
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:1263
QgsAttributeTableConfig
Definition: qgsattributetableconfig.h:36
QgsFeature::id
QgsFeatureId id
Definition: qgsfeature.h:68
QgsFeatureRequest
Definition: qgsfeaturerequest.h:75
QgsDualView::saveEditChanges
bool saveEditChanges()
saveEditChanges
Definition: qgsdualview.cpp:636
QgsAttributeForm::refreshFeature
void refreshFeature()
reload current feature
Definition: qgsattributeform.cpp:1249
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:1206
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:965
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
Is able to generate editor widgets for its QModelIndexes as well. Is mostly referred to as "master mo...
Definition: qgsattributetablemodel.h:49
QgsExpressionBuilderDialog
Definition: qgsexpressionbuilderdialog.h:30
QgsAttributeTableAction
Definition: qgsdualview.h:444
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:1149
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:52
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:1158
QgsAttributeTableConfig::setColumnWidth
void setColumnWidth(int column, int width)
Sets the width of a column.
Definition: qgsattributetableconfig.cpp:213
QgsActionMenu
Definition: qgsactionmenu.h:37
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:110
QgsAttributeTableModel::finished
void finished()
QgsDualView::hideEvent
void hideEvent(QHideEvent *event) override
Definition: qgsdualview.cpp:747
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:1337
QgsFeatureIds
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:34
QgsDualView::setCurrentEditSelection
void setCurrentEditSelection(const QgsFeatureIds &fids)
Set the current edit selection in the AttributeEditor mode.
Definition: qgsdualview.cpp:630
qgsorganizetablecolumnsdialog.h
QgsDualView::ViewMode
ViewMode
The view modes, in which this widget can present information.
Definition: qgsdualview.h:52
QgsScrollArea
Definition: qgsscrollarea.h:41
QgsAction
Definition: qgsaction.h:35
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:1418
QgsAttributeTableFilterModel::setFilterMode
void setFilterMode(FilterMode filterMode)
Set the filter mode the filter will use.
Definition: qgsattributetablefiltermodel.cpp:328
QgsAttributeTableFilterModel
Definition: qgsattributetablefiltermodel.h:35
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:1223
qgseditorwidgetregistry.h
QgsAttributeForm::setMode
void setMode(QgsAttributeEditorContext::Mode mode)
Sets the current mode of the form.
Definition: qgsattributeform.cpp:130
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:1170
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:38
QgsVectorLayer
Definition: qgsvectorlayer.h:385
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:739
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:1138
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:711
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:716
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:1126
QgsGui::shortcutsManager
static QgsShortcutsManager * shortcutsManager()
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.
Definition: qgsgui.cpp:83
QgsFeatureRequest::FilterNone
@ FilterNone
No filter is applied.
Definition: qgsfeaturerequest.h:105
QgsAttributeForm::widgetValueChanged
void widgetValueChanged(const QString &attribute, const QVariant &value, bool attributeChanged)
Notifies about changes of attributes.
QgsFeature
Definition: qgsfeature.h:55
QgsFeatureListModel::setSortByDisplayExpression
void setSortByDisplayExpression(bool sortByDisplayExpression, Qt::SortOrder order=Qt::AscendingOrder)
Sort this model by its display expression.
Definition: qgsfeaturelistmodel.cpp:284
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:44
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:1317
QgsIFeatureSelectionManager
Definition: qgsifeatureselectionmanager.h:31
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:612
QgsAttributeEditorContext::parentContext
const QgsAttributeEditorContext * parentContext() const
Definition: qgsattributeeditorcontext.h:229
QgsAttributeTableMapLayerAction
Definition: qgsdualview.h:476
QgsAttributeTableModel::request
const QgsFeatureRequest & request() const
Gets the the feature request.
Definition: qgsattributetablemodel.cpp:972
QgsExpression
Definition: qgsexpression.h:113
QgsAttributeEditorContext
Definition: qgsattributeeditorcontext.h:40
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:44
QgsExpressionBuilderWidget::expressionText
QString expressionText()
Gets the expression string that has been set in the expression area.
Definition: qgsexpressionbuilderwidget.cpp:607
QgsDualView::setRequest
void setRequest(const QgsFeatureRequest &request)
Set the request.
Definition: qgsdualview.cpp:1133
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:184
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:641
QgsAttributeTableFilterModel::ShowVisible
@ ShowVisible
Show only visible features (depends on the map canvas)
Definition: qgsattributetablefiltermodel.h:48
QgsFeatureId
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25
qgsmessagelog.h
qgsexpressionbuilderdialog.h
QgsField
Definition: qgsfield.h:49
QgsAttributeTableConfig::update
void update(const QgsFields &fields)
Update the configuration with the given fields.
Definition: qgsattributetableconfig.cpp:50