QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsfeaturelistview.h
Go to the documentation of this file.
1 /***************************************************************************
2  QgsAttributeListView.h
3  --------------------------------------
4  Date : Jan 2012
5  Copyright : (C) 2013 Matthias Kuhn
6  Email : matthias dot kuhn at gmx dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSATTRIBUTELISTVIEW_H
17 #define QGSATTRIBUTELISTVIEW_H
18 
19 #include <QListView>
20 #include <qdebug.h>
21 
22 #include "qgsfeature.h" // For QgsFeatureIds
23 
28 class QgsVectorLayer;
31 class QRect;
32 
41 class GUI_EXPORT QgsFeatureListView : public QListView
42 {
43  Q_OBJECT
44 
45  public:
51  explicit QgsFeatureListView( QWidget* parent = 0 );
52 
56  virtual ~QgsFeatureListView() {}
57 
62  QgsVectorLayerCache* layerCache();
63 
69  virtual void setModel( QgsFeatureListModel* featureListModel );
75  QgsFeatureListModel* featureListModel() { return mModel; }
76 
85  bool setDisplayExpression( const QString displayExpression );
86 
94  const QString& displayExpression() const;
95 
101  QString parserErrorString();
102 
103  protected:
104  virtual void mouseMoveEvent( QMouseEvent *event );
105  virtual void mousePressEvent( QMouseEvent *event );
106  virtual void mouseReleaseEvent( QMouseEvent *event );
107  virtual void keyPressEvent( QKeyEvent *event );
108 
109  signals:
115  void currentEditSelectionChanged( QgsFeature &feat );
116 
121  void displayExpressionChanged( const QString expression );
122 
123  public slots:
129  void setEditSelection( const QgsFeatureIds &fids );
130 
134  virtual void selectAll();
135 
136  void repaintRequested( QModelIndexList indexes );
137  void repaintRequested();
138 
139  private slots:
140  void editSelectionChanged( QItemSelection deselected, QItemSelection selected );
141 
142  private:
143  void selectRow( const QModelIndex &index, bool anchor );
144 
146  QItemSelectionModel* mCurrentEditSelectionModel;
149  bool mEditSelectionDrag; // Is set to true when the user initiated a left button click over an edit button and still keeps pressing /**< TODO */
151  QItemSelectionModel::SelectionFlags mCtrlDragSelectionFlag;
152 };
153 
154 #endif