QGIS API Documentation  2.9.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 : denis.rouzaud@gmail.com
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 ) { mProxyModel->setFilters( filters ); }
45 
47  QgsMapLayerProxyModel::Filters filters() const { return mProxyModel->filters(); }
48 
50  void setExceptedLayerList( QList<QgsMapLayer*> layerList ) { mProxyModel->setExceptedLayerList( layerList );}
51 
53  QList<QgsMapLayer*> exceptedLayerList() const {return mProxyModel->exceptedLayerList();}
54 
56  QgsMapLayer* currentLayer() const;
57 
58  public slots:
60  void setLayer( QgsMapLayer* layer );
61 
62  signals:
64  void layerChanged( QgsMapLayer* layer );
65 
66  protected slots:
67  void indexChanged( int i );
68 
69  private:
70  QgsMapLayerProxyModel* mProxyModel;
71 };
72 
73 #endif // QGSMAPLAYERCOMBOBOX_H
Base class for all map layer types.
Definition: qgsmaplayer.h:49
QList< QgsMapLayer * > exceptedLayerList() const
returns the list of excepted layers
void setFilters(QgsMapLayerProxyModel::Filters filters)
setFilters allows fitering according to layer type and/or geometry type.
The QgsMapLayerComboBox class is a combo box which displays the list of layers.
The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widget...
QgsMapLayerProxyModel::Filters filters() const
currently used filter on list layers
void setExceptedLayerList(QList< QgsMapLayer * > layerList)
except a list of layers not to be listed
Represents a vector layer which manages a vector based data sets.