Commit 8a6f6851 authored by Noah Davis's avatar Noah Davis 🌵
Browse files

Fix QFontMetrics::width() deprecation warning by switching to boundingRect().width()

According to an article by @cfeck [1], QFontMetrics::width() gave the horizontal advance, which doesn't necessarily include every pixel that the text might use.
He suggested that boundingRect().width() might be what most people actually want.

- [1]

Reviewers: #breeze, #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: hpereiradacosta, cfeck, plasma-devel

Tags: #plasma

Differential Revision:
parent 8c95c00f
......@@ -2836,7 +2836,7 @@ namespace Breeze
if( !menuItemOption->text.isEmpty() )
size.setHeight( qMax( size.height(), textHeight ) );
size.setWidth( qMax( size.width(), menuItemOption->fontMetrics.width( menuItemOption->text ) ) );
size.setWidth( qMax( size.width(), menuItemOption->fontMetrics.boundingRect( menuItemOption->text ).width() ) );
return sizeFromContents( CT_ToolButton, &toolButtonOption, size, widget );
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment