QGIS API Documentation  2.99.0-Master (b698612)
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 
41 class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
42 {
43  Q_OBJECT
44  public:
45 
52  QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent SIP_TRANSFERTHIS = 0,
53  Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
54 
55  ~QgsQueryBuilder();
56 
57  void showEvent( QShowEvent *event ) override;
58 
59  public slots:
60  void accept() override;
61  void reject() override;
62  void clear();
63  void on_btnEqual_clicked();
64  void on_btnLessThan_clicked();
65  void on_btnGreaterThan_clicked();
66  void on_btnPct_clicked();
67  void on_btnIn_clicked();
68  void on_btnNotIn_clicked();
69  void on_btnLike_clicked();
70  void on_btnILike_clicked();
71  QString sql();
72  void setSql( const QString &sqlStatement );
73  void on_lstFields_clicked( const QModelIndex &index );
74  void on_lstFields_doubleClicked( const QModelIndex &index );
75  void on_lstValues_doubleClicked( const QModelIndex &index );
76  void on_btnLessEqual_clicked();
77  void on_btnGreaterEqual_clicked();
78  void on_btnNotEqual_clicked();
79  void on_btnAnd_clicked();
80  void on_btnNot_clicked();
81  void on_btnOr_clicked();
82 
83  void on_buttonBox_helpRequested() { QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#query-builder" ) ); }
84 
90  void test();
91 
96  void on_btnGetAllValues_clicked();
97 
103  void on_btnSampleValues_clicked();
104 
105  void setDatasourceDescription( const QString &uri );
106 
107  private:
108 
112  void populateFields();
113 
117  void setupGuiViews();
118  void setupLstFieldsModel();
119  void fillValues( int idx, int limit );
120 
121  // private members
123  QStandardItemModel *mModelFields = nullptr;
125  QStandardItemModel *mModelValues = nullptr;
127  int mPreviousFieldRow;
128 
130  QgsVectorLayer *mLayer = nullptr;
131 
133  QString mOrigSubsetString;
134 };
135 #endif //QGSQUERYBUILDER_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:34
void on_buttonBox_helpRequested()
Query Builder for layers.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition: qgshelp.cpp:34
Represents a vector layer which manages a vector based data sets.