QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsfieldcombobox.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfieldcombobox.h
3  --------------------------------------
4  Date : 01.04.2014
5  Copyright : (C) 2014 Denis Rouzaud
6  Email : [email protected]
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 QGSFIELDCOMBOBOX_H
17 #define QGSFIELDCOMBOBOX_H
18 
19 #include <QComboBox>
20 
21 #include "qgsfieldproxymodel.h"
22 
23 class QgsMapLayer;
24 class QgsVectorLayer;
25 
33 class GUI_EXPORT QgsFieldComboBox : public QComboBox
34 {
35  Q_OBJECT
36  Q_FLAGS( QgsFieldProxyModel::Filters )
37  Q_PROPERTY( QgsFieldProxyModel::Filters filters READ filters WRITE setFilters )
38 
39  public:
44  explicit QgsFieldComboBox( QWidget *parent = 0 );
45 
47  void setFilters( QgsFieldProxyModel::Filters filters );
48 
50  QgsFieldProxyModel::Filters filters() const { return mFieldProxyModel->filters(); }
51 
53  QString currentField() const;
54 
56  QgsVectorLayer* layer() const;
57 
58  signals:
60  void fieldChanged( QString fieldName );
61 
62  public slots:
64  void setLayer( QgsVectorLayer* layer );
65 
67  void setLayer( QgsMapLayer* layer );
68 
70  void setField( QString fieldName );
71 
72  protected slots:
73  void indexChanged( int i );
74 
75  private:
76  QgsFieldProxyModel* mFieldProxyModel;
77 };
78 
79 #endif // QGSFIELDCOMBOBOX_H