QGIS API Documentation  2.14.0-Essen
qgslegendfilterbutton.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslegendfilterbutton.h - QToolButton for legend filter by map content
3  --------------------------------------
4  Date : June 2015
5  Copyright : (C) 2015 by Hugo Mercier at Oslandia
6  Email : hugo dot mercier at oslandia dot 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 #ifndef QGS_LEGEND_FILTER_BUTTON_H
16 #define QGS_LEGEND_FILTER_BUTTON_H
17 
18 #include <QToolButton>
19 
21 
29 class GUI_EXPORT QgsLegendFilterButton: public QToolButton
30 {
31  Q_OBJECT
32 
33  public:
39  QgsLegendFilterButton( QWidget* parent = nullptr );
41 
45  QString expressionText() const;
46 
51  void setExpressionText( const QString& expression );
52 
57  QgsVectorLayer* vectorLayer() const;
62  void setVectorLayer( QgsVectorLayer* layer );
63 
64  signals:
68  void expressionTextChanged();
69 
70  private:
71  QMenu* mMenu;
72  QAction* mSetExpressionAction;
73  QAction* mClearExpressionAction;
74  QString mExpression;
75 
76  void updateMenu();
77 
78  QgsVectorLayer* mLayer;
79  private slots:
80  void onSetLegendFilterExpression();
81  void onClearFilterExpression();
82  void onToggle( bool );
83 };
84 
85 #endif // QGS_FILTER_LEGEND_BUTTON_H
Represents a vector layer which manages a vector based data sets.