QGIS API Documentation
2.2.0-Valmiera
|
A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate). More...
#include <qgsattributetabledelegate.h>
Public Member Functions | |
QgsAttributeTableDelegate (QObject *parent=NULL) | |
Constructor. | |
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. | |
void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const |
Overloads the paint method form the QItemDelegate bas class. | |
void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const |
Sets data from editor back to model. | |
void | setEditorData (QWidget *editor, const QModelIndex &index) const |
Sets data from model into the editor. | |
void | setFeatureSelectionModel (QgsFeatureSelectionModel *featureSelectionModel) |
Private Member Functions | |
QgsVectorLayer * | layer (const QAbstractItemModel *model) const |
Private Attributes | |
QgsFeatureSelectionModel * | mFeatureSelectionModel |
A delegate item class for QgsAttributeTable (see Qt documentation for QItemDelegate).
Definition at line 32 of file qgsattributetabledelegate.h.
|
inline |
Constructor.
parent | parent object |
Definition at line 42 of file qgsattributetabledelegate.h.
QWidget * QgsAttributeTableDelegate::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.
Definition at line 47 of file qgsattributetabledelegate.cpp.
References QgsVectorLayer::Calendar, QgsAttributeEditor::createAttributeEditor(), QgsVectorLayer::editType(), QgsVectorLayer::fieldEditable(), QgsAttributeTableModel::FieldIndexRole, QgsVectorLayer::FileName, and layer().
|
private |
Definition at line 34 of file qgsattributetabledelegate.cpp.
References QgsAttributeTableFilterModel::layer(), and QgsAttributeTableModel::layer().
Referenced by createEditor(), setEditorData(), and setModelData().
void QgsAttributeTableDelegate::paint | ( | QPainter * | painter, |
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | const |
Overloads the paint method form the QItemDelegate bas class.
Definition at line 116 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
editor | editor which was created by create editor function in this class |
index | index of field which is to be retrieved |
Definition at line 101 of file qgsattributetabledelegate.cpp.
References QgsAttributeTableModel::FieldIndexRole, layer(), and QgsAttributeEditor::setValue().
void QgsAttributeTableDelegate::setFeatureSelectionModel | ( | QgsFeatureSelectionModel * | featureSelectionModel | ) |
Definition at line 111 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
editor | editor which was created by create editor function in this class |
model | model where data should be updated |
index | index of field which is to be modified |
Definition at line 82 of file qgsattributetabledelegate.cpp.
References QgsVectorLayer::beginEditCommand(), QgsVectorLayer::changeAttributeValue(), QgsVectorLayer::endEditCommand(), QgsAttributeTableModel::FeatureIdRole, QgsAttributeTableModel::FieldIndexRole, layer(), QgsAttributeEditor::retrieveValue(), and tr.
|
private |
Definition at line 75 of file qgsattributetabledelegate.h.
Referenced by paint(), and setFeatureSelectionModel().