broken implementation of Qt::AlignBottom fixed

This commit is contained in:
Uwe Rathmann 2018-10-29 20:01:05 +01:00
parent cf23c6e356
commit 85f816e42d

View File

@ -181,12 +181,21 @@ void QskPlainTextRenderer::updateNode( const QString& text,
const qreal textHeight = qskLayoutText( &layout, rect.width(), options );
layout.endLayout();
qreal yBaseline = QFontMetricsF( font ).ascent();
const qreal y0 = QFontMetricsF( font ).ascent();
qreal yBaseline = y0;
if ( alignment & Qt::AlignVCenter )
{
yBaseline += ( rect.height() - textHeight ) * 0.5;
}
else if ( alignment & Qt::AlignBottom )
{
yBaseline += rect.height() - textHeight;
}
if ( yBaseline != y0 )
{
/*
We need to have a stable algo for rounding the text base line,
so that texts don't start wobbling, when processing transitions