QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 = nullptr,
52 
53  ~QgsQueryBuilder();
54 
55  void showEvent( QShowEvent *event ) override;
56 
57  public slots:
58  void accept() override;
59  void reject() override;
60  void clear();
61  void on_btnEqual_clicked();
62  void on_btnLessThan_clicked();
63  void on_btnGreaterThan_clicked();
64  void on_btnPct_clicked();
65  void on_btnIn_clicked();
66  void on_btnNotIn_clicked();
67  void on_btnLike_clicked();
68  void on_btnILike_clicked();
69  QString sql();
70  void setSql( const QString& sqlStatement );
71  void on_lstFields_clicked( const QModelIndex &index );
72  void on_lstFields_doubleClicked( const QModelIndex &index );
73  void on_lstValues_doubleClicked( const QModelIndex &index );
74  void on_btnLessEqual_clicked();
75  void on_btnGreaterEqual_clicked();
76  void on_btnNotEqual_clicked();
77  void on_btnAnd_clicked();
78  void on_btnNot_clicked();
79  void on_btnOr_clicked();
80 
82 
88  void test();
93  void on_btnGetAllValues_clicked();
99  void on_btnSampleValues_clicked();
100 
101  void setDatasourceDescription( const QString& uri );
102 
103  private:
107  void populateFields();
108 
112  void setupGuiViews();
113  void setupLstFieldsModel();
114  void fillValues( int idx, int limit );
115 
116  // private members
118  QStandardItemModel *mModelFields;
120  QStandardItemModel *mModelValues;
122  int mPreviousFieldRow;
123 
125  QgsVectorLayer *mLayer;
126 
128  QString mOrigSubsetString;
129 };
130 #endif //QGSQUERYBUILDER_H
const char * className() const
static const Qt::WindowFlags ModalDialogFlags
Definition: qgisgui.h:50
static unsigned index
virtual void reject()
virtual const QMetaObject * metaObject() const
static void run(const QString &context)
virtual void accept()
void on_buttonBox_helpRequested()
Query Builder for layers.
virtual void showEvent(QShowEvent *event)
typedef WindowFlags
Represents a vector layer which manages a vector based data sets.