QgsQueryBuilder class

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.

Constructors, destructors, conversion operators

QgsQueryBuilder(QgsVectorLayer* layer, QWidget* parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags)
This constructor is used when the query builder is called from the vector layer properties dialog.

Public slots

void test()
Test the constructed sql statement to see if the vector layer data provider likes it.

Function documentation

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

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

Parameters
layer existing vector layer
parent Parent widget
fl dialog flags

void QgsQueryBuilder::test() public slot

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.