QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
39class QgsVectorLayer;
42class QgsDualView;
43class QgsMessageBar;
44
49class 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 filterInvalid();
73 void filterVisible();
74 void filterEdited();
75
76
77 private slots:
78
80 void columnBoxInit();
81
83 void storedFilterExpressionBoxInit();
85 void storeExpressionButtonInit();
86
87 void filterExpressionBuilder();
88 void filterQueryChanged( const QString &query );
89 void filterQueryAccepted();
90
94 void onFilterQueryTextChanged( const QString &value );
95
100 void handleStoreFilterExpression();
101
105 void saveAsStoredFilterExpression();
106
111 void editStoredFilterExpression();
112
117 void updateCurrentStoredFilterExpression( );
118
119 void filterColumnChanged( QAction *filterAction );
120
121 private:
122
123 /* replace the search widget with a new one */
124 void replaceSearchWidget( QWidget *oldw, QWidget *neww );
125
126 QMenu *mFilterColumnsMenu = nullptr;
127 QMenu *mStoredFilterExpressionMenu = nullptr;
128 QTimer mFilterQueryTimer;
129 QgsSearchWidgetWrapper *mCurrentSearchWidgetWrapper = nullptr;
130 QgsDualView *mMainView = nullptr;
131 QgsVectorLayer *mLayer = nullptr;
132 QgsAttributeEditorContext mEditorContext;
133 QgsMessageBar *mMessageBar = nullptr;
134};
135
136#endif // QGSFEATUREFILTERWIDGET_P_H
137
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