QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgssearchwidgettoolbutton.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssearchwidgettoolbutton.h
3  ---------------------------
4  Date : May 2016
5  Copyright : (C) 2016 Nyall Dawson
6  Email : nyall dot dawson at 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 QGSSEARCHWIDGETTOOLBUTTON_H
17 #define QGSSEARCHWIDGETTOOLBUTTON_H
18 
20 #include <QToolButton>
21 
29 class GUI_EXPORT QgsSearchWidgetToolButton : public QToolButton
30 {
31  Q_OBJECT
32 
33  public:
34 
38  explicit QgsSearchWidgetToolButton( QWidget *parent = nullptr );
39 
48  void setAvailableFlags( QgsSearchWidgetWrapper::FilterFlags flags );
49 
55  void setDefaultFlags( QgsSearchWidgetWrapper::FilterFlags flags );
56 
61  QgsSearchWidgetWrapper::FilterFlags availableFlags() const { return mAvailableFilterFlags; }
62 
71  void setActiveFlags( QgsSearchWidgetWrapper::FilterFlags flags );
72 
81  void toggleFlag( QgsSearchWidgetWrapper::FilterFlag flag );
82 
88  QgsSearchWidgetWrapper::FilterFlags activeFlags() const { return mFilterFlags; }
89 
94  bool isActive() const;
95 
96  public slots:
97 
102  void setInactive();
103 
108  void setActive();
109 
110  signals:
111 
115  void activeFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags );
116 
117  private slots:
118 
119  void aboutToShowMenu();
120 
121  void actionSelected();
122 
123  void searchWidgetValueChanged();
124 
125  private:
126 
127  QgsSearchWidgetWrapper::FilterFlags mAvailableFilterFlags;
128  QgsSearchWidgetWrapper::FilterFlags mDefaultFilterFlags;
129  QgsSearchWidgetWrapper::FilterFlags mFilterFlags;
130  QMenu* mMenu;
131 
132  void updateState();
133 
134 };
135 
136 #endif // QGSSEARCHWIDGETTOOLBUTTON_H
A tool button widget which is displayed next to search widgets in forms, and allows for controlling h...
FilterFlag
Flags which indicate what types of filtering and searching is possible using the widget.
QgsSearchWidgetWrapper::FilterFlags availableFlags() const
Returns the available filter flags shown in the widget.
QgsSearchWidgetWrapper::FilterFlags activeFlags() const
Returns the active filter flags shown in the widget.