QGIS API Documentation  2.99.0-Master (9ed189e)
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 "qgisgui.h"
26 #include "qgscontexthelp.h"
27 #include "qgis_gui.h"
28 
29 class QgsField;
30 class QgsVectorLayer;
31 
36 class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
37 {
38  Q_OBJECT
39 
40  public:
42  QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = nullptr,
43  Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
44 
46  QString searchString();
47 
49  void setSearchString( const QString& searchString );
50 
51  public slots:
52  void on_btnEqual_clicked();
53  void on_btnOk_clicked();
54  void on_btnLessThan_clicked();
55  void on_btnGreaterThan_clicked();
56  void on_btnLike_clicked();
57  void on_btnILike_clicked();
58  void on_btnPct_clicked();
59  void on_btnIn_clicked();
60  void on_btnNotIn_clicked();
61 
62  void on_lstFields_doubleClicked( const QModelIndex &index );
63  void on_lstValues_doubleClicked( const QModelIndex &index );
64  void on_btnLessEqual_clicked();
65  void on_btnGreaterEqual_clicked();
66  void on_btnNotEqual_clicked();
67  void on_btnAnd_clicked();
68  void on_btnNot_clicked();
69  void on_btnOr_clicked();
70  void on_btnClear_clicked();
71 
75  void on_btnTest_clicked();
76 
81  void on_btnGetAllValues_clicked();
82 
88  void on_btnSampleValues_clicked();
89 
90  void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
91 
92  void saveQuery();
93  void loadQuery();
94 
95  private:
96 
100  void populateFields();
104  void setupListViews();
105 
109  long countRecords( const QString& sql );
110 
115  void getFieldValues( int limit );
116 
117  private:
118 
120  QgsVectorLayer* mLayer = nullptr;
122  QMap<QString, int> mFieldMap;
124  QStandardItemModel *mModelFields = nullptr;
126  QStandardItemModel *mModelValues = nullptr;
127 };
128 #endif //QGSSEARCHQUERYBUILDER_H
static const Qt::WindowFlags ModalDialogFlags
Definition: qgisgui.h:51
static unsigned index
Query Builder for search strings.
static void run(const QString &context)
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:45
Represents a vector layer which manages a vector based data sets.