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
wilder-5.17
David Hallas 7 years ago
parent ce72de243a
commit 27bcd1be9c
  1. 3
      kstyle/breeze.h
  2. 1
      kstyle/breezehelper.cpp
  3. 9
      kstyle/breezestyle.cpp

@ -234,7 +234,8 @@ namespace Breeze
ArrowUp,
ArrowDown,
ArrowLeft,
ArrowRight
ArrowRight,
ArrowDown_Small,
};
//* button type

@ -1305,6 +1305,7 @@ namespace Breeze
case ArrowDown: arrow = QVector<QPointF>{QPointF( -4, -2 ), QPointF( 0, 2 ), QPointF( 4, -2 )}; break;
case ArrowLeft: arrow = QVector<QPointF>{QPointF( 2, -4 ), QPointF( -2, 0 ), QPointF( 2, 4 )}; break;
case ArrowRight: arrow = QVector<QPointF>{QPointF( -2, -4 ), QPointF( 2, 0 ), QPointF( -2, 4 )}; break;
case ArrowDown_Small: arrow = QVector<QPointF>{QPointF( 2, 4 ), QPointF( 4, 6 ), QPointF( 6, 4 )}; break;
default: break;
}

@ -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, &copy, painter, widget );
drawIndicatorArrowPrimitive( ArrowDown_Small, &copy, 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 );
}

Loading…
Cancel
Save