Skip to content
Permalink
Browse files
fix field proxy model use
  • Loading branch information
3nids committed May 12, 2014
1 parent 9fc5b78 commit 156dc550133ecbcdf639e8910883c5862d0ee119
Showing with 4 additions and 13 deletions.
  1. +1 −7 src/gui/qgsfieldcombobox.cpp
  2. +3 −6 src/gui/qgsfieldexpressionwidget.cpp
@@ -77,13 +77,7 @@ QString QgsFieldComboBox::currentField()
return "";
}

const QModelIndex index = mFieldProxyModel->mapToSource( proxyIndex );
if ( !index.isValid() )
{
return "";
}

QString name = mFieldProxyModel->data( index, QgsFieldModel::FieldNameRole ).toString();
QString name = mFieldProxyModel->data( proxyIndex, QgsFieldModel::FieldNameRole ).toString();
return name;
}

@@ -84,19 +84,16 @@ QString QgsFieldExpressionWidget::currentField( bool *isExpression , bool *isVal
const QModelIndex proxyIndex = mFieldProxyModel->index( i, 0 );
if ( !proxyIndex.isValid() )
return "";
const QModelIndex index = mFieldProxyModel->mapToSource( proxyIndex );
if ( !index.isValid() )
return "";

if ( isExpression )
{
*isExpression = mFieldProxyModel->data( index, QgsFieldModel::IsExpressionRole ).toBool();
*isExpression = mFieldProxyModel->data( proxyIndex, QgsFieldModel::IsExpressionRole ).toBool();
}
if ( isValid )
{
*isValid = mFieldProxyModel->data( index, QgsFieldModel::ExpressionValidityRole ).toBool();
*isValid = mFieldProxyModel->data( proxyIndex, QgsFieldModel::ExpressionValidityRole ).toBool();
}
QString expression = mFieldProxyModel->data( index, QgsFieldModel::ExpressionRole ).toString();
QString expression = mFieldProxyModel->data( proxyIndex, QgsFieldModel::ExpressionRole ).toString();
return expression;
}

0 comments on commit 156dc55

Please sign in to comment.