Commit 288c3b85 authored by Noah Davis's avatar Noah Davis 🌵
Browse files

Revert "Revert "Reduce the indicator arrow size for press-and-hold menus in QToolButtons""

Summary:
This reverts commit c9aa5358.

Also makes the small down arrow pixel perfect. I will make the other arrows pixel perfect in a separate patch.

After D19890 (27bcd1be) was reopened, there was some discussion about the reason it was reverted and the problems it introduced. It is possible that an icon could partially cover this arrow, but it seemed uncommon enough that ignoring the problem was deemed acceptable. The type of control that this arrow is used for is also pretty uncommon because it does not feel very good to use with a mouse or touchpad.

Reviewers: #vdg, #breeze, #plasma, hpereiradacosta, ngraham

Reviewed By: #vdg, #breeze, ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26139
parent 4a78561a
......@@ -234,7 +234,8 @@ namespace Breeze
ArrowUp,
ArrowDown,
ArrowLeft,
ArrowRight
ArrowRight,
ArrowDown_Small,
};
//* button type
......
......@@ -1301,6 +1301,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( 1.5, 3.5 ), QPointF( 3.5, 5.5 ), QPointF( 5.5, 3.5 )}; break;
default: break;
}
......@@ -1308,7 +1309,10 @@ namespace Breeze
painter->setRenderHints( QPainter::Antialiasing );
painter->translate( QRectF( rect ).center() );
painter->setBrush( Qt::NoBrush );
painter->setPen( QPen( color, 1.1 ) );
QPen pen( color, 1.1 );
pen.setCapStyle(Qt::SquareCap);
pen.setJoinStyle(Qt::MiterJoin);
painter->setPen( pen );
painter->drawPolyline( arrow );
painter->restore();
}
......
......@@ -2742,15 +2742,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;
......@@ -6124,7 +6118,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 );
}
......@@ -6152,7 +6146,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 );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment