QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
36 class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
37 {
38  Q_OBJECT
39 
40  public:
42  QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = 0,
43  Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
44 
46 
48  QString searchString();
49 
51  void setSearchString( QString searchString );
52 
53  public slots:
54  void on_btnEqual_clicked();
55  void on_btnOk_clicked();
56  void on_btnLessThan_clicked();
57  void on_btnGreaterThan_clicked();
58  void on_btnLike_clicked();
59  void on_btnILike_clicked();
60  void on_btnPct_clicked();
61  void on_btnIn_clicked();
62  void on_btnNotIn_clicked();
63 
64  void on_lstFields_doubleClicked( const QModelIndex &index );
65  void on_lstValues_doubleClicked( const QModelIndex &index );
66  void on_btnLessEqual_clicked();
67  void on_btnGreaterEqual_clicked();
68  void on_btnNotEqual_clicked();
69  void on_btnAnd_clicked();
70  void on_btnNot_clicked();
71  void on_btnOr_clicked();
72  void on_btnClear_clicked();
73 
77  void on_btnTest_clicked();
78 
83  void on_btnGetAllValues_clicked();
84 
90  void on_btnSampleValues_clicked();
91 
92  void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
93 
94  void saveQuery();
95  void loadQuery();
96 
97  private:
98 
102  void populateFields();
106  void setupListViews();
107 
111  long countRecords( QString sql );
112 
117  void getFieldValues( int limit );
118 
119  private:
120 
122  QgsVectorLayer* mLayer;
124  QMap<QString, int> mFieldMap;
126  QStandardItemModel *mModelFields;
128  QStandardItemModel *mModelValues;
129 };
130 #endif //QGSSEARCHQUERYBUILDER_H