QGIS API Documentation
2.0.1-Dufour
|
Query Builder for search strings. More...
#include <qgssearchquerybuilder.h>
Public Slots | |
void | on_btnEqual_clicked () |
void | on_btnOk_clicked () |
void | on_btnLessThan_clicked () |
void | on_btnGreaterThan_clicked () |
void | on_btnLike_clicked () |
void | on_btnILike_clicked () |
void | on_btnPct_clicked () |
void | on_btnIn_clicked () |
void | on_btnNotIn_clicked () |
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_btnClear_clicked () |
void | on_btnTest_clicked () |
void | on_btnGetAllValues_clicked () |
void | on_btnSampleValues_clicked () |
void | on_buttonBox_helpRequested () |
void | saveQuery () |
void | loadQuery () |
Public Member Functions | |
QgsSearchQueryBuilder (QgsVectorLayer *layer, QWidget *parent=0, Qt::WFlags fl=QgisGui::ModalDialogFlags) | |
Constructor - takes pointer to vector layer as a parameter. | |
~QgsSearchQueryBuilder () | |
QString | searchString () |
returns newly created search string | |
void | setSearchString (QString searchString) |
change search string shown in text field |
Private Member Functions | |
void | populateFields () |
void | setupListViews () |
long | countRecords (QString sql) |
void | getFieldValues (int limit) |
Private Attributes | |
QgsVectorLayer * | mLayer |
Layer for which is the query builder opened. | |
QMap< QString, int > | mFieldMap |
Map that holds field information, keyed by field name. | |
QStandardItemModel * | mModelFields |
Model for fields ListView. | |
QStandardItemModel * | mModelValues |
Model for values ListView. |
Query Builder for search strings.
Definition at line 36 of file qgssearchquerybuilder.h.
QgsSearchQueryBuilder::QgsSearchQueryBuilder | ( | QgsVectorLayer * | layer, |
QWidget * | parent = 0 , |
||
Qt::WFlags | fl = QgisGui::ModalDialogFlags |
||
) |
Constructor - takes pointer to vector layer as a parameter.
Definition at line 33 of file qgssearchquerybuilder.cpp.
References loadQuery(), QgsMapLayer::name(), on_btnClear_clicked(), on_btnTest_clicked(), populateFields(), saveQuery(), setupListViews(), and tr.
QgsSearchQueryBuilder::~QgsSearchQueryBuilder | ( | ) |
Definition at line 65 of file qgssearchquerybuilder.cpp.
|
private |
Get the number of records that would be returned by the current SQL
Definition at line 186 of file qgssearchquerybuilder.cpp.
References QgsExpression::evalErrorString(), QgsExpression::evaluate(), QgsVectorLayer::getFeatures(), QgsExpression::hasEvalError(), QgsExpression::hasParserError(), mLayer, QgsExpression::needsGeometry(), QgsFeatureIterator::nextFeature(), QgsFeatureRequest::NoFlags, QgsFeatureRequest::NoGeometry, QgsExpression::parserErrorString(), QgsVectorLayer::pendingFields(), QgsExpression::prepare(), and tr.
Referenced by on_btnOk_clicked(), and on_btnTest_clicked().
|
private |
populates list box with values of selected field
limit | if not zero, inserts only this count of values |
MH: keep already inserted values in a set. Querying is much faster compared to QStandardItemModel::findItems
Definition at line 105 of file qgssearchquerybuilder.cpp.
References QgsFeature::attribute(), QgsVectorLayer::getFeatures(), mFieldMap, mLayer, mModelFields, mModelValues, QgsFeatureIterator::nextFeature(), QgsFeatureRequest::NoGeometry, QgsVectorLayer::pendingFields(), and QgsField::type().
Referenced by on_btnGetAllValues_clicked(), and on_btnSampleValues_clicked().
|
slot |
Definition at line 396 of file qgssearchquerybuilder.cpp.
References QgsExpression::hasParserError(), mFieldMap, QgsExpression::parserErrorString(), and tr.
Referenced by QgsSearchQueryBuilder().
|
slot |
Definition at line 335 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 350 of file qgssearchquerybuilder.cpp.
Referenced by QgsSearchQueryBuilder().
|
slot |
Definition at line 265 of file qgssearchquerybuilder.cpp.
|
slot |
Get all distinct values for the field. Values are inserted into the value list box
Definition at line 169 of file qgssearchquerybuilder.cpp.
References getFieldValues().
|
slot |
Definition at line 325 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 275 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 355 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 285 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 320 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 270 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 295 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 340 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 330 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 290 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 239 of file qgssearchquerybuilder.cpp.
References countRecords(), and tr.
|
slot |
Definition at line 345 of file qgssearchquerybuilder.cpp.
|
slot |
Definition at line 280 of file qgssearchquerybuilder.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 164 of file qgssearchquerybuilder.cpp.
References getFieldValues().
|
slot |
Test the constructed search string to see if it's correct. The number of rows that would be returned is displayed in a message box.
Definition at line 174 of file qgssearchquerybuilder.cpp.
References countRecords(), and tr.
Referenced by QgsSearchQueryBuilder().
|
inlineslot |
Definition at line 92 of file qgssearchquerybuilder.h.
References QgsContextHelp::run().
|
slot |
Definition at line 310 of file qgssearchquerybuilder.cpp.
References mModelFields, and QgsExpression::quotedColumnRef().
|
slot |
Definition at line 315 of file qgssearchquerybuilder.cpp.
References mModelValues.
|
private |
Populate the field list for the selected table
Definition at line 70 of file qgssearchquerybuilder.cpp.
References QgsFields::count(), mFieldMap, mLayer, mModelFields, QgsVectorLayer::pendingFields(), and QgsDebugMsg.
Referenced by QgsSearchQueryBuilder().
|
slot |
Definition at line 360 of file qgssearchquerybuilder.cpp.
References tr.
Referenced by QgsSearchQueryBuilder().
QString QgsSearchQueryBuilder::searchString | ( | ) |
returns newly created search string
Definition at line 300 of file qgssearchquerybuilder.cpp.
void QgsSearchQueryBuilder::setSearchString | ( | QString | searchString | ) |
change search string shown in text field
Definition at line 305 of file qgssearchquerybuilder.cpp.
|
private |
Setup models for listviews
Definition at line 87 of file qgssearchquerybuilder.cpp.
References mModelFields, mModelValues, and QgsDebugMsg.
Referenced by QgsSearchQueryBuilder().
|
private |
Map that holds field information, keyed by field name.
Definition at line 124 of file qgssearchquerybuilder.h.
Referenced by getFieldValues(), loadQuery(), and populateFields().
|
private |
Layer for which is the query builder opened.
Definition at line 122 of file qgssearchquerybuilder.h.
Referenced by countRecords(), getFieldValues(), and populateFields().
|
private |
Model for fields ListView.
Definition at line 126 of file qgssearchquerybuilder.h.
Referenced by getFieldValues(), on_lstFields_doubleClicked(), populateFields(), and setupListViews().
|
private |
Model for values ListView.
Definition at line 128 of file qgssearchquerybuilder.h.
Referenced by getFieldValues(), on_lstValues_doubleClicked(), and setupListViews().