diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -2552,9 +2552,15 @@ const auto frameOption( qstyleoption_cast( option ) ); if( !frameOption ) return contentsSize; + // output + QSize size(contentsSize); + + // force height consistency + size.setHeight(frameOption->fontMetrics.height()); + const bool flat( frameOption->lineWidth == 0 ); const int frameWidth( pixelMetric( PM_DefaultFrameWidth, option, widget ) ); - return flat ? contentsSize : expandSize( contentsSize, frameWidth ); + return flat ? size : expandSize( size, frameWidth ); } //______________________________________________________________ @@ -2568,14 +2574,14 @@ // copy size QSize size( contentsSize ); + // force height consistency + size.setHeight(comboBoxOption->fontMetrics.height()); + // add relevant margin const bool flat( !comboBoxOption->frame ); const int frameWidth( pixelMetric( PM_ComboBoxFrameWidth, option, widget ) ); if( !flat ) size = expandSize( size, frameWidth ); - // make sure there is enough height for the button - size.setHeight( qMax( size.height(), int(Metrics::MenuButton_IndicatorWidth) ) ); - // add button width and spacing size.rwidth() += Metrics::MenuButton_IndicatorWidth+2; @@ -2596,13 +2602,13 @@ // copy size QSize size( contentsSize ); + // force height consistency + size.setHeight(spinBoxOption->fontMetrics.height()); + // add editor margins const int frameWidth( pixelMetric( PM_SpinBoxFrameWidth, option, widget ) ); if( !flat ) size = expandSize( size, frameWidth ); - // make sure there is enough height for the button - size.setHeight( qMax( size.height(), int(Metrics::SpinBox_ArrowButtonWidth) ) ); - // add button width and spacing size.rwidth() += Metrics::SpinBox_ArrowButtonWidth; @@ -2663,24 +2669,16 @@ if( !buttonOption ) return contentsSize; // output - QSize size; + QSize size(contentsSize); // check text and icon const bool hasText( !buttonOption->text.isEmpty() ); const bool flat( buttonOption->features & QStyleOptionButton::Flat ); bool hasIcon( !buttonOption->icon.isNull() ); - if( !( hasText||hasIcon ) ) + if( hasText || hasIcon ) { - /* - no text nor icon is passed. - assume custom button and use contentsSize as a starting point - */ - size = contentsSize; - - } else { - /* rather than trying to guess what Qt puts into its contents size calculation, we recompute the button size entirely, based on button option @@ -2699,7 +2697,6 @@ QSize iconSize = buttonOption->iconSize; if( !iconSize.isValid() ) iconSize = QSize( pixelMetric( PM_SmallIconSize, option, widget ), pixelMetric( PM_SmallIconSize, option, widget ) ); - size.setHeight( qMax( size.height(), iconSize.height() ) ); size.rwidth() += iconSize.width(); if( hasText ) size.rwidth() += Metrics::Button_ItemSpacing; @@ -2715,16 +2712,17 @@ if( hasText||hasIcon ) size.rwidth() += Metrics::Button_ItemSpacing; } + // force height consistency + size.setHeight(buttonOption->fontMetrics.height()); + // expand with buttons margin size = expandSize( size, Metrics::Button_MarginWidth ); // make sure buttons have a minimum width if( hasText ) { size.setWidth( qMax( size.width(), int( Metrics::Button_MinWidth ) ) ); } - // finally add frame margins - return expandSize( size, Metrics::Frame_FrameWidth ); - + return size; } //______________________________________________________________ @@ -2738,22 +2736,22 @@ // copy size QSize size = contentsSize; - // get relevant state flags - const State& state( option->state ); - const bool autoRaise( state & State_AutoRaise ); const bool hasPopupMenu( toolButtonOption->features & QStyleOptionToolButton::MenuButtonPopup ); const bool hasInlineIndicator( toolButtonOption->features&QStyleOptionToolButton::HasMenu && toolButtonOption->features&QStyleOptionToolButton::PopupDelay && !hasPopupMenu ); - const int marginWidth( autoRaise ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); + const int marginWidth(Metrics::ToolButton_MarginWidth); if( hasInlineIndicator ) size.rwidth() += Metrics::ToolButton_InlineIndicatorWidth; + + // force height consistency + size.setHeight(toolButtonOption->fontMetrics.height()); + size = expandSize( size, marginWidth ); return size; - } //______________________________________________________________ @@ -6527,7 +6525,7 @@ // angles const qreal first( dialAngle( sliderOption, sliderOption->minimum ) ); const qreal last( dialAngle( sliderOption, sliderOption->maximum ) ); - + // render groove _helper->renderDialGroove( painter, grooveRect, grooveColor, first, last );