Skip to content
Permalink
Browse files
Don't reset field model if nothing changes
  • Loading branch information
NathanW2 committed Jun 24, 2014
1 parent 87826ad commit 7d9b8dda8671820b99cfc0e170aad8e554ebe5d1
Showing with 14 additions and 4 deletions.
  1. +14 −4 src/gui/qgsfieldmodel.cpp
@@ -84,13 +84,23 @@ void QgsFieldModel::layerDeleted()

void QgsFieldModel::updateModel()
{
beginResetModel();
mExpression = QList<QString>();
if ( mLayer )
mFields = mLayer->pendingFields();
{
if ( mFields.toList() != mLayer->pendingFields().toList() )
{
beginResetModel();
mFields = mLayer->pendingFields();
endResetModel();
}
else
emit dataChanged( index(0, 0 ), index( rowCount(), 0 ));
}
else
{
beginResetModel();
mFields = QgsFields();
endResetModel();
beginResetModel();
}

This comment has been minimized.

Copy link
@jef-n

jef-n Jun 25, 2014

Member

2x beginResetModel()?

This comment has been minimized.

Copy link
@NathanW2

NathanW2 via email Jun 25, 2014

Author Member

This comment has been minimized.

Copy link
@3nids

3nids Jun 25, 2014

Member

I just fixed it

}

void QgsFieldModel::setAllowExpression( bool allowExpression )

3 comments on commit 7d9b8dd

@3nids

This comment has been minimized.

Copy link
Member

@3nids 3nids replied Jun 25, 2014

you don't reset the expression anymore.
is this intentional?
I am not sure it's the best behavior.
I suppose changing the layer should remove the expression too.
What do you think?

@NathanW2

This comment has been minimized.

Copy link
Member Author

@NathanW2 NathanW2 replied Jun 25, 2014

@3nids

This comment has been minimized.

Copy link
Member

@3nids 3nids replied Jun 25, 2014

ok, thanks!

Please sign in to comment.