[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)

This commit is contained in:
Nyall Dawson 2014-07-19 22:56:23 +10:00
parent 70d5857760
commit 4e2afeb961

View File

@ -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;
}
@ -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 )