17 #include <QHBoxLayout>
27 , mExpressionDialogTitle(
tr(
"Expression dialog" ) )
34 mCombo->
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
39 mCombo->
setModel( mFieldProxyModel );
42 mButton->
setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
63 mExpressionDialogTitle = title;
207 if ( event->
type() == QEvent::EnabledChange )
222 if ( metrics.width( fieldName ) > mCombo->
lineEdit()->
width() )
240 palette.
setColor( QPalette::Text, Qt::gray );
258 if ( isExpression && !isValid )
260 palette.
setColor( QPalette::Text, Qt::red );
264 palette.
setColor( QPalette::Text, Qt::black );
Class for parsing and evaluation of expressions (formerly called "search strings").
Base class for all map layer types.
void setContentsMargins(int left, int top, int right, int bottom)
bool hasParserError() const
Returns true if an error occurred when parsing the input expression.
QgsFieldModel * sourceFieldModel()
sourceFieldModel returns the QgsFieldModel used in this QSortFilterProxyModel
void setColor(ColorGroup group, ColorRole role, const QColor &color)
bool prepare(const QgsFields &fields)
Get the expression ready for evaluation - find out column indexes.
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
void setExpression(const QString &expression)
setExpression sets a single expression to be added after the fields at the end of the model ...
Container of fields for a vector layer.
QString & remove(int position, int n)
void setEditable(bool editable)
virtual QLayoutItem * takeAt(int index)
static bool isValid(const QString &text, const QgsFields &fields, QString &errorMessage)
QgsVectorLayer * layer()
returns the currently used layer
bool isField(const QString &expression)
The QgsFieldProxyModel class provides an easy to use model to display the list of fields of a layer...
virtual QSize minimumSizeHint() const
QgsFieldProxyModel * setFilters(Filters filters)
setFilters set flags that affect how fields are filtered
void setLayer(QgsVectorLayer *layer)
set the layer of whch fields are displayed
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
void setGeomCalculator(const QgsDistanceArea &da)
Sets geometry calculator used in distance/area calculations.
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
void setAllowExpression(bool allowExpression)
returns the currently used layer
void setItalic(bool enable)
General purpose distance and area calculator.
QLineEdit * lineEdit() const
void setModel(QAbstractItemModel *model)
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
void setCurrentIndex(int index)
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
QModelIndex indexFromName(const QString &fieldName)
return the index corresponding to a given fieldName
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.
A generic dialog for building expression strings.