mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
[legend] Fix alignment and chopped off text of collapsed data-defined size legend symbol (#9228)
This commit is contained in:
parent
fcdb4c025c
commit
78e8c34200
@ -178,16 +178,18 @@ void QgsDataDefinedSizeLegend::drawCollapsedLegend( QgsRenderContext &context, Q
|
|||||||
if ( w > maxTextWidth )
|
if ( w > maxTextWidth )
|
||||||
maxTextWidth = w;
|
maxTextWidth = w;
|
||||||
}
|
}
|
||||||
|
// add extra width needed to handle varying rendering of font weight
|
||||||
|
maxTextWidth += 1;
|
||||||
|
|
||||||
// find out size of the largest symbol
|
// find out size of the largest symbol
|
||||||
double largestSize = classes.at( 0 ).size;
|
double largestSize = classes.at( 0 ).size;
|
||||||
double outputLargestSize = context.convertToPainterUnits( largestSize, s->sizeUnit(), s->sizeMapUnitScale() );
|
int outputLargestSize = std::round( context.convertToPainterUnits( largestSize, s->sizeUnit(), s->sizeMapUnitScale() ) );
|
||||||
|
|
||||||
// find out top Y coordinate for individual symbol sizes
|
// find out top Y coordinate for individual symbol sizes
|
||||||
QList<int> symbolTopY;
|
QList<int> symbolTopY;
|
||||||
Q_FOREACH ( const SizeClass &c, classes )
|
Q_FOREACH ( const SizeClass &c, classes )
|
||||||
{
|
{
|
||||||
double outputSymbolSize = context.convertToPainterUnits( c.size, s->sizeUnit(), s->sizeMapUnitScale() );
|
int outputSymbolSize = std::round( context.convertToPainterUnits( c.size, s->sizeUnit(), s->sizeMapUnitScale() ) );
|
||||||
switch ( mVAlign )
|
switch ( mVAlign )
|
||||||
{
|
{
|
||||||
case AlignCenter:
|
case AlignCenter:
|
||||||
@ -243,7 +245,7 @@ void QgsDataDefinedSizeLegend::drawCollapsedLegend( QgsRenderContext &context, Q
|
|||||||
{
|
{
|
||||||
s->setSize( c.size );
|
s->setSize( c.size );
|
||||||
|
|
||||||
double outputSymbolSize = context.convertToPainterUnits( c.size, s->sizeUnit(), s->sizeMapUnitScale() );
|
int outputSymbolSize = std::round( context.convertToPainterUnits( c.size, s->sizeUnit(), s->sizeMapUnitScale() ) );
|
||||||
double tx = ( outputLargestSize - outputSymbolSize ) / 2;
|
double tx = ( outputLargestSize - outputSymbolSize ) / 2;
|
||||||
|
|
||||||
p->save();
|
p->save();
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Loading…
x
Reference in New Issue
Block a user