QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
28 class QgsField;
29 class QgsVectorLayer;
30 
35 class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
36 {
37  Q_OBJECT
38 
39  public:
41  QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = nullptr,
43 
45 
47  QString searchString();
48 
50  void setSearchString( const QString& searchString );
51 
52  public slots:
53  void on_btnEqual_clicked();
54  void on_btnOk_clicked();
55  void on_btnLessThan_clicked();
56  void on_btnGreaterThan_clicked();
57  void on_btnLike_clicked();
58  void on_btnILike_clicked();
59  void on_btnPct_clicked();
60  void on_btnIn_clicked();
61  void on_btnNotIn_clicked();
62 
63  void on_lstFields_doubleClicked( const QModelIndex &index );
64  void on_lstValues_doubleClicked( const QModelIndex &index );
65  void on_btnLessEqual_clicked();
66  void on_btnGreaterEqual_clicked();
67  void on_btnNotEqual_clicked();
68  void on_btnAnd_clicked();
69  void on_btnNot_clicked();
70  void on_btnOr_clicked();
71  void on_btnClear_clicked();
72 
76  void on_btnTest_clicked();
77 
82  void on_btnGetAllValues_clicked();
83 
89  void on_btnSampleValues_clicked();
90 
92 
93  void saveQuery();
94  void loadQuery();
95 
96  private:
97 
101  void populateFields();
105  void setupListViews();
106 
110  long countRecords( const QString& sql );
111 
116  void getFieldValues( int limit );
117 
118  private:
119 
121  QgsVectorLayer* mLayer;
123  QMap<QString, int> mFieldMap;
125  QStandardItemModel *mModelFields;
127  QStandardItemModel *mModelValues;
128 };
129 #endif //QGSSEARCHQUERYBUILDER_H
const char * className() const
static const Qt::WindowFlags ModalDialogFlags
Definition: qgisgui.h:50
static unsigned index
Query Builder for search strings.
virtual const QMetaObject * metaObject() const
static void run(const QString &context)
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:44
typedef WindowFlags
Represents a vector layer which manages a vector based data sets.