QGIS API Documentation  2.2.0-Valmiera
 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 
108  QgsFeatureIds currentEditSelection();
109 
110  protected:
111  virtual void mouseMoveEvent( QMouseEvent *event );
112  virtual void mousePressEvent( QMouseEvent *event );
113  virtual void mouseReleaseEvent( QMouseEvent *event );
114  virtual void keyPressEvent( QKeyEvent *event );
115 
116  signals:
122  void currentEditSelectionChanged( QgsFeature &feat );
123 
128  void displayExpressionChanged( const QString expression );
129 
130  public slots:
136  void setEditSelection( const QgsFeatureIds &fids );
137 
141  virtual void selectAll();
142 
143  void repaintRequested( QModelIndexList indexes );
144  void repaintRequested();
145 
146  private slots:
147  void editSelectionChanged( QItemSelection deselected, QItemSelection selected );
148 
149  private:
150  void selectRow( const QModelIndex &index, bool anchor );
151 
153  QItemSelectionModel* mCurrentEditSelectionModel;
156  bool mEditSelectionDrag; // Is set to true when the user initiated a left button click over an edit button and still keeps pressing /**< TODO */
158  QItemSelectionModel::SelectionFlags mCtrlDragSelectionFlag;
159 };
160 
161 #endif