~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/app/attributetable/qgsattributetablememorymodel.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
  QgsAttributeTableMemoryModel.h - Memory Model for attribute table
 
3
  -------------------
 
4
         date                 : Feb 2009
 
5
         copyright            : Vita Cizek
 
6
         email                : weetya (at) gmail.com
 
7
 
 
8
 ***************************************************************************
 
9
 *                                                                         *
 
10
 *   This program is free software; you can redistribute it and/or modify  *
 
11
 *   it under the terms of the GNU General Public License as published by  *
 
12
 *   the Free Software Foundation; either version 2 of the License, or     *
 
13
 *   (at your option) any later version.                                   *
 
14
 *                                                                         *
 
15
 ***************************************************************************/
 
16
 
 
17
#ifndef QGSATTRIBUTETABLEMEMORYMODEL_H
 
18
#define QGSATTRIBUTETABLEMEMORYMODEL_H
 
19
 
 
20
#include <QAbstractTableModel>
 
21
#include <QModelIndex>
 
22
#include <QObject>
 
23
#include <QHash>
 
24
 
 
25
//QGIS Includes
 
26
#include "qgsfeature.h" //QgsAttributeMap
 
27
#include "qgsvectorlayer.h" //QgsAttributeList
 
28
#include "qgsattributetablemodel.h"
 
29
#include "qgsattributetableidcolumnpair.h"
 
30
 
 
31
class QgsAttributeTableMemoryModel : public QgsAttributeTableModel
 
32
{
 
33
    Q_OBJECT;
 
34
 
 
35
  public:
 
36
    /**
 
37
     * Constructor
 
38
     * @param theLayer layer pointer
 
39
     */
 
40
    QgsAttributeTableMemoryModel( QgsVectorLayer *theLayer );
 
41
 
 
42
  protected slots:
 
43
    /**
 
44
     * Launched when a feature has been deleted
 
45
     * @param fid feature id
 
46
     */
 
47
    virtual void featureDeleted( int fid );
 
48
    /**
 
49
     * Launched when a feature has been deleted
 
50
     * @param fid feature id
 
51
     */
 
52
    virtual void featureAdded( int fid );
 
53
    /**
 
54
     * Launched when layer has been deleted
 
55
     */
 
56
    virtual void layerDeleted();
 
57
 
 
58
  private slots:
 
59
    /**
 
60
     * Launched when attribute value has been changed
 
61
     * @param fid feature id
 
62
     * @param idx attribute index
 
63
     * @param value new value
 
64
     */
 
65
    virtual void attributeValueChanged( int fid, int idx, const QVariant &value );
 
66
 
 
67
  private:
 
68
    /**
 
69
     * load feature fid into mFeat
 
70
     * @param fid feature id
 
71
     * @return feature exists
 
72
     */
 
73
    virtual bool featureAtId( int fid );
 
74
 
 
75
    /**
 
76
     * Loads the layer into the model
 
77
     */
 
78
    virtual void loadLayer();
 
79
 
 
80
    QHash<int, QgsFeature> mFeatureMap;
 
81
};
 
82
 
 
83
#endif //QGSATTRIBUTETABLEMEMORYMODEL_H