QGIS API Documentation  2.99.0-Master (5d67572)
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 "qgis.h"
19 #include <vector>
20 #include <QStandardItemModel>
21 #include <QStandardItem>
22 #include <QModelIndex>
23 #include "ui_qgsquerybuilderbase.h"
24 #include "qgsguiutils.h"
25 #include "qgshelp.h"
26 #include "qgis_gui.h"
27 
28 class QgsVectorLayer;
29 
42 class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
43 {
44  Q_OBJECT
45  public:
46 
54  QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent SIP_TRANSFERTHIS = 0,
55  Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
56 
57  ~QgsQueryBuilder();
58 
59  void showEvent( QShowEvent *event ) override;
60 
61  QString sql();
62  void setSql( const QString &sqlStatement );
63 
64  public slots:
65  void accept() override;
66  void reject() override;
67  void clear();
68 
75  void test();
76 
77  void setDatasourceDescription( const QString &uri );
78 
79  private slots:
80  void btnEqual_clicked();
81  void btnLessThan_clicked();
82  void btnGreaterThan_clicked();
83  void btnPct_clicked();
84  void btnIn_clicked();
85  void btnNotIn_clicked();
86  void btnLike_clicked();
87  void btnILike_clicked();
88  void lstFields_clicked( const QModelIndex &index );
89  void lstFields_doubleClicked( const QModelIndex &index );
90  void lstValues_doubleClicked( const QModelIndex &index );
91  void btnLessEqual_clicked();
92  void btnGreaterEqual_clicked();
93  void btnNotEqual_clicked();
94  void btnAnd_clicked();
95  void btnNot_clicked();
96  void btnOr_clicked();
97 
102  void btnGetAllValues_clicked();
103 
109  void btnSampleValues_clicked();
110 
111  private:
112 
116  void populateFields();
117 
118  void showHelp();
119 
123  void setupGuiViews();
124  void setupLstFieldsModel();
125  void fillValues( int idx, int limit );
126 
127  // private members
129  QStandardItemModel *mModelFields = nullptr;
131  QStandardItemModel *mModelValues = nullptr;
133  int mPreviousFieldRow;
134 
136  QgsVectorLayer *mLayer = nullptr;
137 
139  QString mOrigSubsetString;
140 };
141 #endif //QGSQUERYBUILDER_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
Query Builder for layers.
Represents a vector layer which manages a vector based data sets.