QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsfeaturefilterwidget_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfeaturefilterwidget.h
3  --------------------------------------
4  Date : 20.9.2019
5  Copyright : (C) 2019 Julien Cabieces
6  Email : julien dot cabieces 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 
16 #ifndef QGSFEATUREFILTERWIDGET_P_H
17 #define QGSFEATUREFILTERWIDGET_P_H
18 
19 #define SIP_NO_FILE
20 
22 
23 //
24 // W A R N I N G
25 // -------------
26 //
27 // This file is not part of the QGIS API. It exists purely as an
28 // implementation detail. This header file may change from version to
29 // version without notice, or even be removed.
30 //
31 
32 #include "ui_qgsfeaturefilterwidget.h"
33 
34 #include "qgsattributeform.h"
35 
36 #include "qgis_gui.h"
37 
38 class QgsVectorLayer;
41 class QgsDualView;
42 class QgsMessageBar;
43 
48 class GUI_EXPORT QgsFeatureFilterWidget : public QWidget, private Ui::QgsFeatureFilterWidget
49 {
50  Q_OBJECT
51 
52  public:
53 
55  explicit QgsFeatureFilterWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
56 
57  void init( QgsVectorLayer *layer, const QgsAttributeEditorContext &context, QgsDualView *mainView,
58  QgsMessageBar *messageBar, int messagebarTimeout );
59 
64  void setFilterExpression( const QString &filterString,
66  bool alwaysShowFilter = false );
67 
68  public slots:
69  void filterShowAll();
70  void filterSelected();
71  void filterVisible();
72 
73 
74  private slots:
75 
77  void columnBoxInit();
78 
80  void storedFilterExpressionBoxInit();
82  void storeExpressionButtonInit();
83 
84  void filterExpressionBuilder();
85  void filterEdited();
86  void filterQueryChanged( const QString &query );
87  void filterQueryAccepted();
88 
92  void onFilterQueryTextChanged( const QString &value );
93 
98  void handleStoreFilterExpression();
99 
103  void saveAsStoredFilterExpression();
104 
109  void editStoredFilterExpression();
110 
115  void updateCurrentStoredFilterExpression( );
116 
117  void filterColumnChanged( QAction *filterAction );
118 
119  private:
120 
121  /* replace the search widget with a new one */
122  void replaceSearchWidget( QWidget *oldw, QWidget *neww );
123 
124  QMenu *mFilterColumnsMenu = nullptr;
125  QMenu *mStoredFilterExpressionMenu = nullptr;
126  QTimer mFilterQueryTimer;
127  QgsSearchWidgetWrapper *mCurrentSearchWidgetWrapper = nullptr;
128  QgsDualView *mMainView = nullptr;
129  QgsVectorLayer *mLayer = nullptr;
130  QgsAttributeEditorContext mEditorContext;
131  QgsMessageBar *mMessageBar = nullptr;
132  int mMessageBarTimeout = 0;
133 };
134 
135 #endif // QGSFEATUREFILTERWIDGET_P_H
136 
qgsattributeform.h
QgsSearchWidgetWrapper
Definition: qgssearchwidgetwrapper.h:85
QgsDualView
Definition: qgsdualview.h:41
QgsMessageBar
Definition: qgsmessagebar.h:60
QgsAttributeForm::FilterType
FilterType
Filter types.
Definition: qgsattributeform.h:63
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsAttributeEditorContext
Definition: qgsattributeeditorcontext.h:40
QgsAttributeForm::ReplaceFilter
@ ReplaceFilter
Filter should replace any existing filter.
Definition: qgsattributeform.h:65
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53