Skip to content
Permalink
Browse files
[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 4e2afeb96182dafa8249131f023f0ea0e312883b
Showing with 2 additions and 12 deletions.
  1. +2 −12 src/core/composer/qgscomposerattributetable.cpp
@@ -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 )

0 comments on commit 4e2afeb

Please sign in to comment.