QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | 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]
Collaboration diagram for QgsAttributeTableView:
Collaboration graph
[legend]

Public Slots

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

Signals

void willShowContextMenu (QMenu *menu, QModelIndex atIndex)
 Is emitted, in order to provide a hook to add aditional menu entries to the context menu. More...
 
void finished ()
 

Public Member Functions

 QgsAttributeTableView (QWidget *parent=0)
 
virtual ~QgsAttributeTableView ()
 
virtual void setModel (QgsAttributeTableFilterModel *filterModel)
 
void setFeatureSelectionManager (QgsIFeatureSelectionManager *featureSelectionManager)
 setFeatureSelectionManager More...
 
virtual bool eventFilter (QObject *object, QEvent *event)
 This event filter is installed on the verticalHeader to intercept mouse press and release events. More...
 

Protected Member Functions

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

Private Member Functions

void selectRow (int row, bool anchor)
 

Private Attributes

QgsAttributeTableModelmMasterModel
 
QgsAttributeTableFilterModelmFilterModel
 
QgsFeatureSelectionModelmFeatureSelectionModel
 
QgsIFeatureSelectionManagermFeatureSelectionManager
 
QgsAttributeTableDelegatemTableDelegate
 
QAbstractItemModel * mModel
 
QMenu * mActionPopup
 
QgsVectorLayerCachemLayerCache
 
int mRowSectionAnchor
 
QItemSelectionModel::SelectionFlag mCtrlDragSelectionFlag
 

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 44 of file qgsattributetableview.h.

Constructor & Destructor Documentation

QgsAttributeTableView::QgsAttributeTableView ( QWidget *  parent = 0)

Definition at line 33 of file qgsattributetableview.cpp.

References _q_selectRow(), mTableDelegate, and selectRow().

QgsAttributeTableView::~QgsAttributeTableView ( )
virtual

Definition at line 60 of file qgsattributetableview.cpp.

References mActionPopup.

Member Function Documentation

void QgsAttributeTableView::_q_selectRow ( int  row)
virtualslot

Definition at line 259 of file qgsattributetableview.cpp.

References selectRow().

Referenced by QgsAttributeTableView().

void QgsAttributeTableView::closeEvent ( QCloseEvent *  event)
protected

Saves geometry to the settings on close.

Parameters
eventnot used

Definition at line 153 of file qgsattributetableview.cpp.

void QgsAttributeTableView::contextMenuEvent ( QContextMenuEvent *  event)
protected

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 223 of file qgsattributetableview.cpp.

References QgsAttributeTableFilterModel::layer(), mActionPopup, mFilterModel, selectAll(), tr, and willShowContextMenu().

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

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. Updating the

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 91 of file qgsattributetableview.cpp.

References QgsFeatureSelectionModel::enableSync(), and mFeatureSelectionModel.

void QgsAttributeTableView::finished ( )
signal
void QgsAttributeTableView::keyPressEvent ( QKeyEvent *  event)
protected

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

Parameters
eventThe mouse event

Definition at line 181 of file qgsattributetableview.cpp.

void QgsAttributeTableView::mouseMoveEvent ( QMouseEvent *  event)
protected

Called for mouse move events on a table cell.

Disables selection change for these events.

Parameters
eventThe mouse event

Definition at line 174 of file qgsattributetableview.cpp.

void QgsAttributeTableView::mousePressEvent ( QMouseEvent *  event)
protected

Called for mouse press events on a table cell.

Disables selection change for these events.

Parameters
eventThe mouse event

Definition at line 160 of file qgsattributetableview.cpp.

void QgsAttributeTableView::mouseReleaseEvent ( QMouseEvent *  event)
protected

Called for mouse release events on a table cell.

Disables selection change for these events.

Parameters
eventThe mouse event

Definition at line 167 of file qgsattributetableview.cpp.

void QgsAttributeTableView::repaintRequested ( QModelIndexList  indexes)
slot

Definition at line 203 of file qgsattributetableview.cpp.

References index.

void QgsAttributeTableView::repaintRequested ( )
slot

Definition at line 211 of file qgsattributetableview.cpp.

Referenced by setModel().

void QgsAttributeTableView::selectAll ( )
virtualslot
void QgsAttributeTableView::selectRow ( int  row)
virtualslot

Definition at line 254 of file qgsattributetableview.cpp.

Referenced by _q_selectRow(), and QgsAttributeTableView().

void QgsAttributeTableView::selectRow ( int  row,
bool  anchor 
)
private
void QgsAttributeTableView::setFeatureSelectionManager ( QgsIFeatureSelectionManager featureSelectionManager)

setFeatureSelectionManager

Parameters
featureSelectionManagerWe will take ownership

Definition at line 142 of file qgsattributetableview.cpp.

References mFeatureSelectionManager, mFeatureSelectionModel, and QgsFeatureSelectionModel::setFeatureSelectionManager().

void QgsAttributeTableView::setModel ( QgsAttributeTableFilterModel filterModel)
virtual
void QgsAttributeTableView::willShowContextMenu ( QMenu *  menu,
QModelIndex  atIndex 
)
signal

Is emitted, in order to provide a hook to add aditional 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

Referenced by contextMenuEvent().

Member Data Documentation

QMenu* QgsAttributeTableView::mActionPopup
private

Definition at line 148 of file qgsattributetableview.h.

Referenced by contextMenuEvent(), and ~QgsAttributeTableView().

QItemSelectionModel::SelectionFlag QgsAttributeTableView::mCtrlDragSelectionFlag
private

Definition at line 151 of file qgsattributetableview.h.

Referenced by selectRow().

QgsIFeatureSelectionManager* QgsAttributeTableView::mFeatureSelectionManager
private

Definition at line 145 of file qgsattributetableview.h.

Referenced by setFeatureSelectionManager(), and setModel().

QgsFeatureSelectionModel* QgsAttributeTableView::mFeatureSelectionModel
private
QgsAttributeTableFilterModel* QgsAttributeTableView::mFilterModel
private

Definition at line 143 of file qgsattributetableview.h.

Referenced by contextMenuEvent(), selectAll(), and setModel().

QgsVectorLayerCache* QgsAttributeTableView::mLayerCache
private

Definition at line 149 of file qgsattributetableview.h.

QgsAttributeTableModel* QgsAttributeTableView::mMasterModel
private

Definition at line 142 of file qgsattributetableview.h.

QAbstractItemModel* QgsAttributeTableView::mModel
private

Definition at line 147 of file qgsattributetableview.h.

int QgsAttributeTableView::mRowSectionAnchor
private

Definition at line 150 of file qgsattributetableview.h.

Referenced by selectRow().

QgsAttributeTableDelegate* QgsAttributeTableView::mTableDelegate
private

Definition at line 146 of file qgsattributetableview.h.

Referenced by QgsAttributeTableView(), and setModel().


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