Skip to content

Commit a9606ea

Browse files
committedApr 2, 2018
Fix signal loop when resizing columns on opening attribute table
(cherry-picked from 4d40202)
1 parent 5f1d3db commit a9606ea

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
 

‎src/gui/attributetable/qgsdualview.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ void QgsDualView::tableColumnResized( int column, int width )
667667
{
668668
QgsAttributeTableConfig config = mConfig;
669669
int sourceCol = config.mapVisibleColumnToIndex( column );
670-
if ( sourceCol >= 0 )
670+
if ( sourceCol >= 0 && config.columnWidth( sourceCol ) != width )
671671
{
672672
config.setColumnWidth( sourceCol, width );
673673
setAttributeTableConfig( config );
@@ -840,9 +840,13 @@ void QgsDualView::previewExpressionChanged( const QString &expression )
840840
void QgsDualView::onSortColumnChanged()
841841
{
842842
QgsAttributeTableConfig cfg = mLayer->attributeTableConfig();
843-
cfg.setSortExpression( mFilterModel->sortExpression() );
844-
cfg.setSortOrder( mFilterModel->sortOrder() );
845-
setAttributeTableConfig( cfg );
843+
if ( cfg.sortExpression() != mFilterModel->sortExpression() ||
844+
cfg.sortOrder() != mFilterModel->sortOrder() )
845+
{
846+
cfg.setSortExpression( mFilterModel->sortExpression() );
847+
cfg.setSortOrder( mFilterModel->sortOrder() );
848+
setAttributeTableConfig( cfg );
849+
}
846850
}
847851

848852
void QgsDualView::sortByPreviewExpression()

0 commit comments

Comments
 (0)
Please sign in to comment.