QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
QgsAttributeTableDelegate Class Reference

A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate). More...

#include <qgsattributetabledelegate.h>

Inheritance diagram for QgsAttributeTableDelegate:
Inheritance graph
[legend]
Collaboration diagram for QgsAttributeTableDelegate:
Collaboration graph
[legend]

Public Member Functions

 QgsAttributeTableDelegate (QObject *parent=NULL)
 Constructor. More...
 
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
 Used to create an editor for when the user tries to change the contents of a cell. More...
 
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
 Overloads the paint method form the QItemDelegate bas class. More...
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
 Sets data from editor back to model. More...
 
void setEditorData (QWidget *editor, const QModelIndex &index) const
 Sets data from model into the editor. More...
 
void setFeatureSelectionModel (QgsFeatureSelectionModel *featureSelectionModel)
 

Private Member Functions

QgsVectorLayerlayer (const QAbstractItemModel *model) const
 

Private Attributes

QgsFeatureSelectionModelmFeatureSelectionModel
 

Detailed Description

A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate).

Definition at line 32 of file qgsattributetabledelegate.h.

Constructor & Destructor Documentation

QgsAttributeTableDelegate::QgsAttributeTableDelegate ( QObject *  parent = NULL)
inline

Constructor.

Parameters
parentparent object

Definition at line 42 of file qgsattributetabledelegate.h.

Member Function Documentation

QWidget * QgsAttributeTableDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
QgsVectorLayer * QgsAttributeTableDelegate::layer ( const QAbstractItemModel *  model) const
private
void QgsAttributeTableDelegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const

Overloads the paint method form the QItemDelegate bas class.

Definition at line 111 of file qgsattributetabledelegate.cpp.

References QgsAttributeTableModel::FeatureIdRole, QgsFeatureSelectionModel::isSelected(), and mFeatureSelectionModel.

void QgsAttributeTableDelegate::setEditorData ( QWidget *  editor,
const QModelIndex &  index 
) const

Sets data from model into the editor.

Overloads default method

Parameters
editoreditor which was created by create editor function in this class
indexindex of field which is to be retrieved

Definition at line 97 of file qgsattributetabledelegate.cpp.

References QgsEditorWidgetWrapper::fromWidget(), and QgsEditorWidgetWrapper::setValue().

void QgsAttributeTableDelegate::setFeatureSelectionModel ( QgsFeatureSelectionModel featureSelectionModel)

Definition at line 106 of file qgsattributetabledelegate.cpp.

References mFeatureSelectionModel.

Referenced by QgsAttributeTableView::setModel().

void QgsAttributeTableDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const

Sets data from editor back to model.

Overloads default method

Parameters
editoreditor which was created by create editor function in this class
modelmodel where data should be updated
indexindex of field which is to be modified

Definition at line 72 of file qgsattributetabledelegate.cpp.

References QgsVectorLayer::beginEditCommand(), QgsVectorLayer::changeAttributeValue(), QgsVectorLayer::endEditCommand(), QgsAttributeTableModel::FeatureIdRole, QgsAttributeTableModel::FieldIndexRole, QgsEditorWidgetWrapper::fromWidget(), layer(), tr, and QgsEditorWidgetWrapper::value().

Member Data Documentation

QgsFeatureSelectionModel* QgsAttributeTableDelegate::mFeatureSelectionModel
private

Definition at line 75 of file qgsattributetabledelegate.h.

Referenced by paint(), and setFeatureSelectionModel().


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