QGIS API Documentation
2.0.1-Dufour
|
Query Builder for layers. More...
#include <qgsquerybuilder.h>
Public Slots | |
void | accept () |
void | reject () |
void | clear () |
void | on_btnEqual_clicked () |
void | on_btnLessThan_clicked () |
void | on_btnGreaterThan_clicked () |
void | on_btnPct_clicked () |
void | on_btnIn_clicked () |
void | on_btnNotIn_clicked () |
void | on_btnLike_clicked () |
void | on_btnILike_clicked () |
QString | sql () |
void | setSql (QString sqlStatement) |
void | on_lstFields_clicked (const QModelIndex &index) |
void | on_lstFields_doubleClicked (const QModelIndex &index) |
void | on_lstValues_doubleClicked (const QModelIndex &index) |
void | on_btnLessEqual_clicked () |
void | on_btnGreaterEqual_clicked () |
void | on_btnNotEqual_clicked () |
void | on_btnAnd_clicked () |
void | on_btnNot_clicked () |
void | on_btnOr_clicked () |
void | on_buttonBox_helpRequested () |
void | test () |
void | on_btnGetAllValues_clicked () |
void | on_btnSampleValues_clicked () |
void | setDatasourceDescription (QString uri) |
Public Member Functions | |
QgsQueryBuilder (QgsVectorLayer *layer, QWidget *parent=0, Qt::WFlags fl=QgisGui::ModalDialogFlags) | |
~QgsQueryBuilder () |
Private Member Functions | |
void | populateFields () |
void | setupGuiViews () |
void | setupLstFieldsModel () |
void | fillValues (int idx, int limit) |
Private Attributes | |
QStandardItemModel * | mModelFields |
Model for fields ListView. | |
QStandardItemModel * | mModelValues |
Model for values ListView. | |
int | mPreviousFieldRow |
Previous field row to delete model. | |
QgsVectorLayer * | mLayer |
vector layer | |
QString | mOrigSubsetString |
original subset string |
Query Builder for layers.
The query builder allows interactive creation of a SQL for limiting the features displayed in a database 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 40 of file qgsquerybuilder.h.
QgsQueryBuilder::QgsQueryBuilder | ( | QgsVectorLayer * | layer, |
QWidget * | parent = 0 , |
||
Qt::WFlags | fl = QgisGui::ModalDialogFlags |
||
) |
This constructor is used when the query builder is called from the vector layer properties dialog
layer | existing vector layer |
parent | Parent widget |
fl | dialog flags |
Definition at line 27 of file qgsquerybuilder.cpp.
References clear(), mLayer, mOrigSubsetString, QgsMapLayer::name(), populateFields(), setupGuiViews(), QgsVectorLayer::subsetString(), test(), and tr.
QgsQueryBuilder::~QgsQueryBuilder | ( | ) |
Definition at line 58 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 218 of file qgsquerybuilder.cpp.
References QgsVectorDataProvider::clearErrors(), QgsVectorLayer::dataProvider(), QgsVectorDataProvider::errors(), QgsVectorDataProvider::hasErrors(), mLayer, QgsVectorLayer::setSubsetString(), and tr.
|
slot |
Definition at line 372 of file qgsquerybuilder.cpp.
References mLayer, and QgsVectorLayer::setSubsetString().
Referenced by QgsQueryBuilder().
|
private |
Definition at line 102 of file qgsquerybuilder.cpp.
References isNull(), mLayer, mModelValues, QgsVectorLayer::providerType(), QgsDebugMsg, QgsVectorLayer::storageType(), and QgsVectorLayer::uniqueValues().
Referenced by on_btnGetAllValues_clicked(), and on_btnSampleValues_clicked().
|
slot |
Definition at line 354 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 250 of file qgsquerybuilder.cpp.
|
slot |
Get all distinct values for the field. Values are inserted into the value list box
Definition at line 161 of file qgsquerybuilder.cpp.
References fillValues(), mLayer, mModelFields, mModelValues, QgsVectorLayer::setSubsetString(), and QgsVectorLayer::subsetString().
|
slot |
Definition at line 342 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 262 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 379 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 274 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 336 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 256 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 286 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 360 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 348 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 280 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 366 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 268 of file qgsquerybuilder.cpp.
|
slot |
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 134 of file qgsquerybuilder.cpp.
References fillValues(), mLayer, mModelFields, mModelValues, QgsVectorLayer::setSubsetString(), and QgsVectorLayer::subsetString().
|
inlineslot |
Definition at line 79 of file qgsquerybuilder.h.
References QgsContextHelp::run().
|
slot |
Definition at line 302 of file qgsquerybuilder.cpp.
References mModelValues, and mPreviousFieldRow.
|
slot |
Definition at line 315 of file qgsquerybuilder.cpp.
References mLayer, mModelFields, and QgsVectorLayer::pendingFields().
|
slot |
Definition at line 321 of file qgsquerybuilder.cpp.
References mLayer, mModelValues, QgsVectorLayer::providerType(), and QgsVectorLayer::storageType().
|
private |
Populate the field list for the selected table
Definition at line 64 of file qgsquerybuilder.cpp.
References QgsFields::count(), mLayer, mModelFields, QgsVectorLayer::pendingFields(), and setupLstFieldsModel().
Referenced by QgsQueryBuilder().
|
slot |
Definition at line 242 of file qgsquerybuilder.cpp.
References mLayer, mOrigSubsetString, QgsVectorLayer::setSubsetString(), and QgsVectorLayer::subsetString().
|
slot |
Definition at line 385 of file qgsquerybuilder.cpp.
|
slot |
Definition at line 297 of file qgsquerybuilder.cpp.
|
private |
Setup models for listviews
Definition at line 84 of file qgsquerybuilder.cpp.
References mModelFields, and mModelValues.
Referenced by QgsQueryBuilder().
|
private |
Definition at line 79 of file qgsquerybuilder.cpp.
References mModelFields.
Referenced by populateFields().
|
slot |
Definition at line 292 of file qgsquerybuilder.cpp.
|
slot |
Test the constructed sql statement to see if the database 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 188 of file qgsquerybuilder.cpp.
References QgsVectorDataProvider::clearErrors(), QgsVectorLayer::dataProvider(), QgsVectorDataProvider::errors(), QgsVectorLayer::featureCount(), QgsVectorDataProvider::hasErrors(), mLayer, QgsVectorLayer::setSubsetString(), QgsVectorLayer::subsetString(), and tr.
Referenced by QgsQueryBuilder().
|
private |
vector layer
Definition at line 123 of file qgsquerybuilder.h.
Referenced by accept(), clear(), fillValues(), on_btnGetAllValues_clicked(), on_btnSampleValues_clicked(), on_lstFields_doubleClicked(), on_lstValues_doubleClicked(), populateFields(), QgsQueryBuilder(), reject(), and test().
|
private |
Model for fields ListView.
Definition at line 116 of file qgsquerybuilder.h.
Referenced by on_btnGetAllValues_clicked(), on_btnSampleValues_clicked(), on_lstFields_doubleClicked(), populateFields(), setupGuiViews(), and setupLstFieldsModel().
|
private |
Model for values ListView.
Definition at line 118 of file qgsquerybuilder.h.
Referenced by fillValues(), on_btnGetAllValues_clicked(), on_btnSampleValues_clicked(), on_lstFields_clicked(), on_lstValues_doubleClicked(), and setupGuiViews().
|
private |
original subset string
Definition at line 126 of file qgsquerybuilder.h.
Referenced by QgsQueryBuilder(), and reject().
|
private |
Previous field row to delete model.
Definition at line 120 of file qgsquerybuilder.h.
Referenced by on_lstFields_clicked().