QGIS API Documentation
2.4.0-Chugiak
|
Shows a list of features and renders a edit button next to each feature. More...
#include <qgsfeaturelistview.h>
Public Slots | |
void | setEditSelection (const QgsFeatureIds &fids) |
Set the feature(s) to be edited. More... | |
void | setEditSelection (const QModelIndex &index, QItemSelectionModel::SelectionFlags command) |
Set the feature(s) to be edited. More... | |
virtual void | selectAll () |
Select all currently visible features. More... | |
void | repaintRequested (QModelIndexList indexes) |
void | repaintRequested () |
Signals | |
void | currentEditSelectionChanged (QgsFeature &feat) |
Is emitted, whenever the current edit selection has been changed. More... | |
void | displayExpressionChanged (const QString expression) |
Is emitted, whenever the display expression is successfully changed. More... | |
void | aboutToChangeEditSelection (bool &ok) |
Public Member Functions | |
QgsFeatureListView (QWidget *parent=0) | |
Creates a feature list view. More... | |
virtual | ~QgsFeatureListView () |
Destructor. More... | |
QgsVectorLayerCache * | layerCache () |
Returns the layer cache. More... | |
virtual void | setModel (QgsFeatureListModel *featureListModel) |
Set the QgsFeatureListModel which is used to retrieve information. More... | |
QgsFeatureListModel * | featureListModel () |
Get the featureListModel used by this view. More... | |
bool | setDisplayExpression (const QString displayExpression) |
The display expression is an expression used to render the fields into a single string which is displaied. More... | |
const QString | displayExpression () const |
Returns the expression which is currently used to render the features. More... | |
QString | parserErrorString () |
Returns a detailed message about errors while parsing a QgsExpression. More... | |
QgsFeatureIds | currentEditSelection () |
Get the currentEditSelection. More... | |
void | setCurrentFeatureEdited (bool state) |
Sets if the currently shown form has received any edit events so far. More... | |
Protected Member Functions | |
virtual void | mouseMoveEvent (QMouseEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
virtual void | keyPressEvent (QKeyEvent *event) |
Private Slots | |
void | editSelectionChanged (QItemSelection deselected, QItemSelection selected) |
Private Member Functions | |
void | selectRow (const QModelIndex &index, bool anchor) |
Private Attributes | |
QgsFeatureListModel * | mModel |
QItemSelectionModel * | mCurrentEditSelectionModel |
QgsFeatureSelectionModel * | mFeatureSelectionModel |
QgsFeatureListViewDelegate * | mItemDelegate |
bool | mEditSelectionDrag |
int | mRowAnchor |
QItemSelectionModel::SelectionFlags | mCtrlDragSelectionFlag |
Shows a list of features and renders a edit button next to each feature.
Accepts a display expression to define the way, features are rendered. Uses a QgsFeatureListModel as source model.
Definition at line 41 of file qgsfeaturelistview.h.
|
explicit |
Creates a feature list view.
parent | owner |
Definition at line 35 of file qgsfeaturelistview.cpp.
|
inlinevirtual |
Destructor.
Definition at line 56 of file qgsfeaturelistview.h.
|
signal |
Referenced by setEditSelection().
QgsFeatureIds QgsFeatureListView::currentEditSelection | ( | ) |
Get the currentEditSelection.
Definition at line 100 of file qgsfeaturelistview.cpp.
References QgsAttributeTableModel::FeatureIdRole, and mCurrentEditSelectionModel.
|
signal |
Is emitted, whenever the current edit selection has been changed.
feat | the feature, which will be edited. |
Referenced by editSelectionChanged().
const QString QgsFeatureListView::displayExpression | ( | ) | const |
Returns the expression which is currently used to render the features.
Definition at line 90 of file qgsfeaturelistview.cpp.
References QgsFeatureListModel::displayExpression(), and mModel.
|
signal |
Is emitted, whenever the display expression is successfully changed.
expression | The expression that was applied |
Referenced by setDisplayExpression().
|
privateslot |
Definition at line 135 of file qgsfeaturelistview.cpp.
References currentEditSelectionChanged(), QgsFeatureListModel::featureByIndex(), QgsFeatureListModel::mapFromMaster(), QgsFeatureListModel::mapSelectionFromMaster(), mCurrentEditSelectionModel, and mModel.
Referenced by setModel().
|
inline |
Get the featureListModel used by this view.
Definition at line 75 of file qgsfeaturelistview.h.
Referenced by setModel().
|
protectedvirtual |
Definition at line 247 of file qgsfeaturelistview.cpp.
References QgsFeatureListModel::index(), QgsFeatureListModel::mapFromMaster(), QgsFeatureListModel::mapToMaster(), mCurrentEditSelectionModel, mModel, and setEditSelection().
QgsVectorLayerCache * QgsFeatureListView::layerCache | ( | ) |
Returns the layer cache.
Definition at line 45 of file qgsfeaturelistview.cpp.
References QgsFeatureListModel::layerCache(), and mModel.
|
protectedvirtual |
This function is called with the given event when a mouse move event is sent to the widget. If a selection is in progress and new items are moved over the selection is extended; if a drag is in progress it is continued.
Definition at line 210 of file qgsfeaturelistview.cpp.
References index, QgsFeatureListModel::mapToMaster(), mEditSelectionDrag, mModel, selectRow(), and setEditSelection().
|
protectedvirtual |
Definition at line 116 of file qgsfeaturelistview.cpp.
References QgsFeatureListViewDelegate::EditElement, QgsFeatureSelectionModel::enableSync(), index, QgsFeatureListModel::mapToMaster(), mEditSelectionDrag, mFeatureSelectionModel, mItemDelegate, mModel, QgsFeatureListViewDelegate::positionToElement(), repaintRequested(), selectRow(), and setEditSelection().
|
protectedvirtual |
This function is called with the given event when a mouse button is released, after a mouse press event on the widget. If a user presses the mouse inside your widget and then drags the mouse to another location before releasing the mouse button, your widget receives the release event. The function will emit the clicked() signal if an item was being pressed.
Definition at line 233 of file qgsfeaturelistview.cpp.
References QgsFeatureSelectionModel::enableSync(), mEditSelectionDrag, and mFeatureSelectionModel.
QString QgsFeatureListView::parserErrorString | ( | ) |
Returns a detailed message about errors while parsing a QgsExpression.
Definition at line 95 of file qgsfeaturelistview.cpp.
References mModel, and QgsFeatureListModel::parserErrorString().
|
slot |
Definition at line 191 of file qgsfeaturelistview.cpp.
References index.
|
slot |
Definition at line 199 of file qgsfeaturelistview.cpp.
Referenced by mousePressEvent(), and setModel().
|
virtualslot |
Select all currently visible features.
Definition at line 158 of file qgsfeaturelistview.cpp.
References QgsFeatureListModel::index(), mFeatureSelectionModel, mModel, QgsFeatureListModel::rowCount(), and QgsFeatureSelectionModel::selectFeatures().
|
private |
Definition at line 293 of file qgsfeaturelistview.cpp.
References QgsFeatureSelectionModel::isSelected(), mCtrlDragSelectionFlag, mFeatureSelectionModel, mRowAnchor, and QgsFeatureSelectionModel::selectFeatures().
Referenced by mouseMoveEvent(), and mousePressEvent().
void QgsFeatureListView::setCurrentFeatureEdited | ( | bool | state | ) |
Sets if the currently shown form has received any edit events so far.
state | The state |
Definition at line 110 of file qgsfeaturelistview.cpp.
References mCurrentEditSelectionModel, mItemDelegate, and QgsFeatureListViewDelegate::setCurrentFeatureEdited().
bool QgsFeatureListView::setDisplayExpression | ( | const QString | displayExpression | ) |
The display expression is an expression used to render the fields into a single string which is displaied.
displayExpression | The expression used to render the feature |
Definition at line 77 of file qgsfeaturelistview.cpp.
References displayExpressionChanged(), mModel, and QgsFeatureListModel::setDisplayExpression().
|
slot |
Set the feature(s) to be edited.
fids | A list of features to be edited |
Definition at line 166 of file qgsfeaturelistview.cpp.
References aboutToChangeEditSelection(), QgsFeatureListModel::fidToIdx(), QgsFeatureListModel::mapToMaster(), mCurrentEditSelectionModel, and mModel.
Referenced by keyPressEvent(), mouseMoveEvent(), and mousePressEvent().
|
slot |
Set the feature(s) to be edited.
index | The selection to set |
command | selection update mode |
Definition at line 182 of file qgsfeaturelistview.cpp.
References aboutToChangeEditSelection(), and mCurrentEditSelectionModel.
|
virtual |
Set the QgsFeatureListModel which is used to retrieve information.
featureListModel | The model to use |
Definition at line 50 of file qgsfeaturelistview.cpp.
References editSelectionChanged(), featureListModel(), QgsVectorLayerCache::layer(), QgsFeatureListModel::layerCache(), QgsFeatureListModel::masterModel(), mCurrentEditSelectionModel, mFeatureSelectionModel, mItemDelegate, mModel, repaintRequested(), QgsFeatureListViewDelegate::setEditSelectionModel(), and QgsFeatureListViewDelegate::setFeatureSelectionModel().
|
private |
Definition at line 175 of file qgsfeaturelistview.h.
Referenced by selectRow().
|
private |
Definition at line 170 of file qgsfeaturelistview.h.
Referenced by currentEditSelection(), editSelectionChanged(), keyPressEvent(), setCurrentFeatureEdited(), setEditSelection(), and setModel().
|
private |
Definition at line 173 of file qgsfeaturelistview.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
Definition at line 171 of file qgsfeaturelistview.h.
Referenced by mousePressEvent(), mouseReleaseEvent(), selectAll(), selectRow(), and setModel().
|
private |
Definition at line 172 of file qgsfeaturelistview.h.
Referenced by mousePressEvent(), setCurrentFeatureEdited(), and setModel().
|
private |
Definition at line 169 of file qgsfeaturelistview.h.
Referenced by displayExpression(), editSelectionChanged(), keyPressEvent(), layerCache(), mouseMoveEvent(), mousePressEvent(), parserErrorString(), selectAll(), setDisplayExpression(), setEditSelection(), and setModel().
|
private |
Definition at line 174 of file qgsfeaturelistview.h.
Referenced by selectRow().