mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
QgsFieldCombobBox do not allow expression
editExpression protected, setLayer uses QgsVectorLayer make epxression widget editable
This commit is contained in:
parent
760f835129
commit
86700d2426
@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @brief The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.
|
||||
* If allowed, expression may also be added at the bottom of the list of fields.
|
||||
* It can be combined with a QgsExpressioButton to set the expression using the dedicated expression builder dialog.
|
||||
* It might also be combined with a QgsMapLayerComboBox and the fields will be automatically updated according to the chosen layer.
|
||||
* @see QgsExpressioButton, QgsMapLayerComboBox
|
||||
* It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer.
|
||||
* If expression must be used, QgsFieldExpressionWidget shall be used instead.
|
||||
* @see QgsMapLayerComboBox
|
||||
* @note added in 2.3
|
||||
*/
|
||||
class QgsFieldComboBox : QComboBox
|
||||
@ -20,37 +19,23 @@ class QgsFieldComboBox : QComboBox
|
||||
*/
|
||||
explicit QgsFieldComboBox( QWidget *parent /TransferThis/ = 0 );
|
||||
|
||||
/**
|
||||
* @brief currentField returns the currently selected field or expression if allowed
|
||||
* @param isExpression determines if the string returned is the name of a field or an expression
|
||||
*/
|
||||
QString currentField( bool *isExpression = 0 );
|
||||
|
||||
//!! setAllowExpression sets if expression can be added the combo box
|
||||
void setAllowExpression( bool allowExpression );
|
||||
//! returns if the widget allows expressions to be added or not
|
||||
bool allowExpression();
|
||||
|
||||
//! return the currently selected field
|
||||
QString currentField();
|
||||
|
||||
//! Returns the currently used layer
|
||||
QgsVectorLayer* layer();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief setField sets the currently selected field
|
||||
* if expressions are allowed in the widget,
|
||||
* then it will either set it as selected
|
||||
* if it already exists, or it will add it otherwise
|
||||
*/
|
||||
//! the signal is emitted when the currently selected field changes
|
||||
void fieldChanged( QString fieldName );
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief setLayer sets the layer of which the fields are listed
|
||||
*/
|
||||
//! set the layer of which the fields are listed
|
||||
void setLayer( QgsMapLayer* layer );
|
||||
/**
|
||||
* @brief setField sets the currently selected field
|
||||
*/
|
||||
|
||||
//! setField sets the currently selected field
|
||||
void setField( QString fieldName );
|
||||
|
||||
protected slots:
|
||||
void indexChanged( int i );
|
||||
};
|
||||
|
@ -17,12 +17,6 @@ class QgsFieldExpressionWidget : QWidget
|
||||
//! set the geometry calculator used in the expression dialog
|
||||
void setGeomCalculator( const QgsDistanceArea &da );
|
||||
|
||||
//! return a pointer to the combo box in the widget
|
||||
QgsFieldComboBox* fieldComboBox();
|
||||
|
||||
//! return a pointer to the tool button used in the widget
|
||||
QToolButton* toolButton();
|
||||
|
||||
/**
|
||||
* @brief currentField returns the currently selected field or expression if allowed
|
||||
* @param isExpression determines if the string returned is the name of a field or an expression
|
||||
@ -32,6 +26,10 @@ class QgsFieldExpressionWidget : QWidget
|
||||
//! Returns the currently used layer
|
||||
QgsVectorLayer* layer();
|
||||
|
||||
signals:
|
||||
//! the signal is emitted when the currently selected field changes
|
||||
void fieldChanged( QString fieldName );
|
||||
|
||||
public slots:
|
||||
//! set the layer used to display the fields and expression
|
||||
void setLayer( QgsMapLayer* layer );
|
||||
@ -39,6 +37,12 @@ class QgsFieldExpressionWidget : QWidget
|
||||
//! sets the current field or expression in the widget
|
||||
void setField( QString fieldName );
|
||||
|
||||
protected slots:
|
||||
//! open the expression dialog to edit the current or add a new expression
|
||||
void editExpression();
|
||||
|
||||
//! when expression is edited by the user in the line edit
|
||||
void expressionEdited( QString expression );
|
||||
|
||||
void indexChanged( int i );
|
||||
};
|
||||
|
@ -13,9 +13,12 @@ class QgsFieldModel : QAbstractItemModel
|
||||
|
||||
public:
|
||||
enum FieldRoles {
|
||||
FieldNameRole = 33, /* Qt::UserRole + 1, SIP does not accept any arithmetic" */
|
||||
FieldIndexRole = 34,
|
||||
ExpressionRole = 35
|
||||
/* SIP does not accept any arithmetic" */
|
||||
FieldNameRole = 33, /* return field name if index corresponds to a field */
|
||||
FieldIndexRole = 34, /* return field index if index corresponds to a field */
|
||||
ExpressionRole = 35, /* return field name or expression */
|
||||
IsExpressionRole = 36, /* return if index corresponds to an expression */
|
||||
ExpressionValidityRole = 37 /* return if expression is valid or not */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -23,14 +26,10 @@ class QgsFieldModel : QAbstractItemModel
|
||||
*/
|
||||
explicit QgsFieldModel( QObject *parent /TransferThis/ = 0 );
|
||||
|
||||
/**
|
||||
* @brief indexFromName returns the index corresponding to a given fieldName
|
||||
*/
|
||||
//! return the index corresponding to a given fieldName
|
||||
QModelIndex indexFromName( QString fieldName );
|
||||
|
||||
/**
|
||||
* @brief setAllowExpression determines if expressions are allowed to be added to the model
|
||||
*/
|
||||
//! returns the currently used layer
|
||||
void setAllowExpression( bool allowExpression );
|
||||
bool allowExpression();
|
||||
|
||||
@ -39,19 +38,20 @@ class QgsFieldModel : QAbstractItemModel
|
||||
* @return the model index of the newly added expression
|
||||
*/
|
||||
QModelIndex setExpression( QString expression );
|
||||
|
||||
//! remove expressions from the model
|
||||
void removeExpression();
|
||||
|
||||
/**
|
||||
* @brief layer returns the currently used layer
|
||||
*/
|
||||
//! returns the currently used layer
|
||||
QgsMapLayer* layer();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief setLayer sets the layer of whch fields are displayed
|
||||
*/
|
||||
//! set the layer of whch fields are displayed
|
||||
void setLayer( QgsMapLayer *layer );
|
||||
|
||||
|
||||
protected slots:
|
||||
virtual void updateModel();
|
||||
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
|
||||
|
@ -14,13 +14,12 @@ class QgsCategorizedSymbolRendererV2Widget : QgsRendererV2Widget
|
||||
|
||||
public slots:
|
||||
void changeCategorizedSymbol();
|
||||
void categoryColumnChanged();
|
||||
void categoryColumnChanged( QString field );
|
||||
void categoriesDoubleClicked( const QModelIndex & idx );
|
||||
void addCategory();
|
||||
void addCategories();
|
||||
void deleteCategories();
|
||||
void deleteAllCategories();
|
||||
void setExpression();
|
||||
|
||||
void rotationFieldChanged( QString fldName );
|
||||
void sizeScaleFieldChanged( QString fldName );
|
||||
@ -39,9 +38,6 @@ class QgsCategorizedSymbolRendererV2Widget : QgsRendererV2Widget
|
||||
// Called by virtual refreshSymbolView()
|
||||
void populateCategories();
|
||||
|
||||
//! populate column combo
|
||||
void populateColumns();
|
||||
|
||||
//! return row index for the currently selected category (-1 if on no selection)
|
||||
int currentCategoryRow();
|
||||
|
||||
|
@ -13,8 +13,7 @@ class QgsGraduatedSymbolRendererV2Widget : QgsRendererV2Widget
|
||||
|
||||
public slots:
|
||||
void changeGraduatedSymbol();
|
||||
void graduatedColumnChanged();
|
||||
void setExpression();
|
||||
void graduatedColumnChanged( QString field );
|
||||
void classifyGraduated();
|
||||
void reapplyColorRamp();
|
||||
void rangesDoubleClicked( const QModelIndex & idx );
|
||||
@ -45,9 +44,6 @@ class QgsGraduatedSymbolRendererV2Widget : QgsRendererV2Widget
|
||||
QList<int> selectedClasses();
|
||||
QgsRangeList selectedRanges();
|
||||
|
||||
//! populate column combos in categorized and graduated page
|
||||
void populateColumns();
|
||||
|
||||
void changeRangeSymbol( int rangeIdx );
|
||||
void changeRange( int rangeIdx );
|
||||
|
||||
|
@ -47,25 +47,15 @@ void QgsFieldComboBox::setField( QString fieldName )
|
||||
if ( idx.isValid() )
|
||||
{
|
||||
setCurrentIndex( idx.row() );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mAllowExpression )
|
||||
else
|
||||
{
|
||||
mFieldModel->setExpression( fieldName );
|
||||
setCurrentIndex( findText( fieldName ) );
|
||||
return;
|
||||
setCurrentIndex( -1 );
|
||||
}
|
||||
setCurrentIndex( -1 );
|
||||
}
|
||||
|
||||
QString QgsFieldComboBox::currentField( bool *isExpression )
|
||||
QString QgsFieldComboBox::currentField()
|
||||
{
|
||||
if ( isExpression )
|
||||
{
|
||||
*isExpression = false;
|
||||
}
|
||||
|
||||
int i = currentIndex();
|
||||
|
||||
const QModelIndex index = mFieldModel->index( i, 0 );
|
||||
@ -74,31 +64,8 @@ QString QgsFieldComboBox::currentField( bool *isExpression )
|
||||
return "";
|
||||
}
|
||||
|
||||
QString fieldName = mFieldModel->data( index, QgsFieldModel::FieldNameRole ).toString();
|
||||
if ( !fieldName.isEmpty() )
|
||||
{
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
if ( mAllowExpression )
|
||||
{
|
||||
QString expression = mFieldModel->data( index, QgsFieldModel::ExpressionRole ).toString();
|
||||
if ( !expression.isEmpty() )
|
||||
{
|
||||
if ( isExpression )
|
||||
{
|
||||
*isExpression = true;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void QgsFieldComboBox::setAllowExpression( bool allowExpression )
|
||||
{
|
||||
mFieldModel->setAllowExpression( allowExpression );
|
||||
QString name = mFieldModel->data( index, QgsFieldModel::FieldNameRole ).toString();
|
||||
return name;
|
||||
}
|
||||
|
||||
void QgsFieldComboBox::indexChanged( int i )
|
||||
|
@ -24,10 +24,9 @@ class QgsVectorLayer;
|
||||
|
||||
/**
|
||||
* @brief The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.
|
||||
* If allowed, expression may also be added at the bottom of the list of fields.
|
||||
* It can be combined with a QgsExpressioButton to set the expression using the dedicated expression builder dialog.
|
||||
* It might also be combined with a QgsMapLayerComboBox and the fields will be automatically updated according to the chosen layer.
|
||||
* @see QgsExpressioButton, QgsMapLayerComboBox
|
||||
* It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer.
|
||||
* If expression must be used, QgsFieldExpressionWidget shall be used instead.
|
||||
* @see QgsMapLayerComboBox
|
||||
* @note added in 2.3
|
||||
*/
|
||||
class GUI_EXPORT QgsFieldComboBox : public QComboBox
|
||||
@ -40,38 +39,21 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox
|
||||
*/
|
||||
explicit QgsFieldComboBox( QWidget *parent = 0 );
|
||||
|
||||
/**
|
||||
* @brief currentField returns the currently selected field or expression if allowed
|
||||
* @param isExpression determines if the string returned is the name of a field or an expression
|
||||
*/
|
||||
QString currentField( bool *isExpression = 0 );
|
||||
|
||||
//!! setAllowExpression sets if expression can be added the combo box
|
||||
void setAllowExpression( bool allowExpression );
|
||||
//! returns if the widget allows expressions to be added or not
|
||||
bool allowExpression() { return mAllowExpression; }
|
||||
//! return the currently selected field
|
||||
QString currentField();
|
||||
|
||||
//! Returns the currently used layer
|
||||
QgsVectorLayer* layer();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief fieldChanged the signal is emitted when the currently selected field changes
|
||||
*/
|
||||
//! the signal is emitted when the currently selected field changes
|
||||
void fieldChanged( QString fieldName );
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief setLayer sets the layer of which the fields are listed
|
||||
*/
|
||||
//! set the layer of which the fields are listed
|
||||
void setLayer( QgsMapLayer* layer );
|
||||
|
||||
/**
|
||||
* @brief setField sets the currently selected field
|
||||
* if expressions are allowed in the widget,
|
||||
* then it will either set it as selected
|
||||
* if it already exists, or it will add it otherwise
|
||||
*/
|
||||
//! setField sets the currently selected field
|
||||
void setField( QString fieldName );
|
||||
|
||||
protected slots:
|
||||
@ -79,8 +61,6 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox
|
||||
|
||||
private:
|
||||
QgsFieldModel* mFieldModel;
|
||||
bool mAllowExpression;
|
||||
|
||||
};
|
||||
|
||||
#endif // QGSFIELDCOMBOBOX_H
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
/***************************************************************************
|
||||
qgsfieldexpressionwidget.cpp
|
||||
--------------------------------------
|
||||
@ -18,7 +19,7 @@
|
||||
#include "qgsapplication.h"
|
||||
#include "qgsfieldexpressionwidget.h"
|
||||
#include "qgsexpressionbuilderdialog.h"
|
||||
#include "qgsfieldcombobox.h"
|
||||
#include "qgsfieldmodel.h"
|
||||
#include "qgsdistancearea.h"
|
||||
|
||||
QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
|
||||
@ -28,15 +29,22 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent )
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout( this );
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
mCombo = new QgsFieldComboBox( this );
|
||||
mCombo->setAllowExpression( true );
|
||||
mCombo = new QComboBox( this );
|
||||
mCombo->setEditable( true );
|
||||
mCombo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
|
||||
layout->addWidget( mCombo );
|
||||
mFieldModel = new QgsFieldModel( mCombo );
|
||||
mFieldModel->setAllowExpression( true );
|
||||
mCombo->setModel( mFieldModel );
|
||||
|
||||
mButton = new QToolButton( this );
|
||||
mButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::MinimumExpanding );
|
||||
mButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
|
||||
mButton->setIcon( QgsApplication::getThemeIcon( "/mIconExpressionEditorOpen.svg" ) );
|
||||
|
||||
layout->addWidget( mCombo );
|
||||
layout->addWidget( mButton );
|
||||
|
||||
connect( mCombo->lineEdit(), SIGNAL( textEdited( QString ) ), this, SLOT( expressionEdited( QString ) ) );
|
||||
connect( mCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( indexChanged( int ) ) );
|
||||
connect( mButton, SIGNAL( clicked() ), this, SLOT( editExpression() ) );
|
||||
}
|
||||
|
||||
@ -50,45 +58,88 @@ void QgsFieldExpressionWidget::setGeomCalculator( const QgsDistanceArea &da )
|
||||
mDa = QSharedPointer<const QgsDistanceArea>( new QgsDistanceArea( da ) );
|
||||
}
|
||||
|
||||
QgsFieldComboBox *QgsFieldExpressionWidget::fieldComboBox()
|
||||
{
|
||||
return mCombo;
|
||||
}
|
||||
|
||||
QToolButton *QgsFieldExpressionWidget::toolButton()
|
||||
{
|
||||
return mButton;
|
||||
}
|
||||
|
||||
QString QgsFieldExpressionWidget::currentField( bool *isExpression )
|
||||
{
|
||||
return mCombo->currentField( isExpression );
|
||||
if ( isExpression )
|
||||
{
|
||||
*isExpression = false;
|
||||
}
|
||||
|
||||
int i = mCombo->currentIndex();
|
||||
|
||||
const QModelIndex index = mFieldModel->index( i, 0 );
|
||||
if ( !index.isValid() )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if ( isExpression )
|
||||
{
|
||||
*isExpression = mFieldModel->data( index, QgsFieldModel::IsExpressionRole ).toBool();
|
||||
}
|
||||
QString expression = mFieldModel->data( index, QgsFieldModel::ExpressionRole ).toString();
|
||||
return expression;
|
||||
}
|
||||
|
||||
QgsVectorLayer *QgsFieldExpressionWidget::layer()
|
||||
{
|
||||
return mCombo->layer();
|
||||
QgsMapLayer* layer = mFieldModel->layer();
|
||||
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer );
|
||||
if ( vl )
|
||||
return vl;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QgsFieldExpressionWidget::setLayer( QgsMapLayer *layer )
|
||||
void QgsFieldExpressionWidget::setLayer( QgsVectorLayer *layer )
|
||||
{
|
||||
mCombo->setLayer( layer );
|
||||
mFieldModel->setLayer( layer );
|
||||
}
|
||||
|
||||
void QgsFieldExpressionWidget::setField( QString fieldName )
|
||||
{
|
||||
mCombo->setField( fieldName );
|
||||
QModelIndex idx = mFieldModel->indexFromName( fieldName );
|
||||
bool isExpression ;
|
||||
if ( idx.isValid() )
|
||||
{
|
||||
isExpression = mFieldModel->data( idx, QgsFieldModel::IsExpressionRole ).toBool();
|
||||
}
|
||||
else
|
||||
{
|
||||
// new expression
|
||||
idx = mFieldModel->setExpression( fieldName );
|
||||
isExpression = true;
|
||||
}
|
||||
mCombo->setCurrentIndex( idx.row() );
|
||||
|
||||
QFont font;
|
||||
font.setItalic( isExpression );
|
||||
mCombo->lineEdit()->setFont( font );
|
||||
|
||||
QPalette palette;
|
||||
palette.setColor( QPalette::Text, Qt::black );
|
||||
if ( isExpression )
|
||||
{
|
||||
bool isValid = mFieldModel->data( idx, QgsFieldModel::ExpressionValidityRole ).toBool();
|
||||
if ( !isValid )
|
||||
{
|
||||
palette.setColor( QPalette::Text, Qt::red );
|
||||
}
|
||||
}
|
||||
mCombo->lineEdit()->setPalette( palette );
|
||||
|
||||
emit fieldChanged( currentField() );
|
||||
}
|
||||
|
||||
void QgsFieldExpressionWidget::editExpression()
|
||||
{
|
||||
QString currentExpression = mCombo->currentField();
|
||||
QgsVectorLayer* layer = mCombo->layer();
|
||||
QString currentExpression = currentField();
|
||||
QgsVectorLayer* vl = layer();
|
||||
|
||||
if ( !layer )
|
||||
if ( !vl )
|
||||
return;
|
||||
|
||||
QgsExpressionBuilderDialog dlg( layer, currentExpression );
|
||||
QgsExpressionBuilderDialog dlg( vl, currentExpression );
|
||||
if ( !mDa.isNull() )
|
||||
{
|
||||
dlg.setGeomCalculator( *mDa );
|
||||
@ -98,7 +149,19 @@ void QgsFieldExpressionWidget::editExpression()
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
QString newExpression = dlg.expressionText();
|
||||
mCombo->setField( newExpression );
|
||||
setField( newExpression );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QgsFieldExpressionWidget::expressionEdited( QString expression )
|
||||
{
|
||||
mFieldModel->removeExpression();
|
||||
setField( expression );
|
||||
}
|
||||
|
||||
void QgsFieldExpressionWidget::indexChanged( int i )
|
||||
{
|
||||
Q_UNUSED( i );
|
||||
QString name = currentField();
|
||||
emit fieldChanged( name );
|
||||
}
|
||||
|
@ -19,12 +19,14 @@
|
||||
#include <QSharedPointer>
|
||||
#include <QWidget>
|
||||
#include <QToolButton>
|
||||
#include <QComboBox>
|
||||
#include <QColor>
|
||||
|
||||
#include "qgsdistancearea.h"
|
||||
|
||||
class QgsFieldComboBox;
|
||||
class QgsMapLayer;
|
||||
class QgsVectorLayer;
|
||||
class QgsFieldModel;
|
||||
|
||||
|
||||
class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
|
||||
@ -42,12 +44,6 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
|
||||
//! set the geometry calculator used in the expression dialog
|
||||
void setGeomCalculator( const QgsDistanceArea &da );
|
||||
|
||||
//! return a pointer to the combo box in the widget
|
||||
QgsFieldComboBox* fieldComboBox();
|
||||
|
||||
//! return a pointer to the tool button used in the widget
|
||||
QToolButton* toolButton();
|
||||
|
||||
/**
|
||||
* @brief currentField returns the currently selected field or expression if allowed
|
||||
* @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
|
||||
//! Returns the currently used layer
|
||||
QgsVectorLayer* layer();
|
||||
|
||||
signals:
|
||||
//! the signal is emitted when the currently selected field changes
|
||||
void fieldChanged( QString fieldName );
|
||||
|
||||
public slots:
|
||||
//! set the layer used to display the fields and expression
|
||||
void setLayer( QgsMapLayer* layer );
|
||||
void setLayer( QgsVectorLayer* layer );
|
||||
|
||||
//! sets the current field or expression in the widget
|
||||
void setField( QString fieldName );
|
||||
|
||||
protected slots:
|
||||
//! open the expression dialog to edit the current or add a new expression
|
||||
void editExpression();
|
||||
|
||||
//! when expression is edited by the user in the line edit
|
||||
void expressionEdited( QString expression );
|
||||
|
||||
void indexChanged( int i );
|
||||
|
||||
private:
|
||||
QgsFieldComboBox* mCombo;
|
||||
QComboBox* mCombo;
|
||||
QToolButton* mButton;
|
||||
QgsFieldModel* mFieldModel;
|
||||
QString mExpressionDialogTitle;
|
||||
QSharedPointer<const QgsDistanceArea> mDa;
|
||||
|
||||
QString color2rgbaStr( QColor color );
|
||||
};
|
||||
|
||||
#endif // QGSFIELDEXPRESSIONWIDGET_H
|
||||
|
@ -42,10 +42,6 @@ QModelIndex QgsFieldModel::indexFromName( QString fieldName )
|
||||
{
|
||||
return index( mFields.count() + exprIdx , 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return setExpression( fieldName );
|
||||
}
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
@ -122,9 +118,22 @@ QModelIndex QgsFieldModel::setExpression( QString expression )
|
||||
mExpression = QList<QString>() << expression;
|
||||
endResetModel();
|
||||
|
||||
// fetch feature to be evaluate the expression
|
||||
if ( !mFeature.isValid() )
|
||||
{
|
||||
mLayer->getFeatures().nextFeature( mFeature );
|
||||
}
|
||||
|
||||
return index( mFields.count() , 0 );
|
||||
}
|
||||
|
||||
void QgsFieldModel::removeExpression()
|
||||
{
|
||||
beginResetModel();
|
||||
mExpression = QList<QString>();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
QModelIndex QgsFieldModel::index( int row, int column, const QModelIndex &parent ) const
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
@ -160,57 +169,110 @@ QVariant QgsFieldModel::data( const QModelIndex &index, int role ) const
|
||||
if ( !mLayer )
|
||||
return QVariant();
|
||||
|
||||
if ( role == FieldNameRole )
|
||||
{
|
||||
int exprIdx = index.internalId() - mFields.count();
|
||||
if ( exprIdx >= 0 )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
QgsField field = mFields[index.internalId()];
|
||||
return field.name();
|
||||
}
|
||||
int exprIdx = index.internalId() - mFields.count();
|
||||
|
||||
if ( role == ExpressionRole )
|
||||
switch ( role )
|
||||
{
|
||||
int exprIdx = index.internalId() - mFields.count();
|
||||
if ( exprIdx >= 0 )
|
||||
case FieldNameRole:
|
||||
{
|
||||
return mExpression[exprIdx];
|
||||
if ( exprIdx >= 0 )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
QgsField field = mFields[index.internalId()];
|
||||
return field.name();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
if ( role == FieldIndexRole )
|
||||
{
|
||||
if ( index.internalId() >= mFields.count() )
|
||||
case ExpressionRole:
|
||||
{
|
||||
if ( exprIdx >= 0 )
|
||||
{
|
||||
return mExpression[exprIdx];
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsField field = mFields[index.internalId()];
|
||||
return field.name();
|
||||
}
|
||||
}
|
||||
|
||||
case FieldIndexRole:
|
||||
{
|
||||
if ( exprIdx >= 0 )
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
return index.internalId();
|
||||
}
|
||||
|
||||
case IsExpressionRole:
|
||||
{
|
||||
return exprIdx >= 0;
|
||||
}
|
||||
|
||||
case ExpressionValidityRole:
|
||||
{
|
||||
if ( exprIdx >= 0 )
|
||||
{
|
||||
QgsExpression exp( mExpression[exprIdx] );
|
||||
if ( mFeature.isValid() )
|
||||
{
|
||||
exp.evaluate( &mFeature, mLayer->pendingFields() );
|
||||
return !exp.hasEvalError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
{
|
||||
if ( exprIdx >= 0 )
|
||||
{
|
||||
return mExpression[exprIdx];
|
||||
}
|
||||
QgsField field = mFields[index.internalId()];
|
||||
const QMap< QString, QString > aliases = mLayer->attributeAliases();
|
||||
QString alias = aliases.value( field.name(), field.name() );
|
||||
return alias;
|
||||
}
|
||||
|
||||
case Qt::BackgroundRole:
|
||||
{
|
||||
if ( exprIdx >= 0 )
|
||||
{
|
||||
// if expression, test validity
|
||||
QgsExpression exp( mExpression[exprIdx] );
|
||||
|
||||
if ( mFeature.isValid() )
|
||||
{
|
||||
exp.evaluate( &mFeature, mLayer->pendingFields() );
|
||||
if ( exp.hasEvalError() )
|
||||
{
|
||||
return QBrush( QColor( 240, 60, 60, 180 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
return index.internalId();
|
||||
}
|
||||
|
||||
if ( role == Qt::DisplayRole )
|
||||
{
|
||||
int exprIdx = index.internalId() - mFields.count();
|
||||
if ( exprIdx >= 0 )
|
||||
case Qt::FontRole:
|
||||
{
|
||||
return mExpression[exprIdx];
|
||||
if ( exprIdx >= 0 )
|
||||
{
|
||||
// if the line is an expression, set it as italic
|
||||
QFont font;
|
||||
font.setItalic( true );
|
||||
return font;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
QgsField field = mFields[index.internalId()];
|
||||
const QMap< QString, QString > aliases = mLayer->attributeAliases();
|
||||
QString alias = aliases.value( field.name(), field.name() );
|
||||
return alias;
|
||||
}
|
||||
|
||||
if ( role == Qt::FontRole && index.internalId() >= mFields.count() )
|
||||
{
|
||||
// if the line is an expression, set it as italic
|
||||
QFont font;
|
||||
font.setItalic( true );
|
||||
return font;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "qgsvectorlayer.h"
|
||||
|
||||
class QgsFeature;
|
||||
|
||||
/**
|
||||
* @brief The QgsFieldModel class is a model to display the list of fields of a layer in widgets.
|
||||
* If allowed, expressions might be added to the end of the model.
|
||||
@ -34,9 +36,11 @@ class GUI_EXPORT QgsFieldModel : public QAbstractItemModel
|
||||
public:
|
||||
enum FieldRoles
|
||||
{
|
||||
FieldNameRole = Qt::UserRole + 1,
|
||||
FieldIndexRole = Qt::UserRole + 2,
|
||||
ExpressionRole = Qt::UserRole + 3
|
||||
FieldNameRole = Qt::UserRole + 1, /* return field name if index corresponds to a field */
|
||||
FieldIndexRole = Qt::UserRole + 2, /* return field index if index corresponds to a field */
|
||||
ExpressionRole = Qt::UserRole + 3, /* return field name or expression */
|
||||
IsExpressionRole = Qt::UserRole + 4, /* return if index corresponds to an expression */
|
||||
ExpressionValidityRole = Qt::UserRole + 5 /* return if expression is valid or not */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -44,14 +48,10 @@ class GUI_EXPORT QgsFieldModel : public QAbstractItemModel
|
||||
*/
|
||||
explicit QgsFieldModel( QObject *parent = 0 );
|
||||
|
||||
/**
|
||||
* @brief indexFromName returns the index corresponding to a given fieldName
|
||||
*/
|
||||
//! return the index corresponding to a given fieldName
|
||||
QModelIndex indexFromName( QString fieldName );
|
||||
|
||||
/**
|
||||
* @brief setAllowExpression determines if expressions are allowed to be added to the model
|
||||
*/
|
||||
//! returns the currently used layer
|
||||
void setAllowExpression( bool allowExpression );
|
||||
bool allowExpression() {return mAllowExpression;}
|
||||
|
||||
@ -61,15 +61,14 @@ class GUI_EXPORT QgsFieldModel : public QAbstractItemModel
|
||||
*/
|
||||
QModelIndex setExpression( QString expression );
|
||||
|
||||
/**
|
||||
* @brief layer returns the currently used layer
|
||||
*/
|
||||
//! remove expressions from the model
|
||||
void removeExpression();
|
||||
|
||||
//! returns the currently used layer
|
||||
QgsMapLayer* layer() {return mLayer;}
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief setLayer sets the layer of whch fields are displayed
|
||||
*/
|
||||
//! set the layer of whch fields are displayed
|
||||
void setLayer( QgsMapLayer *layer );
|
||||
|
||||
protected slots:
|
||||
@ -85,6 +84,11 @@ class GUI_EXPORT QgsFieldModel : public QAbstractItemModel
|
||||
QgsVectorLayer* mLayer;
|
||||
bool mAllowExpression;
|
||||
|
||||
private:
|
||||
QgsFeature mFeature;
|
||||
|
||||
void fetchFeature();
|
||||
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
|
||||
|
@ -368,7 +368,7 @@ QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsV
|
||||
// setup user interface
|
||||
setupUi( this );
|
||||
|
||||
populateColumns();
|
||||
mExpressionWidget->setLayer( mLayer );
|
||||
|
||||
cboCategorizedColorRamp->populate( mStyle );
|
||||
int randomIndex = cboCategorizedColorRamp->findText( tr( "Random colors" ) );
|
||||
@ -399,7 +399,7 @@ QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsV
|
||||
|
||||
connect( mModel, SIGNAL( rowsMoved() ), this, SLOT( rowsMoved() ) );
|
||||
|
||||
connect( cboCategorizedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( categoryColumnChanged() ) );
|
||||
connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( categoryColumnChanged( QString ) ) );
|
||||
|
||||
connect( viewCategories, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( categoriesDoubleClicked( const QModelIndex & ) ) );
|
||||
connect( viewCategories, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenuViewCategories( const QPoint& ) ) );
|
||||
@ -410,7 +410,6 @@ QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsV
|
||||
connect( btnDeleteAllCategories, SIGNAL( clicked() ), this, SLOT( deleteAllCategories() ) );
|
||||
connect( btnAddCategory, SIGNAL( clicked() ), this, SLOT( addCategory() ) );
|
||||
|
||||
connect( btnExpression, SIGNAL( clicked() ), this, SLOT( setExpression() ) );
|
||||
// update GUI from renderer
|
||||
updateUiFromRenderer();
|
||||
|
||||
@ -440,17 +439,11 @@ void QgsCategorizedSymbolRendererV2Widget::updateUiFromRenderer()
|
||||
//mModel->setRenderer ( mRenderer ); // necessary?
|
||||
|
||||
// set column
|
||||
disconnect( cboCategorizedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( categoryColumnChanged() ) );
|
||||
disconnect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( categoryColumnChanged( QString ) ) );
|
||||
QString attrName = mRenderer->classAttribute();
|
||||
mOldClassificationAttribute = attrName;
|
||||
int idx = cboCategorizedColumn->findText( attrName, Qt::MatchExactly );
|
||||
if ( idx == -1 )
|
||||
{
|
||||
cboCategorizedColumn->addItem( attrName );
|
||||
idx = cboCategorizedColumn->count() - 1;
|
||||
}
|
||||
cboCategorizedColumn->setCurrentIndex( idx );
|
||||
connect( cboCategorizedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( categoryColumnChanged() ) );
|
||||
mExpressionWidget->setField( attrName );
|
||||
connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( categoryColumnChanged( QString ) ) );
|
||||
|
||||
|
||||
// set source symbol
|
||||
if ( mRenderer->sourceSymbol() )
|
||||
@ -537,19 +530,9 @@ void QgsCategorizedSymbolRendererV2Widget::populateCategories()
|
||||
{
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRendererV2Widget::populateColumns()
|
||||
void QgsCategorizedSymbolRendererV2Widget::categoryColumnChanged( QString field )
|
||||
{
|
||||
cboCategorizedColumn->clear();
|
||||
const QgsFields& flds = mLayer->pendingFields();
|
||||
for ( int idx = 0; idx < flds.count(); ++idx )
|
||||
{
|
||||
cboCategorizedColumn->addItem( flds[idx].name() );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRendererV2Widget::categoryColumnChanged()
|
||||
{
|
||||
mRenderer->setClassAttribute( cboCategorizedColumn->currentText() );
|
||||
mRenderer->setClassAttribute( field );
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRendererV2Widget::categoriesDoubleClicked( const QModelIndex & idx )
|
||||
@ -617,7 +600,7 @@ static void _createCategories( QgsCategoryList& cats, QList<QVariant>& values, Q
|
||||
|
||||
void QgsCategorizedSymbolRendererV2Widget::addCategories()
|
||||
{
|
||||
QString attrName = cboCategorizedColumn->currentText();
|
||||
QString attrName = mExpressionWidget->currentField();
|
||||
int idx = mLayer->fieldNameIndex( attrName );
|
||||
QList<QVariant> unique_vals;
|
||||
if ( idx == -1 )
|
||||
@ -782,22 +765,6 @@ void QgsCategorizedSymbolRendererV2Widget::deleteAllCategories()
|
||||
mModel->removeAllRows();
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRendererV2Widget::setExpression()
|
||||
{
|
||||
QgsExpressionBuilderDialog dlg( mLayer, cboCategorizedColumn->currentText(), this );
|
||||
dlg.setWindowTitle( "Set column expression" );
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
QString expression = dlg.expressionText();
|
||||
if ( !expression.isEmpty() )
|
||||
{
|
||||
cboCategorizedColumn->addItem( expression );
|
||||
cboCategorizedColumn->setCurrentIndex( cboCategorizedColumn->count() - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRendererV2Widget::addCategory()
|
||||
{
|
||||
if ( !mModel ) return;
|
||||
|
@ -81,13 +81,12 @@ class GUI_EXPORT QgsCategorizedSymbolRendererV2Widget : public QgsRendererV2Widg
|
||||
|
||||
public slots:
|
||||
void changeCategorizedSymbol();
|
||||
void categoryColumnChanged();
|
||||
void categoryColumnChanged( QString field );
|
||||
void categoriesDoubleClicked( const QModelIndex & idx );
|
||||
void addCategory();
|
||||
void addCategories();
|
||||
void deleteCategories();
|
||||
void deleteAllCategories();
|
||||
void setExpression();
|
||||
|
||||
void rotationFieldChanged( QString fldName );
|
||||
void sizeScaleFieldChanged( QString fldName );
|
||||
@ -106,9 +105,6 @@ class GUI_EXPORT QgsCategorizedSymbolRendererV2Widget : public QgsRendererV2Widg
|
||||
// Called by virtual refreshSymbolView()
|
||||
void populateCategories();
|
||||
|
||||
//! populate column combo
|
||||
void populateColumns();
|
||||
|
||||
//! return row index for the currently selected category (-1 if on no selection)
|
||||
int currentCategoryRow();
|
||||
|
||||
|
@ -358,7 +358,7 @@ QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVecto
|
||||
// setup user interface
|
||||
setupUi( this );
|
||||
|
||||
populateColumns();
|
||||
mExprressionWidget->setLayer( mLayer );
|
||||
|
||||
cboGraduatedColorRamp->populate( mStyle );
|
||||
|
||||
@ -382,8 +382,7 @@ QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVecto
|
||||
|
||||
mGraduatedSymbol = QgsSymbolV2::defaultSymbol( mLayer->geometryType() );
|
||||
|
||||
connect( cboGraduatedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( graduatedColumnChanged() ) );
|
||||
connect( btnExpression, SIGNAL( clicked() ), this, SLOT( setExpression() ) );
|
||||
connect( mExprressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) );
|
||||
connect( viewGraduated, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( rangesDoubleClicked( const QModelIndex & ) ) );
|
||||
connect( viewGraduated, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( rangesClicked( const QModelIndex & ) ) );
|
||||
connect( viewGraduated, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenuViewCategories( const QPoint& ) ) );
|
||||
@ -439,16 +438,10 @@ void QgsGraduatedSymbolRendererV2Widget::updateUiFromRenderer()
|
||||
spinGraduatedClasses->setValue( mRenderer->ranges().count() );
|
||||
|
||||
// set column
|
||||
disconnect( cboGraduatedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( graduatedColumnChanged() ) );
|
||||
disconnect( mExprressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) );
|
||||
QString attrName = mRenderer->classAttribute();
|
||||
int idx = cboGraduatedColumn->findText( attrName, Qt::MatchExactly );
|
||||
if ( idx == -1 )
|
||||
{
|
||||
cboGraduatedColumn->addItem( attrName );
|
||||
idx = cboGraduatedColumn->count() - 1;
|
||||
}
|
||||
cboGraduatedColumn->setCurrentIndex( idx );
|
||||
connect( cboGraduatedColumn, SIGNAL( currentIndexChanged( int ) ), this, SLOT( graduatedColumnChanged() ) );
|
||||
mExprressionWidget->setField( attrName );
|
||||
connect( mExprressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( graduatedColumnChanged( QString ) ) );
|
||||
|
||||
// set source symbol
|
||||
if ( mRenderer->sourceSymbol() )
|
||||
@ -466,43 +459,15 @@ void QgsGraduatedSymbolRendererV2Widget::updateUiFromRenderer()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRendererV2Widget::populateColumns()
|
||||
void QgsGraduatedSymbolRendererV2Widget::graduatedColumnChanged( QString field )
|
||||
{
|
||||
cboGraduatedColumn->clear();
|
||||
const QgsFields& flds = mLayer->pendingFields();
|
||||
for ( int idx = 0; idx < flds.count(); ++idx )
|
||||
{
|
||||
if ( flds[idx].type() == QVariant::Double || flds[idx].type() == QVariant::Int || flds[idx].type() == QVariant::LongLong )
|
||||
cboGraduatedColumn->addItem( flds[idx].name() );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRendererV2Widget::graduatedColumnChanged()
|
||||
{
|
||||
mRenderer->setClassAttribute( cboGraduatedColumn->currentText() );
|
||||
mRenderer->setClassAttribute( field );
|
||||
classifyGraduated();
|
||||
}
|
||||
|
||||
|
||||
void QgsGraduatedSymbolRendererV2Widget::setExpression()
|
||||
{
|
||||
QgsExpressionBuilderDialog dlg( mLayer, cboGraduatedColumn->currentText(), this );
|
||||
dlg.setWindowTitle( "Set column expression" );
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
QString expression = dlg.expressionText();
|
||||
if ( !expression.isEmpty() )
|
||||
{
|
||||
cboGraduatedColumn->addItem( expression );
|
||||
cboGraduatedColumn->setCurrentIndex( cboGraduatedColumn->count() - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRendererV2Widget::classifyGraduated()
|
||||
{
|
||||
QString attrName = cboGraduatedColumn->currentText();
|
||||
QString attrName = mExprressionWidget->currentField();
|
||||
|
||||
int classes = spinGraduatedClasses->value();
|
||||
|
||||
|
@ -81,8 +81,7 @@ class GUI_EXPORT QgsGraduatedSymbolRendererV2Widget : public QgsRendererV2Widget
|
||||
|
||||
public slots:
|
||||
void changeGraduatedSymbol();
|
||||
void graduatedColumnChanged();
|
||||
void setExpression();
|
||||
void graduatedColumnChanged( QString field );
|
||||
void classifyGraduated();
|
||||
void reapplyColorRamp();
|
||||
void rangesDoubleClicked( const QModelIndex & idx );
|
||||
@ -113,9 +112,6 @@ class GUI_EXPORT QgsGraduatedSymbolRendererV2Widget : public QgsRendererV2Widget
|
||||
QList<int> selectedClasses();
|
||||
QgsRangeList selectedRanges();
|
||||
|
||||
//! populate column combos in categorized and graduated page
|
||||
void populateColumns();
|
||||
|
||||
void changeRangeSymbol( int rangeIdx );
|
||||
void changeRange( int rangeIdx );
|
||||
|
||||
|
@ -24,40 +24,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cboCategorizedColumn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnExpression">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../images/images.qrc">
|
||||
<normaloff>:/images/themes/default/mIconExpressionEditorOpen.svg</normaloff>:/images/themes/default/mIconExpressionEditorOpen.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QgsFieldExpressionWidget" name="mExpressionWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
@ -229,9 +196,14 @@
|
||||
<extends>QComboBox</extends>
|
||||
<header>qgscolorrampcombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsFieldExpressionWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">qgsfieldexpressionwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cboCategorizedColumn</tabstop>
|
||||
<tabstop>btnChangeCategorizedSymbol</tabstop>
|
||||
<tabstop>cboCategorizedColorRamp</tabstop>
|
||||
<tabstop>cbxInvertedColorRamp</tabstop>
|
||||
@ -241,8 +213,6 @@
|
||||
<tabstop>btnDeleteAllCategories</tabstop>
|
||||
<tabstop>btnJoinCategories</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../images/images.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -128,67 +128,8 @@
|
||||
<property name="text">
|
||||
<string>Column</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cboGraduatedColumn</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cboGraduatedColumn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnExpression">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../images/images.qrc">
|
||||
<normaloff>:/images/themes/default/mIconExpressionEditorOpen.svg</normaloff>:/images/themes/default/mIconExpressionEditorOpen.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
@ -203,6 +144,29 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QgsFieldExpressionWidget" name="mExprressionWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -290,6 +254,12 @@
|
||||
<extends>QComboBox</extends>
|
||||
<header>qgscolorrampcombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsFieldExpressionWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">qgsfieldexpressionwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>btnChangeGraduatedSymbol</tabstop>
|
||||
@ -301,8 +271,6 @@
|
||||
<tabstop>btnGraduatedClassify</tabstop>
|
||||
<tabstop>btnGraduatedDelete</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../images/images.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user