QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 "qgis_sip.h"
21 #include <QToolButton>
22 #include "qgis_gui.h"
23 
24 #ifdef SIP_RUN
25 % ModuleHeaderCode
27 % End
28 #endif
29 
38 class GUI_EXPORT QgsSearchWidgetToolButton : public QToolButton
39 {
40 
41 #ifdef SIP_RUN
43  if ( qobject_cast<QgsSearchWidgetToolButton *>( sipCpp ) )
44  sipType = sipType_QgsSearchWidgetToolButton;
45  else
46  sipType = nullptr;
47  SIP_END
48 #endif
49 
50  Q_OBJECT
51 
52  public:
53 
58  explicit QgsSearchWidgetToolButton( QWidget *parent SIP_TRANSFERTHIS = nullptr );
59 
69  void setAvailableFlags( QgsSearchWidgetWrapper::FilterFlags flags );
70 
77  void setDefaultFlags( QgsSearchWidgetWrapper::FilterFlags flags );
78 
84  QgsSearchWidgetWrapper::FilterFlags availableFlags() const { return mAvailableFilterFlags; }
85 
95  void setActiveFlags( QgsSearchWidgetWrapper::FilterFlags flags );
96 
106  void toggleFlag( QgsSearchWidgetWrapper::FilterFlag flag );
107 
114  QgsSearchWidgetWrapper::FilterFlags activeFlags() const { return mFilterFlags; }
115 
121  bool isActive() const;
122 
123  public slots:
124 
130  void setInactive();
131 
137  void setActive();
138 
139  signals:
140 
145  void activeFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags );
146 
147  private slots:
148 
149  void aboutToShowMenu();
150 
151  void actionSelected();
152 
153  void searchWidgetValueChanged();
154 
155  private:
156 
157  QgsSearchWidgetWrapper::FilterFlags mAvailableFilterFlags;
158  QgsSearchWidgetWrapper::FilterFlags mDefaultFilterFlags;
159  QgsSearchWidgetWrapper::FilterFlags mFilterFlags;
160  QMenu *mMenu = nullptr;
161 
162  void updateState();
163 
164 };
165 
166 #endif // QGSSEARCHWIDGETTOOLBUTTON_H
qgssearchwidgettoolbutton.h
QgsSearchWidgetToolButton
Definition: qgssearchwidgettoolbutton.h:38
QgsSearchWidgetToolButton::availableFlags
QgsSearchWidgetWrapper::FilterFlags availableFlags() const
Returns the available filter flags shown in the widget.
Definition: qgssearchwidgettoolbutton.h:84
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:172
qgssearchwidgetwrapper.h
qgis_sip.h
QgsSearchWidgetWrapper::FilterFlag
FilterFlag
Flags which indicate what types of filtering and searching is possible using the widget.
Definition: qgssearchwidgetwrapper.h:94
QgsSearchWidgetToolButton::activeFlags
QgsSearchWidgetWrapper::FilterFlags activeFlags() const
Returns the active filter flags shown in the widget.
Definition: qgssearchwidgettoolbutton.h:114
SIP_END
#define SIP_END
Definition: qgis_sip.h:189
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53