From 27bcd1be9c2c02067bf15c62fdb7f7e2ad394bd9 Mon Sep 17 00:00:00 2001 From: David Hallas Date: Tue, 19 Mar 2019 19:12:21 +0100 Subject: [PATCH] Reduce the indicator arrow size for press-and-hold menus in QToolButtons Summary: Changes the drawing of inline indicators with QToolButtons so that it is drawn as a small arrow in the lower right corner. Test Plan: Show QToolButton with Menu and PopupDelay enabled Reviewers: #vdg, #breeze, ngraham Reviewed By: #vdg, #breeze, ngraham Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D19890 --- kstyle/breeze.h | 3 ++- kstyle/breezehelper.cpp | 1 + kstyle/breezestyle.cpp | 9 +-------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/kstyle/breeze.h b/kstyle/breeze.h index bc63e4c4..a5c590fe 100644 --- a/kstyle/breeze.h +++ b/kstyle/breeze.h @@ -234,7 +234,8 @@ namespace Breeze ArrowUp, ArrowDown, ArrowLeft, - ArrowRight + ArrowRight, + ArrowDown_Small, }; //* button type diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp index 909eb017..fdc898fb 100644 --- a/kstyle/breezehelper.cpp +++ b/kstyle/breezehelper.cpp @@ -1305,6 +1305,7 @@ namespace Breeze case ArrowDown: arrow = QVector{QPointF( -4, -2 ), QPointF( 0, 2 ), QPointF( 4, -2 )}; break; case ArrowLeft: arrow = QVector{QPointF( 2, -4 ), QPointF( -2, 0 ), QPointF( 2, 4 )}; break; case ArrowRight: arrow = QVector{QPointF( -2, -4 ), QPointF( 2, 0 ), QPointF( -2, 4 )}; break; + case ArrowDown_Small: arrow = QVector{QPointF( 2, 4 ), QPointF( 4, 6 ), QPointF( 6, 4 )}; break; default: break; } diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index ed7d29b2..82ec3127 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -2726,15 +2726,9 @@ namespace Breeze // 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 ); - if( hasInlineIndicator ) size.rwidth() += Metrics::ToolButton_InlineIndicatorWidth; size = expandSize( size, marginWidth ); return size; @@ -6099,7 +6093,7 @@ namespace Breeze copy.rect = menuRect; if( sunken && !flat ) copy.rect.translate( 1, 1 ); - drawPrimitive( PE_IndicatorArrowDown, ©, painter, widget ); + drawIndicatorArrowPrimitive( ArrowDown_Small, ©, painter, widget ); } @@ -6127,7 +6121,6 @@ namespace Breeze const int marginWidth( flat ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); contentsRect = insideMargin( contentsRect, marginWidth, 0 ); - contentsRect.setRight( contentsRect.right() - Metrics::ToolButton_InlineIndicatorWidth ); contentsRect = visualRect( option, contentsRect ); }