33 mButtonSelect->addAction( mActionSelect );
34 mButtonSelect->addAction( mActionAddToSelection );
35 mButtonSelect->addAction( mActionRemoveFromSelection );
36 mButtonSelect->addAction( mActionSelectInstersect );
37 mButtonSelect->setDefaultAction( mActionSelect );
39 mExpressionBuilder->setLayer( layer );
40 mExpressionBuilder->setExpressionText( startText );
41 mExpressionBuilder->loadFieldNames();
44 restoreGeometry( settings.value(
"/Windows/ExpressionSelectionDialog/geometry" ).toByteArray() );
49 return mExpressionBuilder;
54 mExpressionBuilder->setExpressionText( text );
59 return mExpressionBuilder->expressionText();
65 mExpressionBuilder->setGeomCalculator( da );
82 if ( expression->
evaluate( &feat, fields ).toBool() )
84 newSelection << feat.
id();
109 if ( expression->
evaluate( &feat, fields ).toBool() )
111 newSelection << feat.
id();
140 if ( expression->
evaluate( &feat, fields ).toBool() )
142 newSelection << feat.
id();
176 if ( expression->
evaluate( &feat, fields ).toBool() )
178 newSelection.remove( feat.
id() );
196 QDialog::closeEvent( closeEvent );
199 settings.setValue(
"/Windows/ExpressionSelectionDialog/geometry", saveGeometry() );
QgsFeatureId id() const
Get the feature id for this feature.
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
QVariant evaluate(const QgsFeature *f=NULL)
Evaluate the feature and return the result.
bool prepare(const QgsFields &fields)
Get the expression ready for evaluation - find out column indexes.
QSet< QgsFeatureId > QgsFeatureIds
QString expressionText()
Returns the current expression text.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
Container of fields for a vector layer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
void on_mActionRemoveFromSelection_triggered()
void on_mActionAddToSelection_triggered()
const QgsFeatureIds & selectedFeaturesIds() const
Return reference to identifiers of selected features.
void setGeomCalculator(const QgsDistanceArea &da)
Sets geometry calculator used in distance/area calculations.
QgsExpressionSelectionDialog(QgsVectorLayer *layer, QString startText=QString(), QWidget *parent=NULL)
Creates a new selection dialog.
void on_mActionSelectInstersect_triggered()
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsExpressionBuilderWidget * expressionBuilder()
The builder widget that is used by the dialog.
void setExpressionText(const QString &text)
Sets the current expression text.
virtual void closeEvent(QCloseEvent *closeEvent)
Implementation for closeEvent Saves the window geometry.
void on_mPbnClose_clicked()
General purpose distance and area calculator.
void on_mActionSelect_triggered()
void setSelectedFeatures(const QgsFeatureIds &ids)
Change selection to the new set of features.
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
bool nextFeature(QgsFeature &f)
Represents a vector layer which manages a vector based data sets.
virtual void done(int r)
Implementation for done (default behavior when pressing esc) Calls close, so the window geometry gets...
static QIcon getThemeIcon(const QString theName)
Helper to get a theme icon.