mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
[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:
parent
70d5857760
commit
4e2afeb961
@ -463,6 +463,8 @@ bool QgsComposerAttributeTable::getFeatureAttributes( QList<QgsAttributeMap> &at
|
|||||||
c.setAscending( sortColumns.at( i ).second );
|
c.setAscending( sortColumns.at( i ).second );
|
||||||
qStableSort( attributeMaps.begin(), attributeMaps.end(), c );
|
qStableSort( attributeMaps.begin(), attributeMaps.end(), c );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
adjustFrameToSize();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,22 +487,10 @@ void QgsComposerAttributeTable::setSceneRect( const QRectF& rectangle )
|
|||||||
//update rect for data defined size and position
|
//update rect for data defined size and position
|
||||||
QRectF evaluatedRect = evalItemRect( rectangle );
|
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 );
|
QgsComposerItem::setSceneRect( evaluatedRect );
|
||||||
|
|
||||||
//refresh table attributes, since number of features has likely changed
|
//refresh table attributes, since number of features has likely changed
|
||||||
refreshAttributes();
|
refreshAttributes();
|
||||||
|
|
||||||
emit maximumNumberOfFeaturesChanged( mMaximumNumberOfFeatures );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerAttributeTable::setSortAttributes( const QList<QPair<int, bool> > att )
|
void QgsComposerAttributeTable::setSortAttributes( const QList<QPair<int, bool> > att )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user