QGIS API Documentation  2.99.0-Master (9f5e33a)
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 "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:
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  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 
91  void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
92 
93  void saveQuery();
94  void loadQuery();
95 
96  private:
97 
101  void populateFields();
102 
106  void setupListViews();
107 
111  long countRecords( const QString &sql );
112 
117  void getFieldValues( int limit );
118 
119  private:
120 
122  QgsVectorLayer *mLayer = nullptr;
124  QMap<QString, int> mFieldMap;
126  QStandardItemModel *mModelFields = nullptr;
128  QStandardItemModel *mModelValues = nullptr;
129 };
130 #endif //QGSSEARCHQUERYBUILDER_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:34
Query Builder for search strings.
static void run(const QString &context)
Encapsulate a field in an attribute table or data source.
Definition: qgsfield.h:46
Represents a vector layer which manages a vector based data sets.