Skip to content

Commit

Permalink
Don't reset field model if nothing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jun 24, 2014
1 parent 87826ad commit 7d9b8dd
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/gui/qgsfieldmodel.cpp
Expand Up @@ -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 )
Expand Down

3 comments on commit 7d9b8dd

@3nids
Copy link
Member

@3nids 3nids commented on 7d9b8dd Jun 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member Author

@NathanW2 NathanW2 commented on 7d9b8dd Jun 25, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@3nids
Copy link
Member

@3nids 3nids commented on 7d9b8dd Jun 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks!

Please sign in to comment.