Commit 9b5fd370 authored by Nate Graham's avatar Nate Graham 🔩
Browse files

[QStyle] Make menu titles look less like menu items

Summary:
The look of Breeze menu titles has always slightly bothered me since they have the same
visual style and weighting as items, so they look clickable even though they aren't, and
they don't really do a very good job of separating sections, as seems to be their purpose.
This patch my my attempt to remedy the situation by making them look more "title-like"
and have greater visual distinctiveness from the items above and below them.

Test Plan:
Plasma Task Manager item context menu, before: {F8252758}
Plasma Task Manager context menu, after: {F8253825}

KMoreTools menu, before: {F8252757}
KMoreTools menu, after: {F8253827}

Reviewers: #vdg, #breeze, niccolove, ndavis

Reviewed By: #vdg, #breeze, niccolove, ndavis

Subscribers: cblack, cfeck, ndavis, niccolove, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D29081
parent 1bd9b0cd
......@@ -6655,14 +6655,19 @@ namespace Breeze
void Style::renderMenuTitle( const QStyleOptionToolButton* option, QPainter* painter, const QWidget* ) const
{
// render a separator at the bottom
// render a background rect for the title
const auto& palette( option->palette );
const auto color( _helper->separatorColor( palette ) );
_helper->renderSeparator( painter, QRect( option->rect.bottomLeft()-QPoint( 0, Metrics::MenuItem_MarginHeight), QSize( option->rect.width(), 1 ) ), color );
QColor bgColor = palette.color( QPalette::Text );
bgColor.setAlphaF(0.04);
const auto separatorColor( _helper->separatorColor( palette ) );
_helper->renderMenuFrame( painter, option->rect, bgColor, separatorColor, true );
// render text in the center of the rect
// icon is discarded on purpose
painter->setFont( option->font );
// make text the same size as a level 4 heading so it looks more title-ish
auto font = option->font;
font.setPointSize( qRound( font.pointSize() * 1.1 ) );
painter->setFont( font );
const auto contentsRect = insideMargin( option->rect, Metrics::MenuItem_MarginWidth, Metrics::MenuItem_MarginHeight );
drawItemText( painter, contentsRect, Qt::AlignCenter, palette, true, option->text, QPalette::WindowText );
......
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