QGIS API Documentation  2.99.0-Master (cb63e82)
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 "qgshelp.h"
25 #include "qgis_gui.h"
26 
27 class QgsVectorLayer;
28 
40 class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
41 {
42  Q_OBJECT
43  public:
44 
51  QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent = nullptr,
52  Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
53 
54  ~QgsQueryBuilder();
55 
56  void showEvent( QShowEvent *event ) override;
57 
58  public slots:
59  void accept() override;
60  void reject() override;
61  void clear();
62  void on_btnEqual_clicked();
63  void on_btnLessThan_clicked();
64  void on_btnGreaterThan_clicked();
65  void on_btnPct_clicked();
66  void on_btnIn_clicked();
67  void on_btnNotIn_clicked();
68  void on_btnLike_clicked();
69  void on_btnILike_clicked();
70  QString sql();
71  void setSql( const QString &sqlStatement );
72  void on_lstFields_clicked( const QModelIndex &index );
73  void on_lstFields_doubleClicked( const QModelIndex &index );
74  void on_lstValues_doubleClicked( const QModelIndex &index );
75  void on_btnLessEqual_clicked();
76  void on_btnGreaterEqual_clicked();
77  void on_btnNotEqual_clicked();
78  void on_btnAnd_clicked();
79  void on_btnNot_clicked();
80  void on_btnOr_clicked();
81 
82  void on_buttonBox_helpRequested() { QgsHelp::openHelp( QStringLiteral( "working_with_vector/vector_properties.html#query-builder" ) ); }
83 
89  void test();
90 
95  void on_btnGetAllValues_clicked();
96 
102  void on_btnSampleValues_clicked();
103 
104  void setDatasourceDescription( const QString &uri );
105 
106  private:
107 
111  void populateFields();
112 
116  void setupGuiViews();
117  void setupLstFieldsModel();
118  void fillValues( int idx, int limit );
119 
120  // private members
122  QStandardItemModel *mModelFields = nullptr;
124  QStandardItemModel *mModelValues = nullptr;
126  int mPreviousFieldRow;
127 
129  QgsVectorLayer *mLayer = nullptr;
130 
132  QString mOrigSubsetString;
133 };
134 #endif //QGSQUERYBUILDER_H
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.