QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 
36 class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
37 {
38  Q_OBJECT
39 
40  public:
43  QWidget *parent SIP_TRANSFERTHIS = nullptr,
44  Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
45 
47  QString searchString();
48 
50  void setSearchString( const QString &searchString );
51 
52  public slots:
53 
54  void saveQuery();
55  void loadQuery();
56 
57  private slots:
58  void btnEqual_clicked();
59  void btnOk_clicked();
60  void btnLessThan_clicked();
61  void btnGreaterThan_clicked();
62  void btnLike_clicked();
63  void btnILike_clicked();
64  void btnPct_clicked();
65  void btnIn_clicked();
66  void btnNotIn_clicked();
67 
68  void lstFields_doubleClicked( const QModelIndex &index );
69  void lstValues_doubleClicked( const QModelIndex &index );
70  void btnLessEqual_clicked();
71  void btnGreaterEqual_clicked();
72  void btnNotEqual_clicked();
73  void btnAnd_clicked();
74  void btnNot_clicked();
75  void btnOr_clicked();
76  void btnClear_clicked();
77 
82  void btnTest_clicked();
83 
88  void btnGetAllValues_clicked();
89 
95  void btnSampleValues_clicked();
96 
97  private:
98 
102  void populateFields();
103 
107  void setupListViews();
108 
113  long countRecords( const QString &sql );
114 
119  void getFieldValues( int limit );
120 
124  void showHelp();
125 
126  private:
127 
129  QgsVectorLayer *mLayer = nullptr;
131  QMap<QString, int> mFieldMap;
133  QStandardItemModel *mModelFields = nullptr;
135  QStandardItemModel *mModelValues = nullptr;
136 };
137 #endif //QGSSEARCHQUERYBUILDER_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
Query Builder for search strings.
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:48
Represents a vector layer which manages a vector based data sets.