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 @@ -139,6 +139,15 @@ }; + //* return true if toolbutton should have a menu arrow + bool skipMenuArrow( const QWidget* widget ) + { + const auto toolButton = qobject_cast( widget ); + return toolButton && + ( toolButton->property( Breeze::PropertyNames::toolButtonNoMenuArrow ).toBool() || + ( toolButton->defaultAction() && toolButton->defaultAction()->property( Breeze::PropertyNames::toolButtonNoMenuArrow ).toBool() ) ); + } + } namespace Breeze @@ -2102,7 +2111,7 @@ const bool hasPopupMenu( toolButtonOption->features & QStyleOptionToolButton::MenuButtonPopup ); const bool hasInlineIndicator( toolButtonOption->features&QStyleOptionToolButton::HasMenu - && toolButtonOption->features&QStyleOptionToolButton::PopupDelay + && !BreezePrivate::skipMenuArrow( widget ) && !hasPopupMenu ); // store rect @@ -2678,7 +2687,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 @@ -2694,7 +2703,7 @@ const bool hasPopupMenu( toolButtonOption->features & QStyleOptionToolButton::MenuButtonPopup ); const bool hasInlineIndicator( toolButtonOption->features&QStyleOptionToolButton::HasMenu - && toolButtonOption->features&QStyleOptionToolButton::PopupDelay + && !BreezePrivate::skipMenuArrow( widget ) && !hasPopupMenu ); const int marginWidth( autoRaise ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); @@ -3380,7 +3389,7 @@ } else if( flat ) { - if( sunken && hasFocus && !mouseOver ) color = palette.color( QPalette::HighlightedText ); + if( sunken && !mouseOver ) color = palette.color( QPalette::HighlightedText ); else color = _helper->arrowColor( palette, QPalette::WindowText ); } else if( hasFocus && !mouseOver ) { @@ -5979,7 +5988,7 @@ const bool hasPopupMenu( toolButtonOption->features & QStyleOptionToolButton::MenuButtonPopup ); const bool hasInlineIndicator( toolButtonOption->features&QStyleOptionToolButton::HasMenu - && toolButtonOption->features&QStyleOptionToolButton::PopupDelay + && !BreezePrivate::skipMenuArrow( widget ) && !hasPopupMenu ); const auto buttonRect( subControlRect( CC_ToolButton, option, SC_ToolButton, widget ) );