Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix field proxy model use
  • Loading branch information
3nids committed May 12, 2014
1 parent 9fc5b78 commit 156dc55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
8 changes: 1 addition & 7 deletions src/gui/qgsfieldcombobox.cpp
Expand Up @@ -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;
}

Expand Down
9 changes: 3 additions & 6 deletions src/gui/qgsfieldexpressionwidget.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit 156dc55

Please sign in to comment.