diff --git a/kstyle/breezepropertynames.h b/kstyle/breezepropertynames.h --- a/kstyle/breezepropertynames.h +++ b/kstyle/breezepropertynames.h @@ -32,6 +32,7 @@ static const char netWMSkipShadow[]; static const char sidePanelView[]; static const char toolButtonAlignment[]; + static const char toolButtonNoMenuArrow[]; static const char menuTitle[]; static const char alteredBackground[]; }; diff --git a/kstyle/breezepropertynames.cpp b/kstyle/breezepropertynames.cpp --- a/kstyle/breezepropertynames.cpp +++ b/kstyle/breezepropertynames.cpp @@ -29,6 +29,7 @@ const char PropertyNames::netWMSkipShadow[] = "_KDE_NET_WM_SKIP_SHADOW"; const char PropertyNames::sidePanelView[] = "_kde_side_panel_view"; const char PropertyNames::toolButtonAlignment[] = "_kde_toolButton_alignment"; + const char PropertyNames::toolButtonNoMenuArrow[] = "_kde_toolButton_noMenuArrow"; const char PropertyNames::menuTitle[] = "_breeze_toolButton_menutitle"; const char PropertyNames::alteredBackground[] = "_breeze_altered_background"; diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -150,6 +150,19 @@ { return option && ( (option->state & QStyle::State_Horizontal ) || option->orientation == Qt::Horizontal ); } #endif + bool hasPopupMenu(const QStyleOptionToolButton* toolButtonOption) + { + return toolButtonOption->features & QStyleOptionToolButton::MenuButtonPopup; + } + bool hasInlineIndicator(const QStyleOptionToolButton* toolButtonOption, const QWidget* toolButton) + { + return + (toolButton->property( Breeze::PropertyNames::toolButtonNoMenuArrow ).toBool() == false) + && toolButtonOption->features&QStyleOptionToolButton::HasMenu + && toolButtonOption->features&QStyleOptionToolButton::PopupDelay + && !hasPopupMenu(toolButtonOption); + } + } namespace Breeze @@ -2136,11 +2149,8 @@ const auto toolButtonOption = qstyleoption_cast( option ); if( !toolButtonOption ) return ParentStyleClass::subControlRect( CC_ToolButton, option, subControl, widget ); - const bool hasPopupMenu( toolButtonOption->features & QStyleOptionToolButton::MenuButtonPopup ); - const bool hasInlineIndicator( - toolButtonOption->features&QStyleOptionToolButton::HasMenu - && toolButtonOption->features&QStyleOptionToolButton::PopupDelay - && !hasPopupMenu ); + const bool hasPopupMenu( BreezePrivate::hasPopupMenu(toolButtonOption) ); + const bool hasInlineIndicator( BreezePrivate::hasInlineIndicator(toolButtonOption, widget) ); // store rect const auto& rect( option->rect ); @@ -2715,7 +2725,7 @@ } //______________________________________________________________ - QSize Style::toolButtonSizeFromContents( const QStyleOption* option, const QSize& contentsSize, const QWidget* ) const + QSize Style::toolButtonSizeFromContents( const QStyleOption* option, const QSize& contentsSize, const QWidget* widget) const { // cast option and check @@ -2728,11 +2738,7 @@ // 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 bool hasInlineIndicator( BreezePrivate::hasInlineIndicator(toolButtonOption, widget) ); const int marginWidth( autoRaise ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); @@ -6070,11 +6076,8 @@ // copy option and alter palette QStyleOptionToolButton copy( *toolButtonOption ); - const bool hasPopupMenu( toolButtonOption->features & QStyleOptionToolButton::MenuButtonPopup ); - const bool hasInlineIndicator( - toolButtonOption->features&QStyleOptionToolButton::HasMenu - && toolButtonOption->features&QStyleOptionToolButton::PopupDelay - && !hasPopupMenu ); + const bool hasPopupMenu( BreezePrivate::hasPopupMenu(toolButtonOption) ); + const bool hasInlineIndicator( BreezePrivate::hasInlineIndicator(toolButtonOption, widget) ); const auto buttonRect( subControlRect( CC_ToolButton, option, SC_ToolButton, widget ) ); const auto menuRect( subControlRect( CC_ToolButton, option, SC_ToolButtonMenu, widget ) );