Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[composer] Don't auto set maximum number of attributes when resizing …
…item. Instead, keep the maximum number of rows as whatever the user set. This change prevents the attribute table from shrinking and never re-growing (fix #10911)
  • Loading branch information
nyalldawson committed Jul 19, 2014
1 parent 70d5857 commit 4e2afeb
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/core/composer/qgscomposerattributetable.cpp
Expand Up @@ -463,6 +463,8 @@ bool QgsComposerAttributeTable::getFeatureAttributes( QList<QgsAttributeMap> &at
c.setAscending( sortColumns.at( i ).second );
qStableSort( attributeMaps.begin(), attributeMaps.end(), c );
}

adjustFrameToSize();
return true;
}

Expand All @@ -485,22 +487,10 @@ void QgsComposerAttributeTable::setSceneRect( const QRectF& rectangle )
//update rect for data defined size and position
QRectF evaluatedRect = evalItemRect( rectangle );

double titleHeight = 2 * mGridStrokeWidth + 2 * mLineTextDistance + QgsComposerUtils::fontAscentMM( mHeaderFont );
double attributeHeight = mGridStrokeWidth + 2 * mLineTextDistance + QgsComposerUtils::fontAscentMM( mContentFont );
if (( evaluatedRect.height() - titleHeight ) > 0 )
{
mMaximumNumberOfFeatures = ( evaluatedRect.height() - titleHeight ) / attributeHeight;
}
else
{
mMaximumNumberOfFeatures = 0;
}
QgsComposerItem::setSceneRect( evaluatedRect );

//refresh table attributes, since number of features has likely changed
refreshAttributes();

emit maximumNumberOfFeaturesChanged( mMaximumNumberOfFeatures );
}

void QgsComposerAttributeTable::setSortAttributes( const QList<QPair<int, bool> > att )
Expand Down

0 comments on commit 4e2afeb

Please sign in to comment.