QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsmaplayercombobox.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaplayercombobox.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 QGSMAPLAYERCOMBOBOX_H
17 #define QGSMAPLAYERCOMBOBOX_H
18 
19 #include <QComboBox>
20 
21 #include "qgsmaplayerproxymodel.h"
22 
23 class QgsMapLayer;
24 class QgsVectorLayer;
25 
30 class GUI_EXPORT QgsMapLayerComboBox : public QComboBox
31 {
32  Q_OBJECT
33  Q_FLAGS( QgsMapLayerProxyModel::Filters )
34  Q_PROPERTY( QgsMapLayerProxyModel::Filters filters READ filters WRITE setFilters )
35 
36  public:
41  explicit QgsMapLayerComboBox( QWidget *parent = 0 );
42 
44  void setFilters( QgsMapLayerProxyModel::Filters filters );
45 
47  QgsMapLayerProxyModel::Filters filters() const { return mProxyModel->filters(); }
48 
50  QgsMapLayer* currentLayer() const;
51 
52  public slots:
54  void setLayer( QgsMapLayer* layer );
55 
56  signals:
58  void layerChanged( QgsMapLayer* layer );
59 
60  protected slots:
61  void indexChanged( int i );
62 
63  private:
64  QgsMapLayerProxyModel* mProxyModel;
65 };
66 
67 #endif // QGSMAPLAYERCOMBOBOX_H