QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsAttributeTableView Class Reference

Provides a table view of features of a QgsVectorLayer. More...

#include <qgsattributetableview.h>

Inheritance diagram for QgsAttributeTableView:
Inheritance graph
[legend]

Public Slots

virtual void _q_selectRow (int row)
 
void repaintRequested ()
 
void repaintRequested (const QModelIndexList &indexes)
 
void selectAll () override
 
virtual void selectRow (int row)
 

Signals

void columnResized (int column, int width)
 Emitted when a column in the view has been resized.
 
Q_DECL_DEPRECATED void finished ()
 
void willShowContextMenu (QMenu *menu, const QModelIndex &atIndex)
 Emitted in order to provide a hook to add additional* menu entries to the context menu.
 

Public Member Functions

 QgsAttributeTableView (QWidget *parent=nullptr)
 Constructor for QgsAttributeTableView.
 
void closeCurrentEditor ()
 Closes the editor delegate for the current item, committing its changes to the model.
 
bool eventFilter (QObject *object, QEvent *event) override
 This event filter is installed on the verticalHeader to intercept mouse press and release events.
 
void scrollToFeature (const QgsFeatureId &fid, int column=-1)
 Scroll to a feature with a given fid.
 
QList< QgsFeatureIdselectedFeaturesIds () const
 Returns the selected features in the attribute table in table sorted order.
 
void setAttributeTableConfig (const QgsAttributeTableConfig &config)
 Set the attribute table config which should be used to control the appearance of the attribute table.
 
void setFeatureSelectionManager (QgsIFeatureSelectionManager *featureSelectionManager)
 setFeatureSelectionManager
 
virtual void setModel (QgsAttributeTableFilterModel *filterModel)
 
- Public Member Functions inherited from QgsTableView
 QgsTableView (QWidget *parent=nullptr)
 Constructor for QgsTableView.
 
void wheelEvent (QWheelEvent *event) override
 

Protected Member Functions

void closeEvent (QCloseEvent *event) override
 Saves geometry to the settings on close.
 
void contextMenuEvent (QContextMenuEvent *event) override
 Is called when the context menu will be shown.
 
void keyPressEvent (QKeyEvent *event) override
 Called for key press events Disables selection change by only pressing an arrow key.
 
void mouseMoveEvent (QMouseEvent *event) override
 Called for mouse move events on a table cell.
 
void mousePressEvent (QMouseEvent *event) override
 Called for mouse press events on a table cell.
 
void mouseReleaseEvent (QMouseEvent *event) override
 Called for mouse release events on a table cell.
 

Detailed Description

Provides a table view of features of a QgsVectorLayer.

This can either be used as a standalone widget. QgsBrowser features a reference implementation. Or this can be used within the QgsDualView stacked widget.

Definition at line 48 of file qgsattributetableview.h.

Constructor & Destructor Documentation

◆ QgsAttributeTableView()

QgsAttributeTableView::QgsAttributeTableView ( QWidget *  parent = nullptr)

Constructor for QgsAttributeTableView.

Definition at line 38 of file qgsattributetableview.cpp.

Member Function Documentation

◆ _q_selectRow

void QgsAttributeTableView::_q_selectRow ( int  row)
virtualslot

Definition at line 429 of file qgsattributetableview.cpp.

◆ closeCurrentEditor()

void QgsAttributeTableView::closeCurrentEditor ( )

Closes the editor delegate for the current item, committing its changes to the model.

Since
QGIS 3.30

Definition at line 557 of file qgsattributetableview.cpp.

◆ closeEvent()

void QgsAttributeTableView::closeEvent ( QCloseEvent *  event)
overrideprotected

Saves geometry to the settings on close.

Parameters
eventnot used

Definition at line 310 of file qgsattributetableview.cpp.

◆ columnResized

void QgsAttributeTableView::columnResized ( int  column,
int  width 
)
signal

Emitted when a column in the view has been resized.

Parameters
columncolumn index (starts at 0)
widthnew width in pixel

◆ contextMenuEvent()

void QgsAttributeTableView::contextMenuEvent ( QContextMenuEvent *  event)
overrideprotected

Is called when the context menu will be shown.

Emits a willShowContextMenu() signal, so the menu can be populated by other parts of the application.

Parameters
eventThe associated event object.

Definition at line 394 of file qgsattributetableview.cpp.

◆ eventFilter()

bool QgsAttributeTableView::eventFilter ( QObject *  object,
QEvent *  event 
)
override

This event filter is installed on the verticalHeader to intercept mouse press and release events.

These are used to disable / enable live synchronisation with the map canvas selection which can be slow due to recurring canvas repaints.

Parameters
objectThe object which is the target of the event.
eventThe intercepted event
Returns
Returns always false, so the event gets processed

Definition at line 69 of file qgsattributetableview.cpp.

◆ finished

Q_DECL_DEPRECATED void QgsAttributeTableView::finished ( )
signal
Deprecated:
QGIS 3.40. No longer used.

◆ keyPressEvent()

void QgsAttributeTableView::keyPressEvent ( QKeyEvent *  event)
overrideprotected

Called for key press events Disables selection change by only pressing an arrow key.

Parameters
eventThe mouse event

Definition at line 351 of file qgsattributetableview.cpp.

◆ mouseMoveEvent()

void QgsAttributeTableView::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

Called for mouse move events on a table cell.

Disables selection change for these events.

Parameters
eventThe mouse event

Definition at line 344 of file qgsattributetableview.cpp.

◆ mousePressEvent()

void QgsAttributeTableView::mousePressEvent ( QMouseEvent *  event)
overrideprotected

Called for mouse press events on a table cell.

Disables selection change for these events.

Parameters
eventThe mouse event

Definition at line 317 of file qgsattributetableview.cpp.

◆ mouseReleaseEvent()

void QgsAttributeTableView::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

Called for mouse release events on a table cell.

Disables selection change for these events.

Parameters
eventThe mouse event

Definition at line 324 of file qgsattributetableview.cpp.

◆ repaintRequested [1/2]

void QgsAttributeTableView::repaintRequested ( )
slot

Definition at line 382 of file qgsattributetableview.cpp.

◆ repaintRequested [2/2]

void QgsAttributeTableView::repaintRequested ( const QModelIndexList &  indexes)
slot

Definition at line 373 of file qgsattributetableview.cpp.

◆ scrollToFeature()

void QgsAttributeTableView::scrollToFeature ( const QgsFeatureId fid,
int  column = -1 
)

Scroll to a feature with a given fid.

Optionally a column can be specified, which will also bring that column into view.

Since
QGIS 3.16

Definition at line 540 of file qgsattributetableview.cpp.

◆ selectAll

void QgsAttributeTableView::selectAll ( )
overrideslot

Definition at line 387 of file qgsattributetableview.cpp.

◆ selectedFeaturesIds()

QList< QgsFeatureId > QgsAttributeTableView::selectedFeaturesIds ( ) const

Returns the selected features in the attribute table in table sorted order.

Returns
The selected features in the attribute table in the order sorted by the table.
Since
QGIS 3.4

Definition at line 136 of file qgsattributetableview.cpp.

◆ selectRow

void QgsAttributeTableView::selectRow ( int  row)
virtualslot

Definition at line 424 of file qgsattributetableview.cpp.

◆ setAttributeTableConfig()

void QgsAttributeTableView::setAttributeTableConfig ( const QgsAttributeTableConfig config)

Set the attribute table config which should be used to control the appearance of the attribute table.

Definition at line 90 of file qgsattributetableview.cpp.

◆ setFeatureSelectionManager()

void QgsAttributeTableView::setFeatureSelectionManager ( QgsIFeatureSelectionManager featureSelectionManager)

setFeatureSelectionManager

Parameters
featureSelectionManager

Definition at line 195 of file qgsattributetableview.cpp.

◆ setModel()

void QgsAttributeTableView::setModel ( QgsAttributeTableFilterModel filterModel)
virtual

Definition at line 159 of file qgsattributetableview.cpp.

◆ willShowContextMenu

void QgsAttributeTableView::willShowContextMenu ( QMenu *  menu,
const QModelIndex &  atIndex 
)
signal

Emitted in order to provide a hook to add additional* menu entries to the context menu.

Parameters
menuIf additional QMenuItems are added, they will show up in the context menu.
atIndexThe QModelIndex, to which the context menu belongs. Relative to the source model. In most cases, this will be a QgsAttributeTableFilterModel

The documentation for this class was generated from the following files: