QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
qgssearchquerybuilder.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssearchquerybuilder.h - Query builder for search strings
3  ----------------------
4  begin : March 2006
5  copyright : (C) 2006 by Martin Dobias
6  email : wonder.sk at gmail 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 QGSSEARCHQUERYBUILDER_H
17 #define QGSSEARCHQUERYBUILDER_H
18 
19 #include <map>
20 #include <vector>
21 #include <QStandardItemModel>
22 #include <QModelIndex>
23 
24 #include "ui_qgsquerybuilderbase.h"
25 #include "qgsguiutils.h"
26 #include "qgis_gui.h"
27 
28 class QgsField;
29 class QgsVectorLayer;
30 
37 class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
38 {
39  Q_OBJECT
40 
41  public:
44  QWidget *parent SIP_TRANSFERTHIS = nullptr,
45  Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
46 
48  QString searchString();
49 
51  void setSearchString( const QString &searchString );
52 
53  public slots:
54 
55  void saveQuery();
56  void loadQuery();
57 
58  private slots:
59  void btnEqual_clicked();
60  void btnOk_clicked();
61  void btnLessThan_clicked();
62  void btnGreaterThan_clicked();
63  void btnLike_clicked();
64  void btnILike_clicked();
65  void btnPct_clicked();
66  void btnIn_clicked();
67  void btnNotIn_clicked();
68 
69  void lstFields_doubleClicked( const QModelIndex &index );
70  void lstValues_doubleClicked( const QModelIndex &index );
71  void btnLessEqual_clicked();
72  void btnGreaterEqual_clicked();
73  void btnNotEqual_clicked();
74  void btnAnd_clicked();
75  void btnNot_clicked();
76  void btnOr_clicked();
77  void btnClear_clicked();
78 
83  void btnTest_clicked();
84 
89  void btnGetAllValues_clicked();
90 
96  void btnSampleValues_clicked();
97 
98  private:
99 
103  void populateFields();
104 
108  void setupListViews();
109 
114  long countRecords( const QString &sql );
115 
120  void getFieldValues( int limit );
121 
125  void showHelp();
126 
127  private:
128 
130  QgsVectorLayer *mLayer = nullptr;
132  QMap<QString, int> mFieldMap;
134  QStandardItemModel *mModelFields = nullptr;
136  QStandardItemModel *mModelValues = nullptr;
137 };
138 #endif //QGSSEARCHQUERYBUILDER_H
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:51
Query Builder for search strings.
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53