#5409 Remove deprecated QFontMetrics::width() call.

Replaced with `QFontMetrics( font ).boundingRect( QString ).width() as suggested
in Qt5 docs. The replacement should work for all Qt5 versions as it was
available in Qt4 too.
This commit is contained in:
Kristian Bendiksen 2020-05-12 09:13:50 +02:00 committed by Magne Sjaastad
parent d86de5e8ff
commit 7972ff8c02

View File

@ -180,7 +180,7 @@ void RiuNightchartsWidget::paintEvent( QPaintEvent* e )
void RiuNightchartsWidget::addItem( const QString& name, const QColor& color, float value )
{
m_chart.addPiece( name, color, value );
int textWidth = this->fontMetrics().width( name + " (00 %)" );
int textWidth = this->fontMetrics().boundingRect( name + " (00 %)" ).width();
m_maxNameWidth = textWidth > m_maxNameWidth ? textWidth : m_maxNameWidth;
}