mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
Fix overlapping text when narrow range is close to top
This commit is contained in:
parent
a91f5bf7c2
commit
f306e558c6
@ -224,6 +224,7 @@ void QgsElevationControllerLabels::paintEvent( QPaintEvent * )
|
||||
|
||||
const bool lowerIsCloseToLimit = lowerY + fm.height() > rect().bottom() - fm.descent();
|
||||
const bool upperIsCloseToLimit = upperY - fm.height() < rect().top() + fm.ascent();
|
||||
const bool lowerIsCloseToUpperLimit = lowerY - fm.height() < rect().top() + fm.ascent();
|
||||
|
||||
QLocale locale;
|
||||
|
||||
@ -245,6 +246,16 @@ void QgsElevationControllerLabels::paintEvent( QPaintEvent * )
|
||||
}
|
||||
|
||||
if ( mLimits.upper() < std::numeric_limits< double >::max() )
|
||||
{
|
||||
if ( qgsDoubleNear( mRange.upper(), mRange.lower() ) )
|
||||
{
|
||||
if ( !lowerIsCloseToUpperLimit )
|
||||
{
|
||||
f.setBold( false );
|
||||
path.addText( left, rect().top() + fm.ascent(), f, locale.toString( mLimits.upper() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( upperIsCloseToLimit )
|
||||
{
|
||||
@ -259,6 +270,7 @@ void QgsElevationControllerLabels::paintEvent( QPaintEvent * )
|
||||
path.addText( left, rect().top() + fm.ascent(), f, locale.toString( mLimits.upper() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPainter p( this );
|
||||
p.setRenderHint( QPainter::Antialiasing, true );
|
||||
|
Loading…
x
Reference in New Issue
Block a user