Commit cbc7d9c7 authored by Hugo Pereira Da Costa's avatar Hugo Pereira Da Costa
Browse files

Properly account for MenuItem text size when computing sizeFromContents

BUG: 349258
parent d599d046
......@@ -2996,7 +2996,11 @@ namespace Oxygen
const int iconWidth( qMax( pixelMetric(PM_SmallIconSize, option, widget ), menuItemOption->maxIconWidth ) );
const int textHeight( menuItemOption->fontMetrics.height() );
if( !menuItemOption->icon.isNull() ) size.setHeight( qMax( size.height(), iconWidth ) );
if( !menuItemOption->text.isEmpty() ) size.setHeight( qMax( size.height(), textHeight ) );
if( !menuItemOption->text.isEmpty() )
{
size.setHeight( qMax( size.height(), textHeight ) );
size.setWidth( qMax( size.width(), menuItemOption->fontMetrics.width( menuItemOption->text ) ) );
}
return sizeFromContents( CT_ToolButton, &toolButtonOption, size, widget );
......@@ -8511,7 +8515,7 @@ namespace Oxygen
toolButtonOption.subControls = SC_ToolButton;
toolButtonOption.icon = menuItemOption->icon;
int iconWidth( pixelMetric( PM_SmallIconSize, menuItemOption, widget ) );
const int iconWidth( pixelMetric( PM_SmallIconSize, menuItemOption, widget ) );
toolButtonOption.iconSize = QSize( iconWidth, iconWidth );
toolButtonOption.text = menuItemOption->text;
......
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