QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
QgsFeatureListView Class Reference

Shows a list of features and renders a edit button next to each feature. More...

#include <qgsfeaturelistview.h>

Collaboration diagram for QgsFeatureListView:
Collaboration graph
[legend]

Public Slots

void setEditSelection (const QgsFeatureIds &fids)
 Set the feature(s) to be edited.
virtual void selectAll ()
 Select all currently visible features.
void repaintRequested (QModelIndexList indexes)
void repaintRequested ()

Signals

void currentEditSelectionChanged (QgsFeature &feat)
 Is emitted, whenever the current edit selection has been changed.
void displayExpressionChanged (const QString expression)
 Is emitted, whenever the display expression is successfully changed.

Public Member Functions

 QgsFeatureListView (QWidget *parent=0)
 Creates a feature list view.
virtual ~QgsFeatureListView ()
 Destructor.
QgsVectorLayerCachelayerCache ()
 Returns the layer cache.
virtual void setModel (QgsFeatureListModel *featureListModel)
 Set the QgsFeatureListModel which is used to retrieve information.
QgsFeatureListModelfeatureListModel ()
 Get the featureListModel used by this view.
bool setDisplayExpression (const QString displayExpression)
 The display expression is an expression used to render the fields into a single string which is displaied.
const QString & displayExpression () const
 Returns the expression which is currently used to render the features.
QString parserErrorString ()
 Returns a detailed message about errors while parsing a QgsExpression.

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

QgsFeatureListModelmModel
QItemSelectionModel * mCurrentEditSelectionModel
QgsFeatureSelectionModelmFeatureSelectionModel
QgsFeatureListViewDelegatemItemDelegate
bool mEditSelectionDrag
int mRowAnchor
QItemSelectionModel::SelectionFlags mCtrlDragSelectionFlag

Detailed Description

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.

Constructor & Destructor Documentation

QgsFeatureListView::QgsFeatureListView ( QWidget *  parent = 0)
explicit

Creates a feature list view.

Parameters
parentowner

Definition at line 34 of file qgsfeaturelistview.cpp.

virtual QgsFeatureListView::~QgsFeatureListView ( )
inlinevirtual

Destructor.

Definition at line 56 of file qgsfeaturelistview.h.

Member Function Documentation

void QgsFeatureListView::currentEditSelectionChanged ( QgsFeature feat)
signal

Is emitted, whenever the current edit selection has been changed.

Parameters
featthe feature, which will be edited.

Referenced by editSelectionChanged().

const QString & QgsFeatureListView::displayExpression ( ) const

Returns the expression which is currently used to render the features.

Returns
A string containing the currend display expression
See Also
QgsExpression

Definition at line 89 of file qgsfeaturelistview.cpp.

References QgsFeatureListModel::displayExpression(), and mModel.

void QgsFeatureListView::displayExpressionChanged ( const QString  expression)
signal

Is emitted, whenever the display expression is successfully changed.

Parameters
expressionThe expression that was applied

Referenced by setDisplayExpression().

void QgsFeatureListView::editSelectionChanged ( QItemSelection  deselected,
QItemSelection  selected 
)
privateslot
QgsFeatureListModel* QgsFeatureListView::featureListModel ( )
inline

Get the featureListModel used by this view.

Returns
The model in use

Definition at line 75 of file qgsfeaturelistview.h.

Referenced by setModel().

void QgsFeatureListView::keyPressEvent ( QKeyEvent *  event)
protectedvirtual
QgsVectorLayerCache * QgsFeatureListView::layerCache ( )

Returns the layer cache.

Returns
the layer cache used as backend

Definition at line 44 of file qgsfeaturelistview.cpp.

References QgsFeatureListModel::layerCache(), and mModel.

void QgsFeatureListView::mouseMoveEvent ( QMouseEvent *  event)
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 176 of file qgsfeaturelistview.cpp.

References QgsFeatureListModel::mapToMaster(), mCurrentEditSelectionModel, mEditSelectionDrag, mModel, and selectRow().

void QgsFeatureListView::mousePressEvent ( QMouseEvent *  event)
protectedvirtual
void QgsFeatureListView::mouseReleaseEvent ( QMouseEvent *  event)
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 199 of file qgsfeaturelistview.cpp.

References QgsFeatureSelectionModel::enableSync(), mEditSelectionDrag, and mFeatureSelectionModel.

QString QgsFeatureListView::parserErrorString ( )

Returns a detailed message about errors while parsing a QgsExpression.

Returns
A message containg information about the parser error.

Definition at line 94 of file qgsfeaturelistview.cpp.

References mModel, and QgsFeatureListModel::parserErrorString().

void QgsFeatureListView::repaintRequested ( QModelIndexList  indexes)
slot

Definition at line 157 of file qgsfeaturelistview.cpp.

void QgsFeatureListView::repaintRequested ( )
slot

Definition at line 165 of file qgsfeaturelistview.cpp.

Referenced by mousePressEvent(), and setModel().

void QgsFeatureListView::selectAll ( )
virtualslot
void QgsFeatureListView::selectRow ( const QModelIndex &  index,
bool  anchor 
)
private
bool QgsFeatureListView::setDisplayExpression ( const QString  displayExpression)

The display expression is an expression used to render the fields into a single string which is displaied.

Parameters
displayExpressionThe expression used to render the feature
See Also
QgsExpression

Definition at line 76 of file qgsfeaturelistview.cpp.

References displayExpressionChanged(), mModel, and QgsFeatureListModel::setDisplayExpression().

void QgsFeatureListView::setEditSelection ( const QgsFeatureIds fids)
slot

Set the feature(s) to be edited.

Parameters
fidsA list of features to be edited

Definition at line 145 of file qgsfeaturelistview.cpp.

References QgsFeatureListModel::fidToIdx(), QgsFeatureListModel::mapToMaster(), mCurrentEditSelectionModel, and mModel.

void QgsFeatureListView::setModel ( QgsFeatureListModel featureListModel)
virtual

Member Data Documentation

QItemSelectionModel::SelectionFlags QgsFeatureListView::mCtrlDragSelectionFlag
private

Definition at line 151 of file qgsfeaturelistview.h.

Referenced by selectRow().

QItemSelectionModel* QgsFeatureListView::mCurrentEditSelectionModel
private
bool QgsFeatureListView::mEditSelectionDrag
private

Definition at line 149 of file qgsfeaturelistview.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

QgsFeatureSelectionModel* QgsFeatureListView::mFeatureSelectionModel
private
QgsFeatureListViewDelegate* QgsFeatureListView::mItemDelegate
private

Definition at line 148 of file qgsfeaturelistview.h.

Referenced by mousePressEvent(), and setModel().

QgsFeatureListModel* QgsFeatureListView::mModel
private
int QgsFeatureListView::mRowAnchor
private

Definition at line 150 of file qgsfeaturelistview.h.

Referenced by selectRow().


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