QGIS API Documentation  3.6.0-Noosa (5873452)
qgsaggregatetoolbutton.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsaggregatetoolbutton.h
3  --------------------------------------
4  Date : Nov 2017
5  Copyright : (C) 2017 Matthias Kuhn
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 QGSAGGREGATETOOLBUTTON_H
17 #define QGSAGGREGATETOOLBUTTON_H
18 
19 #include <QToolButton>
20 #include <QVariant>
21 
22 #include "qgsaggregatecalculator.h"
23 #include "qgis_gui.h"
24 
33 class GUI_EXPORT QgsAggregateToolButton : public QToolButton
34 {
35  Q_OBJECT
36 
37  public:
38 
43 
47  void setType( QVariant::Type type );
48 
52  QVariant::Type type() const;
53 
57  void setActive( bool active );
58 
62  bool active() const;
63 
67  QString aggregate() const;
68 
72  void setAggregate( const QString &aggregate );
73 
74  signals:
75 
79  void aggregateChanged();
80 
84  void activeChanged();
85 
86  private slots:
87  void aboutToShowMenu();
88 
89  private:
90  void updateAvailableAggregates();
91  QMenu *mMenu = nullptr;
92  QVariant::Type mType = QVariant::Invalid;
93  bool mActive = false;
94  QString mAggregate;
95  QList<QgsAggregateCalculator::AggregateInfo> mAvailableAggregates;
96 };
97 
98 #endif // QGSAGGREGATETOOLBUTTON_H
Offers a toolbutton to choose between different aggregate functions.