QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsattributetableview.cpp
Go to the documentation of this file.
1/***************************************************************************
2 QgsAttributeTableView.cpp
3 --------------------------------------
4 Date : Feb 2009
5 Copyright : (C) 2009 Vita Cizek
6 Email : weetya (at) gmail.com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17
18#include "qgsactionmanager.h"
22#include "qgsfeatureiterator.h"
24#include "qgsgui.h"
25#include "qgsmaplayeraction.h"
27#include "qgsstringutils.h"
28#include "qgsvectorlayer.h"
29#include "qgsvectorlayercache.h"
31
32#include <QDesktopServices>
33#include <QHBoxLayout>
34#include <QHeaderView>
35#include <QKeyEvent>
36#include <QMenu>
37#include <QToolButton>
38
39#include "moc_qgsattributetableview.cpp"
40
42 : QgsTableView( parent )
43{
44 const QgsSettings settings;
45 restoreGeometry( settings.value( QStringLiteral( "BetterAttributeTable/geometry" ) ).toByteArray() );
46
47 //verticalHeader()->setDefaultSectionSize( 20 );
48 horizontalHeader()->setHighlightSections( false );
49
50 // We need mouse move events to create the action button on hover
51 mTableDelegate = new QgsAttributeTableDelegate( this );
52 setItemDelegate( mTableDelegate );
53
54 setEditTriggers( QAbstractItemView::AllEditTriggers );
55
56 setSelectionBehavior( QAbstractItemView::SelectRows );
57 setSelectionMode( QAbstractItemView::ExtendedSelection );
58 setSortingEnabled( true ); // At this point no data is in the model yet, so actually nothing is sorted.
59 horizontalHeader()->setSortIndicatorShown( false ); // So hide the indicator to avoid confusion.
60
61 setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
62
63 verticalHeader()->viewport()->installEventFilter( this );
64
65 connect( verticalHeader(), &QHeaderView::sectionPressed, this, [this]( int row ) { selectRow( row, true ); } );
66 connect( verticalHeader(), &QHeaderView::sectionEntered, this, &QgsAttributeTableView::_q_selectRow );
67 connect( horizontalHeader(), &QHeaderView::sectionResized, this, &QgsAttributeTableView::columnSizeChanged );
68 connect( horizontalHeader(), &QHeaderView::sortIndicatorChanged, this, &QgsAttributeTableView::showHorizontalSortIndicator );
69 connect( QgsGui::mapLayerActionRegistry(), &QgsMapLayerActionRegistry::changed, this, &QgsAttributeTableView::recreateActionWidgets );
70}
71
72bool QgsAttributeTableView::eventFilter( QObject *object, QEvent *event )
73{
74 if ( object == verticalHeader()->viewport() )
75 {
76 switch ( event->type() )
77 {
78 case QEvent::MouseButtonPress:
79 mFeatureSelectionModel->enableSync( false );
80 break;
81
82 case QEvent::MouseButtonRelease:
83 mFeatureSelectionModel->enableSync( true );
84 break;
85
86 case QEvent::MouseButtonDblClick:
87 {
88 QMouseEvent *mouseEvent = static_cast<QMouseEvent *>( event );
89 if ( mouseEvent->button() == Qt::LeftButton )
90 {
91 const int row = verticalHeader()->logicalIndexAt( mouseEvent->pos() );
92 if ( row >= 0 && mFilterModel )
93 {
94 const QModelIndex index = mFilterModel->index( row, 0 );
95 if ( index.isValid() )
96 {
97 const QgsFeatureId fid = mFilterModel->rowToId( index );
98 emit rowHeaderDoubleClicked( fid );
99 }
100 }
101 }
102 break;
103 }
104
105 default:
106 break;
107 }
108 }
109 return QTableView::eventFilter( object, event );
110}
111
113{
114 int i = 0;
115 const auto constColumns = config.columns();
116 QMap<QString, int> columns;
117 for ( const QgsAttributeTableConfig::ColumnConfig &columnConfig : constColumns )
118 {
119 if ( columnConfig.hidden )
120 continue;
121
122 if ( columnConfig.width >= 0 )
123 {
124 setColumnWidth( i, columnConfig.width );
125 }
126 else
127 {
128 setColumnWidth( i, horizontalHeader()->defaultSectionSize() );
129 }
130 columns.insert( columnConfig.name, i );
131 i++;
132 }
133 mConfig = config;
134 if ( config.sortExpression().isEmpty() )
135 {
136 horizontalHeader()->setSortIndicatorShown( false );
137 }
138 else
139 {
140 if ( mSortExpression != config.sortExpression() )
141 {
142 const QgsExpression sortExp { config.sortExpression() };
143 if ( sortExp.isField() )
144 {
145 const QStringList refCols { sortExp.referencedColumns().values() };
146 horizontalHeader()->setSortIndicatorShown( true );
147 horizontalHeader()->setSortIndicator( columns.value( refCols.constFirst() ), config.sortOrder() );
148 }
149 else
150 {
151 horizontalHeader()->setSortIndicatorShown( false );
152 }
153 }
154 }
155 mSortExpression = config.sortExpression();
156}
157
159{
160 // In order to get the ids in the right sorted order based on the view we have to get the feature ids first
161 // from the selection manager which is in the order the user selected them when clicking
162 // then get the model index, sort that, and finally return the new sorted features ids.
163 const QgsFeatureIds featureIds = mFeatureSelectionManager->selectedFeatureIds();
164 QModelIndexList indexList;
165 for ( const QgsFeatureId &id : featureIds )
166 {
167 const QModelIndex index = mFilterModel->fidToIndex( id );
168 indexList << index;
169 }
170
171 std::sort( indexList.begin(), indexList.end() );
172 QList<QgsFeatureId> ids;
173 for ( const QModelIndex &index : indexList )
174 {
175 const QgsFeatureId id = mFilterModel->data( index, static_cast<int>( QgsAttributeTableModel::CustomRole::FeatureId ) ).toLongLong();
176 ids.append( id );
177 }
178 return ids;
179}
180
182{
183 mFilterModel = filterModel;
184 QTableView::setModel( mFilterModel );
185
186 if ( mFilterModel )
187 {
188 connect( mFilterModel, &QObject::destroyed, this, &QgsAttributeTableView::modelDeleted );
189 connect( mTableDelegate, &QgsAttributeTableDelegate::actionColumnItemPainted, this, &QgsAttributeTableView::onActionColumnItemPainted );
190 }
191
192 delete mFeatureSelectionModel;
193 mFeatureSelectionModel = nullptr;
194
195 if ( mFilterModel )
196 {
197 if ( !mFeatureSelectionManager )
198 {
199 mOwnedFeatureSelectionManager = new QgsVectorLayerSelectionManager( mFilterModel->layer(), this );
200 mFeatureSelectionManager = mOwnedFeatureSelectionManager;
201 }
202
203 mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, mFeatureSelectionManager, mFilterModel );
204 setSelectionModel( mFeatureSelectionModel );
205 mTableDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
206 connect( mFeatureSelectionModel, static_cast<void ( QgsFeatureSelectionModel::* )( const QModelIndexList &indexes )>( &QgsFeatureSelectionModel::requestRepaint ), this, static_cast<void ( QgsAttributeTableView::* )( const QModelIndexList &indexes )>( &QgsAttributeTableView::repaintRequested ) );
207 connect( mFeatureSelectionModel, static_cast<void ( QgsFeatureSelectionModel::* )()>( &QgsFeatureSelectionModel::requestRepaint ), this, static_cast<void ( QgsAttributeTableView::* )()>( &QgsAttributeTableView::repaintRequested ) );
208
209 connect( mFilterModel->layer(), &QgsVectorLayer::editingStarted, this, &QgsAttributeTableView::recreateActionWidgets );
210 connect( mFilterModel->layer(), &QgsVectorLayer::editingStopped, this, &QgsAttributeTableView::recreateActionWidgets );
211 connect( mFilterModel->layer(), &QgsVectorLayer::readOnlyChanged, this, &QgsAttributeTableView::recreateActionWidgets );
212 }
213}
214
216{
217 mFeatureSelectionManager = featureSelectionManager;
218
219 if ( mFeatureSelectionModel )
220 mFeatureSelectionModel->setFeatureSelectionManager( mFeatureSelectionManager );
221
222 // only delete the owner selection manager and not one created from outside
223 if ( mOwnedFeatureSelectionManager )
224 {
225 mOwnedFeatureSelectionManager->deleteLater();
226 mOwnedFeatureSelectionManager = nullptr;
227 }
228}
229
230QWidget *QgsAttributeTableView::createActionWidget( QgsFeatureId fid )
231{
232 const QgsAttributeTableConfig attributeTableConfig = mConfig;
233
234 QToolButton *toolButton = nullptr;
235 QWidget *container = nullptr;
236
237 if ( attributeTableConfig.actionWidgetStyle() == QgsAttributeTableConfig::DropDown )
238 {
239 toolButton = new QToolButton();
240 toolButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
241 toolButton->setPopupMode( QToolButton::MenuButtonPopup );
242 container = toolButton;
243 }
244 else
245 {
246 container = new QWidget();
247 container->setLayout( new QHBoxLayout() );
248 container->layout()->setContentsMargins( 0, 0, 0, 0 );
249 }
250
251 QList<QAction *> actionList;
252 QAction *defaultAction = nullptr;
253
254 // first add user created layer actions
255 const QList<QgsAction> actions = mFilterModel->layer()->actions()->actions( QStringLiteral( "Feature" ) );
256 const auto constActions = actions;
257 for ( const QgsAction &action : constActions )
258 {
259 if ( !mFilterModel->layer()->isEditable() && action.isEnabledOnlyWhenEditable() )
260 continue;
261
262 const QString actionTitle = !action.shortTitle().isEmpty() ? action.shortTitle() : action.icon().isNull() ? action.name()
263 : QString();
264 QAction *act = new QAction( action.icon(), actionTitle, container );
265 act->setToolTip( action.name() );
266 act->setData( "user_action" );
267 act->setProperty( "fid", fid );
268 act->setProperty( "action_id", action.id() );
269 connect( act, &QAction::triggered, this, &QgsAttributeTableView::actionTriggered );
270 actionList << act;
271
272 if ( mFilterModel->layer()->actions()->defaultAction( QStringLiteral( "Feature" ) ).id() == action.id() )
273 defaultAction = act;
274 }
275
276 QgsMapLayerActionContext context;
277 const QList<QgsMapLayerAction *> mapLayerActions = QgsGui::mapLayerActionRegistry()->mapLayerActions( mFilterModel->layer(), Qgis::MapLayerActionTarget::SingleFeature, context );
278 // next add any registered actions for this layer
279 for ( QgsMapLayerAction *mapLayerAction : mapLayerActions )
280 {
281 QAction *action = new QAction( mapLayerAction->icon(), mapLayerAction->text(), container );
282 action->setData( "map_layer_action" );
283 action->setToolTip( mapLayerAction->text() );
284 action->setProperty( "fid", fid );
285 action->setProperty( "action", QVariant::fromValue( qobject_cast<QObject *>( mapLayerAction ) ) );
286 connect( action, &QAction::triggered, this, &QgsAttributeTableView::actionTriggered );
287 actionList << action;
288
289 if ( !defaultAction && QgsGui::mapLayerActionRegistry()->defaultActionForLayer( mFilterModel->layer() ) == mapLayerAction )
290 defaultAction = action;
291 }
292
293 if ( !defaultAction && !actionList.isEmpty() )
294 defaultAction = actionList.at( 0 );
295
296 const auto constActionList = actionList;
297 for ( QAction *act : constActionList )
298 {
299 if ( attributeTableConfig.actionWidgetStyle() == QgsAttributeTableConfig::DropDown )
300 {
301 toolButton->addAction( act );
302
303 if ( act == defaultAction )
304 toolButton->setDefaultAction( act );
305
306 container = toolButton;
307 }
308 else
309 {
310 QToolButton *btn = new QToolButton;
311 btn->setDefaultAction( act );
312 container->layout()->addWidget( btn );
313 }
314 }
315
316 if ( attributeTableConfig.actionWidgetStyle() == QgsAttributeTableConfig::ButtonList )
317 {
318 static_cast<QHBoxLayout *>( container->layout() )->addStretch();
319 }
320
321 // TODO: Rethink default actions
322#if 0
323 if ( toolButton && !toolButton->actions().isEmpty() && actions->defaultAction() == -1 )
324 toolButton->setDefaultAction( toolButton->actions().at( 0 ) );
325#endif
326
327 return container;
328}
329
331{
332 Q_UNUSED( e )
333 QgsSettings settings;
334 settings.setValue( QStringLiteral( "BetterAttributeTable/geometry" ), QVariant( saveGeometry() ) );
335}
336
338{
339 setSelectionMode( QAbstractItemView::NoSelection );
340 QTableView::mousePressEvent( event );
341 setSelectionMode( QAbstractItemView::ExtendedSelection );
342}
343
345{
346 setSelectionMode( QAbstractItemView::NoSelection );
347 QTableView::mouseReleaseEvent( event );
348 setSelectionMode( QAbstractItemView::ExtendedSelection );
349 if ( event->modifiers() == Qt::ControlModifier )
350 {
351 const QModelIndex index = indexAt( event->pos() );
352 const QVariant data = model()->data( index, Qt::DisplayRole );
353 if ( data.userType() == QMetaType::Type::QString )
354 {
355 const QString textVal = data.toString();
356 if ( QgsStringUtils::isUrl( textVal ) )
357 {
358 QDesktopServices::openUrl( QUrl( textVal ) );
359 }
360 }
361 }
362}
363
365{
366 setSelectionMode( QAbstractItemView::NoSelection );
367 QTableView::mouseMoveEvent( event );
368 setSelectionMode( QAbstractItemView::ExtendedSelection );
369}
370
372{
373 switch ( event->key() )
374 {
375 // Default Qt behavior would be to change the selection.
376 // We don't make it that easy for the user to trash his selection.
377 case Qt::Key_Up:
378 case Qt::Key_Down:
379 case Qt::Key_Left:
380 case Qt::Key_Right:
381 setSelectionMode( QAbstractItemView::NoSelection );
382 QTableView::keyPressEvent( event );
383 setSelectionMode( QAbstractItemView::ExtendedSelection );
384 break;
385
386 default:
387 QTableView::keyPressEvent( event );
388 break;
389 }
390}
391
392void QgsAttributeTableView::repaintRequested( const QModelIndexList &indexes )
393{
394 const auto constIndexes = indexes;
395 for ( const QModelIndex &index : constIndexes )
396 {
397 update( index );
398 }
399}
400
402{
403 setDirtyRegion( viewport()->rect() );
404}
405
407{
408 QItemSelection selection;
409 selection.append( QItemSelectionRange( mFilterModel->index( 0, 0 ), mFilterModel->index( mFilterModel->rowCount() - 1, 0 ) ) );
410 mFeatureSelectionModel->selectFeatures( selection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows );
411}
412
413void QgsAttributeTableView::contextMenuEvent( QContextMenuEvent *event )
414{
415 delete mActionPopup;
416 mActionPopup = nullptr;
417
418 const QModelIndex idx = mFilterModel->mapToMaster( indexAt( event->pos() ) );
419 if ( !idx.isValid() )
420 {
421 return;
422 }
423
424 QgsVectorLayer *vlayer = mFilterModel->layer();
425 if ( !vlayer )
426 return;
427
428 mActionPopup = new QMenu( this );
429
430 QAction *selectAllAction = mActionPopup->addAction( tr( "Select All" ) );
431 selectAllAction->setShortcut( QKeySequence::SelectAll );
432 connect( selectAllAction, &QAction::triggered, this, &QgsAttributeTableView::selectAll );
433
434 // let some other parts of the application add some actions
435 emit willShowContextMenu( mActionPopup, idx );
436
437 if ( !mActionPopup->actions().isEmpty() )
438 {
439 mActionPopup->popup( event->globalPos() );
440 }
441}
442
444{
445 selectRow( row, true );
446}
447
449{
450 selectRow( row, false );
451}
452
453void QgsAttributeTableView::modelDeleted()
454{
455 mFilterModel = nullptr;
456 mFeatureSelectionManager = nullptr;
457 mFeatureSelectionModel = nullptr;
458}
459
460void QgsAttributeTableView::selectRow( int row, bool anchor )
461{
462 if ( selectionBehavior() == QTableView::SelectColumns
463 || ( selectionMode() == QTableView::SingleSelection && selectionBehavior() == QTableView::SelectItems ) )
464 return;
465
466 if ( row >= 0 && row < model()->rowCount() )
467 {
468 const int column = horizontalHeader()->logicalIndexAt( isRightToLeft() ? viewport()->width() : 0 );
469 const QModelIndex index = model()->index( row, column );
470 QItemSelectionModel::SelectionFlags command = selectionCommand( index );
471 selectionModel()->setCurrentIndex( index, QItemSelectionModel::NoUpdate );
472 if ( ( anchor && !( command & QItemSelectionModel::Current ) )
473 || ( selectionMode() == QTableView::SingleSelection ) )
474 mRowSectionAnchor = row;
475
476 if ( selectionMode() != QTableView::SingleSelection
477 && command.testFlag( QItemSelectionModel::Toggle ) )
478 {
479 if ( anchor )
480 mCtrlDragSelectionFlag = mFeatureSelectionModel->isSelected( index )
481 ? QItemSelectionModel::Deselect
482 : QItemSelectionModel::Select;
483 command &= ~QItemSelectionModel::Toggle;
484 command |= mCtrlDragSelectionFlag;
485 if ( !anchor )
486 command |= QItemSelectionModel::Current;
487 }
488
489 const QModelIndex tl = model()->index( std::min( mRowSectionAnchor, row ), 0 );
490 const QModelIndex br = model()->index( std::max( mRowSectionAnchor, row ), model()->columnCount() - 1 );
491 if ( verticalHeader()->sectionsMoved() && tl.row() != br.row() )
492 setSelection( visualRect( tl ) | visualRect( br ), command );
493 else
494 mFeatureSelectionModel->selectFeatures( QItemSelection( tl, br ), command );
495 }
496}
497
498void QgsAttributeTableView::showHorizontalSortIndicator()
499{
500 horizontalHeader()->setSortIndicatorShown( true );
501}
502
503void QgsAttributeTableView::actionTriggered()
504{
505 QAction *action = qobject_cast<QAction *>( sender() );
506 const QgsFeatureId fid = action->property( "fid" ).toLongLong();
507
508 QgsFeature f;
509 mFilterModel->layerCache()->getFeatures( QgsFeatureRequest( fid ) ).nextFeature( f );
510
511 if ( action->data().toString() == QLatin1String( "user_action" ) )
512 {
513 mFilterModel->layer()->actions()->doAction( action->property( "action_id" ).toUuid(), f );
514 }
515 else if ( action->data().toString() == QLatin1String( "map_layer_action" ) )
516 {
517 QObject *object = action->property( "action" ).value<QObject *>();
518 QgsMapLayerAction *layerAction = qobject_cast<QgsMapLayerAction *>( object );
519 if ( layerAction )
520 {
521 QgsMapLayerActionContext context;
523 layerAction->triggerForFeature( mFilterModel->layer(), f );
525 layerAction->triggerForFeature( mFilterModel->layer(), f, context );
526 }
527 }
528}
529
530void QgsAttributeTableView::columnSizeChanged( int index, int oldWidth, int newWidth )
531{
532 Q_UNUSED( oldWidth )
533 emit columnResized( index, newWidth );
534}
535
536void QgsAttributeTableView::onActionColumnItemPainted( const QModelIndex &index )
537{
538 if ( !indexWidget( index ) )
539 {
540 QWidget *widget = createActionWidget( mFilterModel->data( index, static_cast<int>( QgsAttributeTableModel::CustomRole::FeatureId ) ).toLongLong() );
541 mActionWidgets.insert( index, widget );
542 setIndexWidget( index, widget );
543 }
544}
545
546void QgsAttributeTableView::recreateActionWidgets()
547{
548 QMap<QModelIndex, QWidget *>::const_iterator it = mActionWidgets.constBegin();
549 for ( ; it != mActionWidgets.constEnd(); ++it )
550 {
551 // ownership of widget was transferred by initial call to setIndexWidget - clearing
552 // the index widget will delete the old widget safely
553 // they should then be recreated by onActionColumnItemPainted
554 setIndexWidget( it.key(), nullptr );
555 }
556 mActionWidgets.clear();
557}
558
560{
561 const QModelIndex index = mFilterModel->fidToIndex( fid );
562
563 if ( !index.isValid() )
564 return;
565
566 scrollTo( index );
567
568 const QModelIndex selectionIndex = index.sibling( index.row(), col );
569
570 if ( !selectionIndex.isValid() )
571 return;
572
573 selectionModel()->setCurrentIndex( index, QItemSelectionModel::SelectCurrent );
574}
575
577{
578 QWidget *editor = indexWidget( currentIndex() );
579 commitData( editor );
580 closeEditor( editor, QAbstractItemDelegate::NoHint );
581}
@ SingleFeature
Action targets a single feature from a layer.
Definition qgis.h:4627
A container for configuration of the attribute table.
Qt::SortOrder sortOrder() const
Gets the sort order.
QVector< QgsAttributeTableConfig::ColumnConfig > columns() const
Gets the list with all columns and their configuration.
@ DropDown
A tool button with a drop-down to select the current action.
ActionWidgetStyle actionWidgetStyle() const
Gets the style of the action widget.
QString sortExpression() const
Gets the expression used for sorting.
A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate).
void actionColumnItemPainted(const QModelIndex &index) const
Emitted when an action column item is painted.
A proxy model for filtering an attribute table model.
@ FeatureId
Get the feature id of the feature in this row.
void willShowContextMenu(QMenu *menu, const QModelIndex &atIndex)
Emitted in order to provide a hook to add additional* menu entries to the context menu.
QList< QgsFeatureId > selectedFeaturesIds() const
Returns the selected features in the attribute table in table sorted order.
void setFeatureSelectionManager(QgsIFeatureSelectionManager *featureSelectionManager)
setFeatureSelectionManager
void mouseMoveEvent(QMouseEvent *event) override
Called for mouse move events on a table cell.
virtual void selectRow(int row)
QgsAttributeTableView(QWidget *parent=nullptr)
Constructor for QgsAttributeTableView.
void rowHeaderDoubleClicked(QgsFeatureId fid)
Emitted when a row header is double-clicked.
void scrollToFeature(const QgsFeatureId &fid, int column=-1)
Scroll to a feature with a given fid.
void mouseReleaseEvent(QMouseEvent *event) override
Called for mouse release events on a table cell.
void contextMenuEvent(QContextMenuEvent *event) override
Is called when the context menu will be shown.
virtual void _q_selectRow(int row)
void closeEvent(QCloseEvent *event) override
Saves geometry to the settings on close.
void mousePressEvent(QMouseEvent *event) override
Called for mouse press events on a table cell.
void closeCurrentEditor()
Closes the editor delegate for the current item, committing its changes to the model.
void keyPressEvent(QKeyEvent *event) override
Called for key press events Disables selection change by only pressing an arrow key.
void setAttributeTableConfig(const QgsAttributeTableConfig &config)
Set the attribute table config which should be used to control the appearance of the attribute table.
void columnResized(int column, int width)
Emitted when a column in the view has been resized.
void repaintRequested(const QModelIndexList &indexes)
bool eventFilter(QObject *object, QEvent *event) override
This event filter is installed on the verticalHeader to intercept mouse press and release events.
virtual void setModel(QgsAttributeTableFilterModel *filterModel)
Handles parsing and evaluation of expressions (formerly called "search strings").
bool isField() const
Checks whether an expression consists only of a single field reference.
QSet< QString > referencedColumns() const
Gets list of columns referenced by the expression.
Item selection model for selecting features.
void requestRepaint(const QModelIndexList &indexes)
Request a repaint of a list of model indexes.
static QgsMapLayerActionRegistry * mapLayerActionRegistry()
Returns the global map layer action registry, used for registering map layer actions.
Definition qgsgui.cpp:146
Is an interface class to abstract feature selection handling.
void changed()
Triggered when an action is added or removed from the registry.
QList< QgsMapLayerAction * > mapLayerActions(QgsMapLayer *layer, Qgis::MapLayerActionTargets targets=Qgis::MapLayerActionTarget::AllActions, const QgsMapLayerActionContext &context=QgsMapLayerActionContext())
Returns the map layer actions which can run on the specified layer.
void editingStopped()
Emitted when edited changes have been successfully written to the data provider.
void editingStarted()
Emitted when editing on this layer has started.
Stores settings for use within QGIS.
Definition qgssettings.h:65
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
static bool isUrl(const QString &string)
Returns whether the string is a URL (http,https,ftp,file).
QgsTableView(QWidget *parent=nullptr)
Constructor for QgsTableView.
Represents a vector layer which manages a vector based dataset.
void readOnlyChanged()
Emitted when the read only state of this layer is changed.
#define Q_NOWARN_DEPRECATED_POP
Definition qgis.h:7170
#define Q_NOWARN_DEPRECATED_PUSH
Definition qgis.h:7169
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Defines the configuration of a column in the attribute table.