Skip to content

Commit 86700d2

Browse files
committedMay 2, 2014
QgsFieldCombobBox do not allow expression
editExpression protected, setLayer uses QgsVectorLayer make epxression widget editable
1 parent 760f835 commit 86700d2

17 files changed

+330
-403
lines changed
 

‎python/gui/qgsfieldcombobox.sip

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/**
22
* @brief The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.
3-
* If allowed, expression may also be added at the bottom of the list of fields.
4-
* It can be combined with a QgsExpressioButton to set the expression using the dedicated expression builder dialog.
5-
* It might also be combined with a QgsMapLayerComboBox and the fields will be automatically updated according to the chosen layer.
6-
* @see QgsExpressioButton, QgsMapLayerComboBox
3+
* It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer.
4+
* If expression must be used, QgsFieldExpressionWidget shall be used instead.
5+
* @see QgsMapLayerComboBox
76
* @note added in 2.3
87
*/
98
class QgsFieldComboBox : QComboBox
@@ -20,37 +19,23 @@ class QgsFieldComboBox : QComboBox
2019
*/
2120
explicit QgsFieldComboBox( QWidget *parent /TransferThis/ = 0 );
2221

23-
/**
24-
* @brief currentField returns the currently selected field or expression if allowed
25-
* @param isExpression determines if the string returned is the name of a field or an expression
26-
*/
27-
QString currentField( bool *isExpression = 0 );
28-
29-
//!! setAllowExpression sets if expression can be added the combo box
30-
void setAllowExpression( bool allowExpression );
31-
//! returns if the widget allows expressions to be added or not
32-
bool allowExpression();
33-
22+
//! return the currently selected field
23+
QString currentField();
24+
3425
//! Returns the currently used layer
3526
QgsVectorLayer* layer();
3627

3728
signals:
38-
/**
39-
* @brief setField sets the currently selected field
40-
* if expressions are allowed in the widget,
41-
* then it will either set it as selected
42-
* if it already exists, or it will add it otherwise
43-
*/
29+
//! the signal is emitted when the currently selected field changes
4430
void fieldChanged( QString fieldName );
4531

4632
public slots:
47-
/**
48-
* @brief setLayer sets the layer of which the fields are listed
49-
*/
33+
//! set the layer of which the fields are listed
5034
void setLayer( QgsMapLayer* layer );
51-
/**
52-
* @brief setField sets the currently selected field
53-
*/
35+
36+
//! setField sets the currently selected field
5437
void setField( QString fieldName );
5538

39+
protected slots:
40+
void indexChanged( int i );
5641
};

‎python/gui/qgsfieldexpressionwidget.sip

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ class QgsFieldExpressionWidget : QWidget
1717
//! set the geometry calculator used in the expression dialog
1818
void setGeomCalculator( const QgsDistanceArea &da );
1919

20-
//! return a pointer to the combo box in the widget
21-
QgsFieldComboBox* fieldComboBox();
22-
23-
//! return a pointer to the tool button used in the widget
24-
QToolButton* toolButton();
25-
2620
/**
2721
* @brief currentField returns the currently selected field or expression if allowed
2822
* @param isExpression determines if the string returned is the name of a field or an expression
@@ -32,13 +26,23 @@ class QgsFieldExpressionWidget : QWidget
3226
//! Returns the currently used layer
3327
QgsVectorLayer* layer();
3428

29+
signals:
30+
//! the signal is emitted when the currently selected field changes
31+
void fieldChanged( QString fieldName );
32+
3533
public slots:
3634
//! set the layer used to display the fields and expression
3735
void setLayer( QgsMapLayer* layer );
3836

3937
//! sets the current field or expression in the widget
4038
void setField( QString fieldName );
4139

40+
protected slots:
4241
//! open the expression dialog to edit the current or add a new expression
4342
void editExpression();
43+
44+
//! when expression is edited by the user in the line edit
45+
void expressionEdited( QString expression );
46+
47+
void indexChanged( int i );
4448
};

‎python/gui/qgsfieldmodel.sip

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,23 @@ class QgsFieldModel : QAbstractItemModel
1313

1414
public:
1515
enum FieldRoles {
16-
FieldNameRole = 33, /* Qt::UserRole + 1, SIP does not accept any arithmetic" */
17-
FieldIndexRole = 34,
18-
ExpressionRole = 35
16+
/* SIP does not accept any arithmetic" */
17+
FieldNameRole = 33, /* return field name if index corresponds to a field */
18+
FieldIndexRole = 34, /* return field index if index corresponds to a field */
19+
ExpressionRole = 35, /* return field name or expression */
20+
IsExpressionRole = 36, /* return if index corresponds to an expression */
21+
ExpressionValidityRole = 37 /* return if expression is valid or not */
1922
};
2023

2124
/**
2225
* @brief QgsFieldModel creates a model to display the fields of a given layer
2326
*/
2427
explicit QgsFieldModel( QObject *parent /TransferThis/ = 0 );
2528

26-
/**
27-
* @brief indexFromName returns the index corresponding to a given fieldName
28-
*/
29+
//! return the index corresponding to a given fieldName
2930
QModelIndex indexFromName( QString fieldName );
3031

31-
/**
32-
* @brief setAllowExpression determines if expressions are allowed to be added to the model
33-
*/
32+
//! returns the currently used layer
3433
void setAllowExpression( bool allowExpression );
3534
bool allowExpression();
3635

@@ -39,19 +38,20 @@ class QgsFieldModel : QAbstractItemModel
3938
* @return the model index of the newly added expression
4039
*/
4140
QModelIndex setExpression( QString expression );
41+
42+
//! remove expressions from the model
43+
void removeExpression();
4244

43-
/**
44-
* @brief layer returns the currently used layer
45-
*/
45+
//! returns the currently used layer
4646
QgsMapLayer* layer();
4747

4848
public slots:
49-
/**
50-
* @brief setLayer sets the layer of whch fields are displayed
51-
*/
49+
//! set the layer of whch fields are displayed
5250
void setLayer( QgsMapLayer *layer );
5351

54-
52+
protected slots:
53+
virtual void updateModel();
54+
5555
// QAbstractItemModel interface
5656
public:
5757
QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;

‎python/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.sip

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ class QgsCategorizedSymbolRendererV2Widget : QgsRendererV2Widget
1414

1515
public slots:
1616
void changeCategorizedSymbol();
17-
void categoryColumnChanged();
17+
void categoryColumnChanged( QString field );
1818
void categoriesDoubleClicked( const QModelIndex & idx );
1919
void addCategory();
2020
void addCategories();
2121
void deleteCategories();
2222
void deleteAllCategories();
23-
void setExpression();
2423

2524
void rotationFieldChanged( QString fldName );
2625
void sizeScaleFieldChanged( QString fldName );
@@ -39,9 +38,6 @@ class QgsCategorizedSymbolRendererV2Widget : QgsRendererV2Widget
3938
// Called by virtual refreshSymbolView()
4039
void populateCategories();
4140

42-
//! populate column combo
43-
void populateColumns();
44-
4541
//! return row index for the currently selected category (-1 if on no selection)
4642
int currentCategoryRow();
4743

‎python/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.sip

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class QgsGraduatedSymbolRendererV2Widget : QgsRendererV2Widget
1313

1414
public slots:
1515
void changeGraduatedSymbol();
16-
void graduatedColumnChanged();
17-
void setExpression();
16+
void graduatedColumnChanged( QString field );
1817
void classifyGraduated();
1918
void reapplyColorRamp();
2019
void rangesDoubleClicked( const QModelIndex & idx );
@@ -45,9 +44,6 @@ class QgsGraduatedSymbolRendererV2Widget : QgsRendererV2Widget
4544
QList<int> selectedClasses();
4645
QgsRangeList selectedRanges();
4746

48-
//! populate column combos in categorized and graduated page
49-
void populateColumns();
50-
5147
void changeRangeSymbol( int rangeIdx );
5248
void changeRange( int rangeIdx );
5349

‎src/gui/qgsfieldcombobox.cpp

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,15 @@ void QgsFieldComboBox::setField( QString fieldName )
4747
if ( idx.isValid() )
4848
{
4949
setCurrentIndex( idx.row() );
50-
return;
5150
}
52-
53-
if ( mAllowExpression )
51+
else
5452
{
55-
mFieldModel->setExpression( fieldName );
56-
setCurrentIndex( findText( fieldName ) );
57-
return;
53+
setCurrentIndex( -1 );
5854
}
59-
setCurrentIndex( -1 );
6055
}
6156

62-
QString QgsFieldComboBox::currentField( bool *isExpression )
57+
QString QgsFieldComboBox::currentField()
6358
{
64-
if ( isExpression )
65-
{
66-
*isExpression = false;
67-
}
68-
6959
int i = currentIndex();
7060

7161
const QModelIndex index = mFieldModel->index( i, 0 );
@@ -74,31 +64,8 @@ QString QgsFieldComboBox::currentField( bool *isExpression )
7464
return "";
7565
}
7666

77-
QString fieldName = mFieldModel->data( index, QgsFieldModel::FieldNameRole ).toString();
78-
if ( !fieldName.isEmpty() )
79-
{
80-
return fieldName;
81-
}
82-
83-
if ( mAllowExpression )
84-
{
85-
QString expression = mFieldModel->data( index, QgsFieldModel::ExpressionRole ).toString();
86-
if ( !expression.isEmpty() )
87-
{
88-
if ( isExpression )
89-
{
90-
*isExpression = true;
91-
}
92-
return expression;
93-
}
94-
}
95-
96-
return "";
97-
}
98-
99-
void QgsFieldComboBox::setAllowExpression( bool allowExpression )
100-
{
101-
mFieldModel->setAllowExpression( allowExpression );
67+
QString name = mFieldModel->data( index, QgsFieldModel::FieldNameRole ).toString();
68+
return name;
10269
}
10370

10471
void QgsFieldComboBox::indexChanged( int i )

‎src/gui/qgsfieldcombobox.h

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ class QgsVectorLayer;
2424

2525
/**
2626
* @brief The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.
27-
* If allowed, expression may also be added at the bottom of the list of fields.
28-
* It can be combined with a QgsExpressioButton to set the expression using the dedicated expression builder dialog.
29-
* It might also be combined with a QgsMapLayerComboBox and the fields will be automatically updated according to the chosen layer.
30-
* @see QgsExpressioButton, QgsMapLayerComboBox
27+
* It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer.
28+
* If expression must be used, QgsFieldExpressionWidget shall be used instead.
29+
* @see QgsMapLayerComboBox
3130
* @note added in 2.3
3231
*/
3332
class GUI_EXPORT QgsFieldComboBox : public QComboBox
@@ -40,47 +39,28 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox
4039
*/
4140
explicit QgsFieldComboBox( QWidget *parent = 0 );
4241

43-
/**
44-
* @brief currentField returns the currently selected field or expression if allowed
45-
* @param isExpression determines if the string returned is the name of a field or an expression
46-
*/
47-
QString currentField( bool *isExpression = 0 );
48-
49-
//!! setAllowExpression sets if expression can be added the combo box
50-
void setAllowExpression( bool allowExpression );
51-
//! returns if the widget allows expressions to be added or not
52-
bool allowExpression() { return mAllowExpression; }
42+
//! return the currently selected field
43+
QString currentField();
5344

5445
//! Returns the currently used layer
5546
QgsVectorLayer* layer();
5647

5748
signals:
58-
/**
59-
* @brief fieldChanged the signal is emitted when the currently selected field changes
60-
*/
49+
//! the signal is emitted when the currently selected field changes
6150
void fieldChanged( QString fieldName );
6251

6352
public slots:
64-
/**
65-
* @brief setLayer sets the layer of which the fields are listed
66-
*/
53+
//! set the layer of which the fields are listed
6754
void setLayer( QgsMapLayer* layer );
6855

69-
/**
70-
* @brief setField sets the currently selected field
71-
* if expressions are allowed in the widget,
72-
* then it will either set it as selected
73-
* if it already exists, or it will add it otherwise
74-
*/
56+
//! setField sets the currently selected field
7557
void setField( QString fieldName );
7658

7759
protected slots:
7860
void indexChanged( int i );
7961

8062
private:
8163
QgsFieldModel* mFieldModel;
82-
bool mAllowExpression;
83-
8464
};
8565

8666
#endif // QGSFIELDCOMBOBOX_H

‎src/gui/qgsfieldexpressionwidget.cpp

Lines changed: 87 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/***************************************************************************
23
qgsfieldexpressionwidget.cpp
34
--------------------------------------
@@ -18,7 +19,7 @@
1819
#include "qgsapplication.h"
1920
#include "qgsfieldexpressionwidget.h"
2021
#include "qgsexpressionbuilderdialog.h"
21-
#include "qgsfieldcombobox.h"
22+
#include "qgsfieldmodel.h"
2223
#include "qgsdistancearea.h"
2324

2425
QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
@@ -28,15 +29,22 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
2829
{
2930
QHBoxLayout* layout = new QHBoxLayout( this );
3031
layout->setContentsMargins( 0, 0, 0, 0 );
31-
mCombo = new QgsFieldComboBox( this );
32-
mCombo->setAllowExpression( true );
32+
mCombo = new QComboBox( this );
33+
mCombo->setEditable( true );
3334
mCombo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
34-
layout->addWidget( mCombo );
35+
mFieldModel = new QgsFieldModel( mCombo );
36+
mFieldModel->setAllowExpression( true );
37+
mCombo->setModel( mFieldModel );
38+
3539
mButton = new QToolButton( this );
36-
mButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::MinimumExpanding );
40+
mButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
3741
mButton->setIcon( QgsApplication::getThemeIcon( "/mIconExpressionEditorOpen.svg" ) );
42+
43+
layout->addWidget( mCombo );
3844
layout->addWidget( mButton );
3945

46+
connect( mCombo->lineEdit(), SIGNAL( textEdited( QString ) ), this, SLOT( expressionEdited( QString ) ) );
47+
connect( mCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( indexChanged( int ) ) );
4048
connect( mButton, SIGNAL( clicked() ), this, SLOT( editExpression() ) );
4149
}
4250

@@ -50,45 +58,88 @@ void QgsFieldExpressionWidget::setGeomCalculator( const QgsDistanceArea &da )
5058
mDa = QSharedPointer<const QgsDistanceArea>( new QgsDistanceArea( da ) );
5159
}
5260

53-
QgsFieldComboBox *QgsFieldExpressionWidget::fieldComboBox()
61+
QString QgsFieldExpressionWidget::currentField( bool *isExpression )
5462
{
55-
return mCombo;
56-
}
63+
if ( isExpression )
64+
{
65+
*isExpression = false;
66+
}
5767

58-
QToolButton *QgsFieldExpressionWidget::toolButton()
59-
{
60-
return mButton;
61-
}
68+
int i = mCombo->currentIndex();
6269

63-
QString QgsFieldExpressionWidget::currentField( bool *isExpression )
64-
{
65-
return mCombo->currentField( isExpression );
70+
const QModelIndex index = mFieldModel->index( i, 0 );
71+
if ( !index.isValid() )
72+
{
73+
return "";
74+
}
75+
76+
if ( isExpression )
77+
{
78+
*isExpression = mFieldModel->data( index, QgsFieldModel::IsExpressionRole ).toBool();
79+
}
80+
QString expression = mFieldModel->data( index, QgsFieldModel::ExpressionRole ).toString();
81+
return expression;
6682
}
6783

6884
QgsVectorLayer *QgsFieldExpressionWidget::layer()
6985
{
70-
return mCombo->layer();
86+
QgsMapLayer* layer = mFieldModel->layer();
87+
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer );
88+
if ( vl )
89+
return vl;
90+
else
91+
return 0;
7192
}
7293

73-
void QgsFieldExpressionWidget::setLayer( QgsMapLayer *layer )
94+
void QgsFieldExpressionWidget::setLayer( QgsVectorLayer *layer )
7495
{
75-
mCombo->setLayer( layer );
96+
mFieldModel->setLayer( layer );
7697
}
7798

7899
void QgsFieldExpressionWidget::setField( QString fieldName )
79100
{
80-
mCombo->setField( fieldName );
101+
QModelIndex idx = mFieldModel->indexFromName( fieldName );
102+
bool isExpression ;
103+
if ( idx.isValid() )
104+
{
105+
isExpression = mFieldModel->data( idx, QgsFieldModel::IsExpressionRole ).toBool();
106+
}
107+
else
108+
{
109+
// new expression
110+
idx = mFieldModel->setExpression( fieldName );
111+
isExpression = true;
112+
}
113+
mCombo->setCurrentIndex( idx.row() );
114+
115+
QFont font;
116+
font.setItalic( isExpression );
117+
mCombo->lineEdit()->setFont( font );
118+
119+
QPalette palette;
120+
palette.setColor( QPalette::Text, Qt::black );
121+
if ( isExpression )
122+
{
123+
bool isValid = mFieldModel->data( idx, QgsFieldModel::ExpressionValidityRole ).toBool();
124+
if ( !isValid )
125+
{
126+
palette.setColor( QPalette::Text, Qt::red );
127+
}
128+
}
129+
mCombo->lineEdit()->setPalette( palette );
130+
131+
emit fieldChanged( currentField() );
81132
}
82133

83134
void QgsFieldExpressionWidget::editExpression()
84135
{
85-
QString currentExpression = mCombo->currentField();
86-
QgsVectorLayer* layer = mCombo->layer();
136+
QString currentExpression = currentField();
137+
QgsVectorLayer* vl = layer();
87138

88-
if ( !layer )
139+
if ( !vl )
89140
return;
90141

91-
QgsExpressionBuilderDialog dlg( layer, currentExpression );
142+
QgsExpressionBuilderDialog dlg( vl, currentExpression );
92143
if ( !mDa.isNull() )
93144
{
94145
dlg.setGeomCalculator( *mDa );
@@ -98,7 +149,19 @@ void QgsFieldExpressionWidget::editExpression()
98149
if ( dlg.exec() )
99150
{
100151
QString newExpression = dlg.expressionText();
101-
mCombo->setField( newExpression );
152+
setField( newExpression );
102153
}
154+
}
103155

156+
void QgsFieldExpressionWidget::expressionEdited( QString expression )
157+
{
158+
mFieldModel->removeExpression();
159+
setField( expression );
160+
}
161+
162+
void QgsFieldExpressionWidget::indexChanged( int i )
163+
{
164+
Q_UNUSED( i );
165+
QString name = currentField();
166+
emit fieldChanged( name );
104167
}

‎src/gui/qgsfieldexpressionwidget.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
#include <QSharedPointer>
2020
#include <QWidget>
2121
#include <QToolButton>
22+
#include <QComboBox>
23+
#include <QColor>
2224

2325
#include "qgsdistancearea.h"
2426

25-
class QgsFieldComboBox;
2627
class QgsMapLayer;
2728
class QgsVectorLayer;
29+
class QgsFieldModel;
2830

2931

3032
class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
@@ -42,12 +44,6 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
4244
//! set the geometry calculator used in the expression dialog
4345
void setGeomCalculator( const QgsDistanceArea &da );
4446

45-
//! return a pointer to the combo box in the widget
46-
QgsFieldComboBox* fieldComboBox();
47-
48-
//! return a pointer to the tool button used in the widget
49-
QToolButton* toolButton();
50-
5147
/**
5248
* @brief currentField returns the currently selected field or expression if allowed
5349
* @param isExpression determines if the string returned is the name of a field or an expression
@@ -57,22 +53,34 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
5753
//! Returns the currently used layer
5854
QgsVectorLayer* layer();
5955

56+
signals:
57+
//! the signal is emitted when the currently selected field changes
58+
void fieldChanged( QString fieldName );
59+
6060
public slots:
6161
//! set the layer used to display the fields and expression
62-
void setLayer( QgsMapLayer* layer );
62+
void setLayer( QgsVectorLayer* layer );
6363

6464
//! sets the current field or expression in the widget
6565
void setField( QString fieldName );
6666

67+
protected slots:
6768
//! open the expression dialog to edit the current or add a new expression
6869
void editExpression();
6970

71+
//! when expression is edited by the user in the line edit
72+
void expressionEdited( QString expression );
73+
74+
void indexChanged( int i );
75+
7076
private:
71-
QgsFieldComboBox* mCombo;
77+
QComboBox* mCombo;
7278
QToolButton* mButton;
79+
QgsFieldModel* mFieldModel;
7380
QString mExpressionDialogTitle;
7481
QSharedPointer<const QgsDistanceArea> mDa;
7582

83+
QString color2rgbaStr( QColor color );
7684
};
7785

7886
#endif // QGSFIELDEXPRESSIONWIDGET_H

‎src/gui/qgsfieldmodel.cpp

Lines changed: 104 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ QModelIndex QgsFieldModel::indexFromName( QString fieldName )
4242
{
4343
return index( mFields.count() + exprIdx , 0 );
4444
}
45-
else
46-
{
47-
return setExpression( fieldName );
48-
}
4945
}
5046

5147
return QModelIndex();
@@ -122,9 +118,22 @@ QModelIndex QgsFieldModel::setExpression( QString expression )
122118
mExpression = QList<QString>() << expression;
123119
endResetModel();
124120

121+
// fetch feature to be evaluate the expression
122+
if ( !mFeature.isValid() )
123+
{
124+
mLayer->getFeatures().nextFeature( mFeature );
125+
}
126+
125127
return index( mFields.count() , 0 );
126128
}
127129

130+
void QgsFieldModel::removeExpression()
131+
{
132+
beginResetModel();
133+
mExpression = QList<QString>();
134+
endResetModel();
135+
}
136+
128137
QModelIndex QgsFieldModel::index( int row, int column, const QModelIndex &parent ) const
129138
{
130139
Q_UNUSED( parent );
@@ -160,57 +169,110 @@ QVariant QgsFieldModel::data( const QModelIndex &index, int role ) const
160169
if ( !mLayer )
161170
return QVariant();
162171

163-
if ( role == FieldNameRole )
172+
int exprIdx = index.internalId() - mFields.count();
173+
174+
switch ( role )
164175
{
165-
int exprIdx = index.internalId() - mFields.count();
166-
if ( exprIdx >= 0 )
176+
case FieldNameRole:
167177
{
168-
return "";
178+
if ( exprIdx >= 0 )
179+
{
180+
return "";
181+
}
182+
QgsField field = mFields[index.internalId()];
183+
return field.name();
169184
}
170-
QgsField field = mFields[index.internalId()];
171-
return field.name();
172-
}
173185

174-
if ( role == ExpressionRole )
175-
{
176-
int exprIdx = index.internalId() - mFields.count();
177-
if ( exprIdx >= 0 )
186+
case ExpressionRole:
178187
{
179-
return mExpression[exprIdx];
188+
if ( exprIdx >= 0 )
189+
{
190+
return mExpression[exprIdx];
191+
}
192+
else
193+
{
194+
QgsField field = mFields[index.internalId()];
195+
return field.name();
196+
}
180197
}
181-
return "";
182-
}
183198

184-
if ( role == FieldIndexRole )
185-
{
186-
if ( index.internalId() >= mFields.count() )
199+
case FieldIndexRole:
200+
{
201+
if ( exprIdx >= 0 )
202+
{
203+
return QVariant();
204+
}
205+
return index.internalId();
206+
}
207+
208+
case IsExpressionRole:
187209
{
210+
return exprIdx >= 0;
211+
}
212+
213+
case ExpressionValidityRole:
214+
{
215+
if ( exprIdx >= 0 )
216+
{
217+
QgsExpression exp( mExpression[exprIdx] );
218+
if ( mFeature.isValid() )
219+
{
220+
exp.evaluate( &mFeature, mLayer->pendingFields() );
221+
return !exp.hasEvalError();
222+
}
223+
else
224+
{
225+
return QVariant();
226+
}
227+
}
228+
return true;
229+
}
230+
231+
case Qt::DisplayRole:
232+
case Qt::EditRole:
233+
{
234+
if ( exprIdx >= 0 )
235+
{
236+
return mExpression[exprIdx];
237+
}
238+
QgsField field = mFields[index.internalId()];
239+
const QMap< QString, QString > aliases = mLayer->attributeAliases();
240+
QString alias = aliases.value( field.name(), field.name() );
241+
return alias;
242+
}
243+
244+
case Qt::BackgroundRole:
245+
{
246+
if ( exprIdx >= 0 )
247+
{
248+
// if expression, test validity
249+
QgsExpression exp( mExpression[exprIdx] );
250+
251+
if ( mFeature.isValid() )
252+
{
253+
exp.evaluate( &mFeature, mLayer->pendingFields() );
254+
if ( exp.hasEvalError() )
255+
{
256+
return QBrush( QColor( 240, 60, 60, 180 ) );
257+
}
258+
}
259+
}
188260
return QVariant();
189261
}
190-
return index.internalId();
191-
}
192262

193-
if ( role == Qt::DisplayRole )
194-
{
195-
int exprIdx = index.internalId() - mFields.count();
196-
if ( exprIdx >= 0 )
263+
case Qt::FontRole:
197264
{
198-
return mExpression[exprIdx];
265+
if ( exprIdx >= 0 )
266+
{
267+
// if the line is an expression, set it as italic
268+
QFont font;
269+
font.setItalic( true );
270+
return font;
271+
}
272+
return QVariant();
199273
}
200-
QgsField field = mFields[index.internalId()];
201-
const QMap< QString, QString > aliases = mLayer->attributeAliases();
202-
QString alias = aliases.value( field.name(), field.name() );
203-
return alias;
204-
}
205274

206-
if ( role == Qt::FontRole && index.internalId() >= mFields.count() )
207-
{
208-
// if the line is an expression, set it as italic
209-
QFont font;
210-
font.setItalic( true );
211-
return font;
275+
default:
276+
return QVariant();
212277
}
213-
214-
return QVariant();
215278
}
216-

‎src/gui/qgsfieldmodel.h

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include "qgsvectorlayer.h"
2424

25+
class QgsFeature;
26+
2527
/**
2628
* @brief The QgsFieldModel class is a model to display the list of fields of a layer in widgets.
2729
* If allowed, expressions might be added to the end of the model.
@@ -34,24 +36,22 @@ class GUI_EXPORT QgsFieldModel : public QAbstractItemModel
3436
public:
3537
enum FieldRoles
3638
{
37-
FieldNameRole = Qt::UserRole + 1,
38-
FieldIndexRole = Qt::UserRole + 2,
39-
ExpressionRole = Qt::UserRole + 3
39+
FieldNameRole = Qt::UserRole + 1, /* return field name if index corresponds to a field */
40+
FieldIndexRole = Qt::UserRole + 2, /* return field index if index corresponds to a field */
41+
ExpressionRole = Qt::UserRole + 3, /* return field name or expression */
42+
IsExpressionRole = Qt::UserRole + 4, /* return if index corresponds to an expression */
43+
ExpressionValidityRole = Qt::UserRole + 5 /* return if expression is valid or not */
4044
};
4145

4246
/**
4347
* @brief QgsFieldModel creates a model to display the fields of a given layer
4448
*/
4549
explicit QgsFieldModel( QObject *parent = 0 );
4650

47-
/**
48-
* @brief indexFromName returns the index corresponding to a given fieldName
49-
*/
51+
//! return the index corresponding to a given fieldName
5052
QModelIndex indexFromName( QString fieldName );
5153

52-
/**
53-
* @brief setAllowExpression determines if expressions are allowed to be added to the model
54-
*/
54+
//! returns the currently used layer
5555
void setAllowExpression( bool allowExpression );
5656
bool allowExpression() {return mAllowExpression;}
5757

@@ -61,15 +61,14 @@ class GUI_EXPORT QgsFieldModel : public QAbstractItemModel
6161
*/
6262
QModelIndex setExpression( QString expression );
6363

64-
/**
65-
* @brief layer returns the currently used layer
66-
*/
64+
//! remove expressions from the model
65+
void removeExpression();
66+
67+
//! returns the currently used layer
6768
QgsMapLayer* layer() {return mLayer;}
6869

6970
public slots:
70-
/**
71-
* @brief setLayer sets the layer of whch fields are displayed
72-
*/
71+
//! set the layer of whch fields are displayed
7372
void setLayer( QgsMapLayer *layer );
7473

7574
protected slots:
@@ -85,6 +84,11 @@ class GUI_EXPORT QgsFieldModel : public QAbstractItemModel
8584
QgsVectorLayer* mLayer;
8685
bool mAllowExpression;
8786

87+
private:
88+
QgsFeature mFeature;
89+
90+
void fetchFeature();
91+
8892
// QAbstractItemModel interface
8993
public:
9094
QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;

‎src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsV
368368
// setup user interface
369369
setupUi( this );
370370

371-
populateColumns();
371+
mExpressionWidget->setLayer( mLayer );
372372

373373
cboCategorizedColorRamp->populate( mStyle );
374374
int randomIndex = cboCategorizedColorRamp->findText( tr( "Random colors" ) );
@@ -399,7 +399,7 @@ QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsV
399399

400400
connect( mModel, SIGNAL( rowsMoved() ), this, SLOT( rowsMoved() ) );
401401

402-
connect( cboCategorizedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( categoryColumnChanged() ) );
402+
connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( categoryColumnChanged( QString ) ) );
403403

404404
connect( viewCategories, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( categoriesDoubleClicked( const QModelIndex & ) ) );
405405
connect( viewCategories, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenuViewCategories( const QPoint& ) ) );
@@ -410,7 +410,6 @@ QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsV
410410
connect( btnDeleteAllCategories, SIGNAL( clicked() ), this, SLOT( deleteAllCategories() ) );
411411
connect( btnAddCategory, SIGNAL( clicked() ), this, SLOT( addCategory() ) );
412412

413-
connect( btnExpression, SIGNAL( clicked() ), this, SLOT( setExpression() ) );
414413
// update GUI from renderer
415414
updateUiFromRenderer();
416415

@@ -440,17 +439,11 @@ void QgsCategorizedSymbolRendererV2Widget::updateUiFromRenderer()
440439
//mModel->setRenderer ( mRenderer ); // necessary?
441440

442441
// set column
443-
disconnect( cboCategorizedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( categoryColumnChanged() ) );
442+
disconnect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( categoryColumnChanged( QString ) ) );
444443
QString attrName = mRenderer->classAttribute();
445-
mOldClassificationAttribute = attrName;
446-
int idx = cboCategorizedColumn->findText( attrName, Qt::MatchExactly );
447-
if ( idx == -1 )
448-
{
449-
cboCategorizedColumn->addItem( attrName );
450-
idx = cboCategorizedColumn->count() - 1;
451-
}
452-
cboCategorizedColumn->setCurrentIndex( idx );
453-
connect( cboCategorizedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( categoryColumnChanged() ) );
444+
mExpressionWidget->setField( attrName );
445+
connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( categoryColumnChanged( QString ) ) );
446+
454447

455448
// set source symbol
456449
if ( mRenderer->sourceSymbol() )
@@ -537,19 +530,9 @@ void QgsCategorizedSymbolRendererV2Widget::populateCategories()
537530
{
538531
}
539532

540-
void QgsCategorizedSymbolRendererV2Widget::populateColumns()
541-
{
542-
cboCategorizedColumn->clear();
543-
const QgsFields& flds = mLayer->pendingFields();
544-
for ( int idx = 0; idx < flds.count(); ++idx )
545-
{
546-
cboCategorizedColumn->addItem( flds[idx].name() );
547-
}
548-
}
549-
550-
void QgsCategorizedSymbolRendererV2Widget::categoryColumnChanged()
533+
void QgsCategorizedSymbolRendererV2Widget::categoryColumnChanged( QString field )
551534
{
552-
mRenderer->setClassAttribute( cboCategorizedColumn->currentText() );
535+
mRenderer->setClassAttribute( field );
553536
}
554537

555538
void QgsCategorizedSymbolRendererV2Widget::categoriesDoubleClicked( const QModelIndex & idx )
@@ -617,7 +600,7 @@ static void _createCategories( QgsCategoryList& cats, QList<QVariant>& values, Q
617600

618601
void QgsCategorizedSymbolRendererV2Widget::addCategories()
619602
{
620-
QString attrName = cboCategorizedColumn->currentText();
603+
QString attrName = mExpressionWidget->currentField();
621604
int idx = mLayer->fieldNameIndex( attrName );
622605
QList<QVariant> unique_vals;
623606
if ( idx == -1 )
@@ -782,22 +765,6 @@ void QgsCategorizedSymbolRendererV2Widget::deleteAllCategories()
782765
mModel->removeAllRows();
783766
}
784767

785-
void QgsCategorizedSymbolRendererV2Widget::setExpression()
786-
{
787-
QgsExpressionBuilderDialog dlg( mLayer, cboCategorizedColumn->currentText(), this );
788-
dlg.setWindowTitle( "Set column expression" );
789-
if ( dlg.exec() )
790-
{
791-
QString expression = dlg.expressionText();
792-
if ( !expression.isEmpty() )
793-
{
794-
cboCategorizedColumn->addItem( expression );
795-
cboCategorizedColumn->setCurrentIndex( cboCategorizedColumn->count() - 1 );
796-
}
797-
}
798-
799-
}
800-
801768
void QgsCategorizedSymbolRendererV2Widget::addCategory()
802769
{
803770
if ( !mModel ) return;

‎src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,12 @@ class GUI_EXPORT QgsCategorizedSymbolRendererV2Widget : public QgsRendererV2Widg
8181

8282
public slots:
8383
void changeCategorizedSymbol();
84-
void categoryColumnChanged();
84+
void categoryColumnChanged( QString field );
8585
void categoriesDoubleClicked( const QModelIndex & idx );
8686
void addCategory();
8787
void addCategories();
8888
void deleteCategories();
8989
void deleteAllCategories();
90-
void setExpression();
9190

9291
void rotationFieldChanged( QString fldName );
9392
void sizeScaleFieldChanged( QString fldName );
@@ -106,9 +105,6 @@ class GUI_EXPORT QgsCategorizedSymbolRendererV2Widget : public QgsRendererV2Widg
106105
// Called by virtual refreshSymbolView()
107106
void populateCategories();
108107

109-
//! populate column combo
110-
void populateColumns();
111-
112108
//! return row index for the currently selected category (-1 if on no selection)
113109
int currentCategoryRow();
114110

‎src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVecto
358358
// setup user interface
359359
setupUi( this );
360360

361-
populateColumns();
361+
mExprressionWidget->setLayer( mLayer );
362362

363363
cboGraduatedColorRamp->populate( mStyle );
364364

@@ -382,8 +382,7 @@ QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVecto
382382

383383
mGraduatedSymbol = QgsSymbolV2::defaultSymbol( mLayer->geometryType() );
384384

385-
connect( cboGraduatedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( graduatedColumnChanged() ) );
386-
connect( btnExpression, SIGNAL( clicked() ), this, SLOT( setExpression() ) );
385+
connect( mExprressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) );
387386
connect( viewGraduated, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( rangesDoubleClicked( const QModelIndex & ) ) );
388387
connect( viewGraduated, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( rangesClicked( const QModelIndex & ) ) );
389388
connect( viewGraduated, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenuViewCategories( const QPoint& ) ) );
@@ -439,16 +438,10 @@ void QgsGraduatedSymbolRendererV2Widget::updateUiFromRenderer()
439438
spinGraduatedClasses->setValue( mRenderer->ranges().count() );
440439

441440
// set column
442-
disconnect( cboGraduatedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( graduatedColumnChanged() ) );
441+
disconnect( mExprressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) );
443442
QString attrName = mRenderer->classAttribute();
444-
int idx = cboGraduatedColumn->findText( attrName, Qt::MatchExactly );
445-
if ( idx == -1 )
446-
{
447-
cboGraduatedColumn->addItem( attrName );
448-
idx = cboGraduatedColumn->count() - 1;
449-
}
450-
cboGraduatedColumn->setCurrentIndex( idx );
451-
connect( cboGraduatedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( graduatedColumnChanged() ) );
443+
mExprressionWidget->setField( attrName );
444+
connect( mExprressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) );
452445

453446
// set source symbol
454447
if ( mRenderer->sourceSymbol() )
@@ -466,43 +459,15 @@ void QgsGraduatedSymbolRendererV2Widget::updateUiFromRenderer()
466459
}
467460
}
468461

469-
void QgsGraduatedSymbolRendererV2Widget::populateColumns()
470-
{
471-
cboGraduatedColumn->clear();
472-
const QgsFields& flds = mLayer->pendingFields();
473-
for ( int idx = 0; idx < flds.count(); ++idx )
474-
{
475-
if ( flds[idx].type() == QVariant::Double || flds[idx].type() == QVariant::Int || flds[idx].type() == QVariant::LongLong )
476-
cboGraduatedColumn->addItem( flds[idx].name() );
477-
}
478-
}
479-
480-
void QgsGraduatedSymbolRendererV2Widget::graduatedColumnChanged()
462+
void QgsGraduatedSymbolRendererV2Widget::graduatedColumnChanged( QString field )
481463
{
482-
mRenderer->setClassAttribute( cboGraduatedColumn->currentText() );
464+
mRenderer->setClassAttribute( field );
483465
classifyGraduated();
484466
}
485467

486-
487-
void QgsGraduatedSymbolRendererV2Widget::setExpression()
488-
{
489-
QgsExpressionBuilderDialog dlg( mLayer, cboGraduatedColumn->currentText(), this );
490-
dlg.setWindowTitle( "Set column expression" );
491-
if ( dlg.exec() )
492-
{
493-
QString expression = dlg.expressionText();
494-
if ( !expression.isEmpty() )
495-
{
496-
cboGraduatedColumn->addItem( expression );
497-
cboGraduatedColumn->setCurrentIndex( cboGraduatedColumn->count() - 1 );
498-
}
499-
}
500-
501-
}
502-
503468
void QgsGraduatedSymbolRendererV2Widget::classifyGraduated()
504469
{
505-
QString attrName = cboGraduatedColumn->currentText();
470+
QString attrName = mExprressionWidget->currentField();
506471

507472
int classes = spinGraduatedClasses->value();
508473

‎src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ class GUI_EXPORT QgsGraduatedSymbolRendererV2Widget : public QgsRendererV2Widget
8181

8282
public slots:
8383
void changeGraduatedSymbol();
84-
void graduatedColumnChanged();
85-
void setExpression();
84+
void graduatedColumnChanged( QString field );
8685
void classifyGraduated();
8786
void reapplyColorRamp();
8887
void rangesDoubleClicked( const QModelIndex & idx );
@@ -113,9 +112,6 @@ class GUI_EXPORT QgsGraduatedSymbolRendererV2Widget : public QgsRendererV2Widget
113112
QList<int> selectedClasses();
114113
QgsRangeList selectedRanges();
115114

116-
//! populate column combos in categorized and graduated page
117-
void populateColumns();
118-
119115
void changeRangeSymbol( int rangeIdx );
120116
void changeRange( int rangeIdx );
121117

‎src/ui/qgscategorizedsymbolrendererv2widget.ui

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,7 @@
2424
</widget>
2525
</item>
2626
<item>
27-
<widget class="QComboBox" name="cboCategorizedColumn">
28-
<property name="sizePolicy">
29-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
30-
<horstretch>0</horstretch>
31-
<verstretch>0</verstretch>
32-
</sizepolicy>
33-
</property>
34-
<property name="maximumSize">
35-
<size>
36-
<width>300</width>
37-
<height>16777215</height>
38-
</size>
39-
</property>
40-
<property name="editable">
41-
<bool>true</bool>
42-
</property>
43-
</widget>
44-
</item>
45-
<item>
46-
<widget class="QPushButton" name="btnExpression">
47-
<property name="text">
48-
<string/>
49-
</property>
50-
<property name="icon">
51-
<iconset resource="../../images/images.qrc">
52-
<normaloff>:/images/themes/default/mIconExpressionEditorOpen.svg</normaloff>:/images/themes/default/mIconExpressionEditorOpen.svg</iconset>
53-
</property>
54-
<property name="iconSize">
55-
<size>
56-
<width>24</width>
57-
<height>16</height>
58-
</size>
59-
</property>
60-
</widget>
27+
<widget class="QgsFieldExpressionWidget" name="mExpressionWidget" native="true"/>
6128
</item>
6229
<item>
6330
<spacer name="horizontalSpacer">
@@ -229,9 +196,14 @@
229196
<extends>QComboBox</extends>
230197
<header>qgscolorrampcombobox.h</header>
231198
</customwidget>
199+
<customwidget>
200+
<class>QgsFieldExpressionWidget</class>
201+
<extends>QWidget</extends>
202+
<header location="global">qgsfieldexpressionwidget.h</header>
203+
<container>1</container>
204+
</customwidget>
232205
</customwidgets>
233206
<tabstops>
234-
<tabstop>cboCategorizedColumn</tabstop>
235207
<tabstop>btnChangeCategorizedSymbol</tabstop>
236208
<tabstop>cboCategorizedColorRamp</tabstop>
237209
<tabstop>cbxInvertedColorRamp</tabstop>
@@ -241,8 +213,6 @@
241213
<tabstop>btnDeleteAllCategories</tabstop>
242214
<tabstop>btnJoinCategories</tabstop>
243215
</tabstops>
244-
<resources>
245-
<include location="../../images/images.qrc"/>
246-
</resources>
216+
<resources/>
247217
<connections/>
248218
</ui>

‎src/ui/qgsgraduatedsymbolrendererv2widget.ui

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -128,81 +128,45 @@
128128
<property name="text">
129129
<string>Column</string>
130130
</property>
131-
<property name="buddy">
132-
<cstring>cboGraduatedColumn</cstring>
133-
</property>
134131
</widget>
135132
</item>
136-
<item row="0" column="1" colspan="3">
137-
<layout class="QHBoxLayout" name="horizontalLayout">
138-
<property name="topMargin">
139-
<number>0</number>
140-
</property>
133+
<item row="5" column="1">
134+
<layout class="QHBoxLayout" name="horizontalLayout_2">
141135
<item>
142-
<widget class="QComboBox" name="cboGraduatedColumn">
143-
<property name="sizePolicy">
144-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
145-
<horstretch>0</horstretch>
146-
<verstretch>0</verstretch>
147-
</sizepolicy>
148-
</property>
149-
<property name="maximumSize">
150-
<size>
151-
<width>300</width>
152-
<height>16777215</height>
153-
</size>
154-
</property>
155-
<property name="editable">
156-
<bool>true</bool>
157-
</property>
158-
</widget>
136+
<widget class="QgsColorRampComboBox" name="cboGraduatedColorRamp"/>
159137
</item>
160138
<item>
161-
<widget class="QPushButton" name="btnExpression">
139+
<widget class="QCheckBox" name="cbxInvertedColorRamp">
162140
<property name="text">
163-
<string/>
164-
</property>
165-
<property name="icon">
166-
<iconset resource="../../images/images.qrc">
167-
<normaloff>:/images/themes/default/mIconExpressionEditorOpen.svg</normaloff>:/images/themes/default/mIconExpressionEditorOpen.svg</iconset>
168-
</property>
169-
<property name="iconSize">
170-
<size>
171-
<width>24</width>
172-
<height>16</height>
173-
</size>
141+
<string>Invert</string>
174142
</property>
175143
</widget>
176144
</item>
145+
</layout>
146+
</item>
147+
<item row="0" column="1" colspan="3">
148+
<layout class="QHBoxLayout" name="horizontalLayout">
149+
<property name="topMargin">
150+
<number>0</number>
151+
</property>
152+
<item>
153+
<widget class="QgsFieldExpressionWidget" name="mExprressionWidget" native="true"/>
154+
</item>
177155
<item>
178156
<spacer name="horizontalSpacer">
179157
<property name="orientation">
180158
<enum>Qt::Horizontal</enum>
181159
</property>
182160
<property name="sizeHint" stdset="0">
183161
<size>
184-
<width>10</width>
162+
<width>40</width>
185163
<height>20</height>
186164
</size>
187165
</property>
188166
</spacer>
189167
</item>
190168
</layout>
191169
</item>
192-
<item row="5" column="1">
193-
<layout class="QHBoxLayout" name="horizontalLayout_2">
194-
<item>
195-
<widget class="QgsColorRampComboBox" name="cboGraduatedColorRamp"/>
196-
</item>
197-
<item>
198-
<widget class="QCheckBox" name="cbxInvertedColorRamp">
199-
<property name="text">
200-
<string>Invert</string>
201-
</property>
202-
</widget>
203-
</item>
204-
</layout>
205-
</item>
206170
</layout>
207171
</item>
208172
<item>
@@ -290,6 +254,12 @@
290254
<extends>QComboBox</extends>
291255
<header>qgscolorrampcombobox.h</header>
292256
</customwidget>
257+
<customwidget>
258+
<class>QgsFieldExpressionWidget</class>
259+
<extends>QWidget</extends>
260+
<header location="global">qgsfieldexpressionwidget.h</header>
261+
<container>1</container>
262+
</customwidget>
293263
</customwidgets>
294264
<tabstops>
295265
<tabstop>btnChangeGraduatedSymbol</tabstop>
@@ -301,8 +271,6 @@
301271
<tabstop>btnGraduatedClassify</tabstop>
302272
<tabstop>btnGraduatedDelete</tabstop>
303273
</tabstops>
304-
<resources>
305-
<include location="../../images/images.qrc"/>
306-
</resources>
274+
<resources/>
307275
<connections/>
308276
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.