24 #include <QStringListModel>
30 switch ( p1.first.type() )
32 case QVariant::String:
33 return p1.first.toString() < p2.first.toString();
36 case QVariant::Double:
37 return p1.first.toDouble() < p2.first.toDouble();
41 return p1.first.toInt() < p2.first.toInt();
49 return p1.second < p2.second;
78 for (
int i = 0; i < mListWidget->
count(); ++i )
92 if ( i.second == mLineEdit->
text() )
105 if (
config(
"AllowMulti" ).toBool() )
109 else if (
config(
"UseCompleter" ).toBool() )
122 mComboBox = qobject_cast<
QComboBox*>( editor );
123 mListWidget = qobject_cast<
QListWidget*>( editor );
124 mLineEdit = qobject_cast<
QLineEdit*>( editor );
128 if (
config(
"AllowNull" ).toBool() )
135 mComboBox->
addItem( element.second, element.first );
140 else if ( mListWidget )
146 item->
setData( Qt::UserRole, element.first );
148 mListWidget->addItem( item );
152 else if ( mLineEdit )
163 mLineEdit->setCompleter( completer );
173 for (
int i = 0; i < mListWidget->
count(); ++i )
176 if (
config(
"OrderByValue" ).toBool() )
186 else if ( mComboBox )
190 else if ( mLineEdit )
194 if ( i.first == value )
196 mLineEdit->
setText( i.second );
216 if ( !config.
value(
"FilterExpression" ).toString().isEmpty() )
223 if ( ki >= 0 && vi >= 0 )
226 attributes << ki << vi;
230 bool requiresAllAttributes =
false;
240 requiresAllAttributes =
true;
251 if ( !requiresAllAttributes )
270 if ( config.
value(
"OrderByValue" ).toBool() )
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
QString & append(QChar ch)
bool hasParserError() const
Returns true if an error occurred when parsing the input expression.
QStringList referencedColumns() const
Get list of columns referenced by the expression.
void append(const T &value)
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.
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QString & prepend(QChar ch)
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
QString join(const QString &separator) const
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QString & remove(int position, int n)
QString tr(const char *sourceText, const char *disambiguation, int n)
void addItem(const QString &text, const QVariant &userData)
bool needsGeometry() const
Returns true if the expression uses feature geometry for some computation.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Lineedit with builtin clear button.
static const QString AllAttributes
QVariant itemData(int index, int role) const
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
int findData(const QVariant &data, int role, QFlags< Qt::MatchFlag > flags) const
QList< T > toList() const
QgsMapLayer * mapLayer(QString theLayerId)
Retrieve a pointer to a loaded layer by id.
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
bool nextFeature(QgsFeature &f)
Geometry is not required. It may still be returned if e.g. required for a filter condition.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
QgsFeatureRequest & setFlags(Flags flags)
Set flags that affect how features will be fetched.
const T value(const Key &key) const