QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 #include <QTimer>
38 
39 class QgsVectorLayer;
42 class QgsDualView;
43 class QgsMessageBar;
44 
49 class GUI_EXPORT QgsFeatureFilterWidget : public QWidget, private Ui::QgsFeatureFilterWidget
50 {
51  Q_OBJECT
52 
53  public:
54 
56  explicit QgsFeatureFilterWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
57 
58  void init( QgsVectorLayer *layer, const QgsAttributeEditorContext &context, QgsDualView *mainView,
59  QgsMessageBar *messageBar, int messagebarTimeout );
60 
65  void setFilterExpression( const QString &filterString,
67  bool alwaysShowFilter = false );
68 
69  public slots:
70  void filterShowAll();
71  void filterSelected();
72  void filterVisible();
73  void filterEdited();
74 
75 
76  private slots:
77 
79  void columnBoxInit();
80 
82  void storedFilterExpressionBoxInit();
84  void storeExpressionButtonInit();
85 
86  void filterExpressionBuilder();
87  void filterQueryChanged( const QString &query );
88  void filterQueryAccepted();
89 
93  void onFilterQueryTextChanged( const QString &value );
94 
99  void handleStoreFilterExpression();
100 
104  void saveAsStoredFilterExpression();
105 
110  void editStoredFilterExpression();
111 
116  void updateCurrentStoredFilterExpression( );
117 
118  void filterColumnChanged( QAction *filterAction );
119 
120  private:
121 
122  /* replace the search widget with a new one */
123  void replaceSearchWidget( QWidget *oldw, QWidget *neww );
124 
125  QMenu *mFilterColumnsMenu = nullptr;
126  QMenu *mStoredFilterExpressionMenu = nullptr;
127  QTimer mFilterQueryTimer;
128  QgsSearchWidgetWrapper *mCurrentSearchWidgetWrapper = nullptr;
129  QgsDualView *mMainView = nullptr;
130  QgsVectorLayer *mLayer = nullptr;
131  QgsAttributeEditorContext mEditorContext;
132  QgsMessageBar *mMessageBar = nullptr;
133 };
134 
135 #endif // QGSFEATUREFILTERWIDGET_P_H
136 
This class contains context information for attribute editor widgets.
FilterType
Filter types.
@ ReplaceFilter
Filter should replace any existing filter.
This widget is used to show the attributes of a set of features of a QgsVectorLayer.
Definition: qgsdualview.h:45
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
Shows a search widget on a filter form.
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53