QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsquerybuilder.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsquerybuilder.h - query builder
3  --------------------------------------
4  Date : 2004-11-19
5  Copyright : (C) 2004 by Gary E.Sherman
6  Email : sherman at mrcc.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 #ifndef QGSQUERYBUILDER_H
16 #define QGSQUERYBUILDER_H
17 #include <map>
18 #include <vector>
19 #include <QStandardItemModel>
20 #include <QStandardItem>
21 #include <QModelIndex>
22 #include "ui_qgsquerybuilderbase.h"
23 #include "qgisgui.h"
24 #include "qgsfield.h"
25 #include "qgscontexthelp.h"
26 
27 class QgsVectorLayer;
28 
40 class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
41 {
42  Q_OBJECT
43  public:
50  QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent = 0,
51  Qt::WFlags fl = QgisGui::ModalDialogFlags );
52 
53  ~QgsQueryBuilder();
54 
55  public slots:
56  void accept();
57  void reject();
58  void clear();
59  void on_btnEqual_clicked();
60  void on_btnLessThan_clicked();
61  void on_btnGreaterThan_clicked();
62  void on_btnPct_clicked();
63  void on_btnIn_clicked();
64  void on_btnNotIn_clicked();
65  void on_btnLike_clicked();
66  void on_btnILike_clicked();
67  QString sql();
68  void setSql( QString sqlStatement );
69  void on_lstFields_clicked( const QModelIndex &index );
70  void on_lstFields_doubleClicked( const QModelIndex &index );
71  void on_lstValues_doubleClicked( const QModelIndex &index );
72  void on_btnLessEqual_clicked();
73  void on_btnGreaterEqual_clicked();
74  void on_btnNotEqual_clicked();
75  void on_btnAnd_clicked();
76  void on_btnNot_clicked();
77  void on_btnOr_clicked();
78 
79  void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
80 
86  void test();
91  void on_btnGetAllValues_clicked();
97  void on_btnSampleValues_clicked();
98 
99  void setDatasourceDescription( QString uri );
100 
101  private:
105  void populateFields();
106 
110  void setupGuiViews();
111  void setupLstFieldsModel();
112  void fillValues( int idx, int limit );
113 
114  // private members
116  QStandardItemModel *mModelFields;
118  QStandardItemModel *mModelValues;
121 
124 
127 };
128 #endif //QGSQUERYBUILDER_H