Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 /* $Id$ */
16 
17 #ifndef QGSSEARCHQUERYBUILDER_H
18 #define QGSSEARCHQUERYBUILDER_H
19 
20 #include <map>
21 #include <vector>
22 #include <QStandardItemModel>
23 #include <QModelIndex>
24 
25 #include "ui_qgsquerybuilderbase.h"
26 #include "qgisgui.h"
27 #include "qgscontexthelp.h"
28 
29 class QgsField;
30 class QgsVectorLayer;
31 
37 class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
38 {
39  Q_OBJECT
40 
41  public:
43  QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = 0,
44  Qt::WFlags fl = QgisGui::ModalDialogFlags );
45 
47 
49  QString searchString();
50 
52  void setSearchString( QString searchString );
53 
54  public slots:
55  void on_btnEqual_clicked();
56  void on_btnOk_clicked();
57  void on_btnLessThan_clicked();
58  void on_btnGreaterThan_clicked();
59  void on_btnLike_clicked();
60  void on_btnILike_clicked();
61  void on_btnPct_clicked();
62  void on_btnIn_clicked();
63  void on_btnNotIn_clicked();
64 
65  void on_lstFields_doubleClicked( const QModelIndex &index );
66  void on_lstValues_doubleClicked( const QModelIndex &index );
67  void on_btnLessEqual_clicked();
68  void on_btnGreaterEqual_clicked();
69  void on_btnNotEqual_clicked();
70  void on_btnAnd_clicked();
71  void on_btnNot_clicked();
72  void on_btnOr_clicked();
73  void on_btnClear_clicked();
74 
78  void on_btnTest_clicked();
79 
84  void on_btnGetAllValues_clicked();
85 
91  void on_btnSampleValues_clicked();
92 
93  void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
94 
95  void saveQuery();
96  void loadQuery();
97 
98  private:
99 
103  void populateFields();
107  void setupListViews();
108 
112  long countRecords( QString sql );
113 
118  void getFieldValues( int limit );
119 
120  private:
121 
125  QMap<QString, int> mFieldMap;
127  QStandardItemModel *mModelFields;
129  QStandardItemModel *mModelValues;
130 };
131 #endif //QGSSEARCHQUERYBUILDER_H