QGIS API Documentation  2.99.0-Master (9caa722)
Public Slots | Public Member Functions | List of all members
QgsQueryBuilder Class Reference

Query Builder for layers. More...

#include <qgsquerybuilder.h>

Inheritance diagram for QgsQueryBuilder:
Inheritance graph

Public Slots

void accept () override
void clear ()
void on_btnAnd_clicked ()
void on_btnEqual_clicked ()
void on_btnGetAllValues_clicked ()
 Get all distinct values for the field. More...
void on_btnGreaterEqual_clicked ()
void on_btnGreaterThan_clicked ()
void on_btnILike_clicked ()
void on_btnIn_clicked ()
void on_btnLessEqual_clicked ()
void on_btnLessThan_clicked ()
void on_btnLike_clicked ()
void on_btnNot_clicked ()
void on_btnNotEqual_clicked ()
void on_btnNotIn_clicked ()
void on_btnOr_clicked ()
void on_btnPct_clicked ()
void on_btnSampleValues_clicked ()
 Get sample distinct values for the selected field. More...
void on_lstFields_clicked (const QModelIndex &index)
void on_lstFields_doubleClicked (const QModelIndex &index)
void on_lstValues_doubleClicked (const QModelIndex &index)
void reject () override
void setDatasourceDescription (const QString &uri)
void setSql (const QString &sqlStatement)
QString sql ()
void test ()
 Test the constructed sql statement to see if the vector layer data provider likes it. More...

Public Member Functions

 QgsQueryBuilder (QgsVectorLayer *layer, QWidget *parent=0, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
 This constructor is used when the query builder is called from the vector layer properties dialog. More...
 ~QgsQueryBuilder ()
void showEvent (QShowEvent *event) override

Detailed Description

Query Builder for layers.

The query builder allows interactive creation of a SQL for limiting the features displayed in a vector layer. The fields in the table are displayed and sample values (or all values) can be viewed to aid in constructing the query. A test function returns the number of features that will be returned.

Definition at line 41 of file qgsquerybuilder.h.

Constructor & Destructor Documentation

◆ QgsQueryBuilder()

QgsQueryBuilder::QgsQueryBuilder ( QgsVectorLayer layer,
QWidget *  parent = 0,
Qt::WindowFlags  fl = QgsGuiUtils::ModalDialogFlags 

This constructor is used when the query builder is called from the vector layer properties dialog.

layerexisting vector layer
parentParent widget
fldialog flags

Definition at line 28 of file qgsquerybuilder.cpp.

◆ ~QgsQueryBuilder()

QgsQueryBuilder::~QgsQueryBuilder ( )

Definition at line 60 of file qgsquerybuilder.cpp.

Member Function Documentation

◆ accept

void QgsQueryBuilder::accept ( )

Definition at line 229 of file qgsquerybuilder.cpp.

◆ clear

void QgsQueryBuilder::clear ( )

Definition at line 383 of file qgsquerybuilder.cpp.

◆ on_btnAnd_clicked

void QgsQueryBuilder::on_btnAnd_clicked ( )

Definition at line 365 of file qgsquerybuilder.cpp.

◆ on_btnEqual_clicked

void QgsQueryBuilder::on_btnEqual_clicked ( )

Definition at line 261 of file qgsquerybuilder.cpp.

◆ on_btnGetAllValues_clicked

void QgsQueryBuilder::on_btnGetAllValues_clicked ( )

Get all distinct values for the field.

Values are inserted into the value list box

Definition at line 172 of file qgsquerybuilder.cpp.

◆ on_btnGreaterEqual_clicked

void QgsQueryBuilder::on_btnGreaterEqual_clicked ( )

Definition at line 353 of file qgsquerybuilder.cpp.

◆ on_btnGreaterThan_clicked

void QgsQueryBuilder::on_btnGreaterThan_clicked ( )

Definition at line 273 of file qgsquerybuilder.cpp.

◆ on_btnILike_clicked

void QgsQueryBuilder::on_btnILike_clicked ( )

Definition at line 390 of file qgsquerybuilder.cpp.

◆ on_btnIn_clicked

void QgsQueryBuilder::on_btnIn_clicked ( )

Definition at line 285 of file qgsquerybuilder.cpp.

◆ on_btnLessEqual_clicked

void QgsQueryBuilder::on_btnLessEqual_clicked ( )

Definition at line 347 of file qgsquerybuilder.cpp.

◆ on_btnLessThan_clicked

void QgsQueryBuilder::on_btnLessThan_clicked ( )

Definition at line 267 of file qgsquerybuilder.cpp.

◆ on_btnLike_clicked

void QgsQueryBuilder::on_btnLike_clicked ( )

Definition at line 297 of file qgsquerybuilder.cpp.

◆ on_btnNot_clicked

void QgsQueryBuilder::on_btnNot_clicked ( )

Definition at line 371 of file qgsquerybuilder.cpp.

◆ on_btnNotEqual_clicked

void QgsQueryBuilder::on_btnNotEqual_clicked ( )

Definition at line 359 of file qgsquerybuilder.cpp.

◆ on_btnNotIn_clicked

void QgsQueryBuilder::on_btnNotIn_clicked ( )

Definition at line 291 of file qgsquerybuilder.cpp.

◆ on_btnOr_clicked

void QgsQueryBuilder::on_btnOr_clicked ( )

Definition at line 377 of file qgsquerybuilder.cpp.

◆ on_btnPct_clicked

void QgsQueryBuilder::on_btnPct_clicked ( )

Definition at line 279 of file qgsquerybuilder.cpp.

◆ on_btnSampleValues_clicked

void QgsQueryBuilder::on_btnSampleValues_clicked ( )

Get sample distinct values for the selected field.

The sample size is limited to an arbitrary value (currently set to 25). The values are inserted into the values list box.

Definition at line 145 of file qgsquerybuilder.cpp.

◆ on_lstFields_clicked

void QgsQueryBuilder::on_lstFields_clicked ( const QModelIndex &  index)

Definition at line 313 of file qgsquerybuilder.cpp.

◆ on_lstFields_doubleClicked

void QgsQueryBuilder::on_lstFields_doubleClicked ( const QModelIndex &  index)

Definition at line 326 of file qgsquerybuilder.cpp.

◆ on_lstValues_doubleClicked

void QgsQueryBuilder::on_lstValues_doubleClicked ( const QModelIndex &  index)

Definition at line 332 of file qgsquerybuilder.cpp.

◆ reject

void QgsQueryBuilder::reject ( )

Definition at line 253 of file qgsquerybuilder.cpp.

◆ setDatasourceDescription

void QgsQueryBuilder::setDatasourceDescription ( const QString &  uri)

Definition at line 396 of file qgsquerybuilder.cpp.

◆ setSql

void QgsQueryBuilder::setSql ( const QString &  sqlStatement)

Definition at line 308 of file qgsquerybuilder.cpp.

◆ showEvent()

void QgsQueryBuilder::showEvent ( QShowEvent *  event)

Definition at line 66 of file qgsquerybuilder.cpp.

◆ sql

QString QgsQueryBuilder::sql ( )

Definition at line 303 of file qgsquerybuilder.cpp.

◆ test

void QgsQueryBuilder::test ( )

Test the constructed sql statement to see if the vector layer data provider likes it.

The number of rows that would be returned is displayed in a message box. The test uses a "select count(*) from ..." query to test the SQL statement.

Definition at line 199 of file qgsquerybuilder.cpp.

The documentation for this class was generated from the following files: