From 1669b384ab4d3303417dcf6d195e00bb7586cb49 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Fri, 22 Aug 2014 12:24:53 +0200 Subject: [PATCH] reduced icon to text spacing in toolbuttons, to be consistent with pushbuttons moved CheckBoxContentsRect to .cpp --- kstyle/breeze.h | 3 ++- kstyle/breezestyle.cpp | 10 +++++++--- kstyle/breezestyle.h | 3 +-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/kstyle/breeze.h b/kstyle/breeze.h index 35e6d5b3..d03108da 100644 --- a/kstyle/breeze.h +++ b/kstyle/breeze.h @@ -92,7 +92,8 @@ namespace Breeze // tool buttons ToolButton_MarginWidth = 6, - ToolButton_ItemSpacing = 12, + ToolButton_ItemSpacing = 4, + ToolButton_InlineIndicatorWidth = 12, // checkboxes and radio buttons CheckBox_Size = 22, diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index a8bea0aa..1ff80fe3 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -1246,6 +1246,10 @@ namespace Breeze } + //___________________________________________________________________________________________________________________ + QRect Style::checkBoxContentsRect( const QStyleOption* option, const QWidget* ) const + { return visualRect( option, option->rect.adjusted( Metrics::CheckBox_Size + Metrics::CheckBox_ItemSpacing, 0, 0, 0 ) ); } + //___________________________________________________________________________________________________________________ QRect Style::lineEditContentsRect( const QStyleOption* option, const QWidget* widget ) const { @@ -2355,7 +2359,7 @@ namespace Breeze const bool hasInlineIndicator( toolButtonOption->features & QStyleOptionToolButton::HasMenu && !hasPopupMenu ); const int marginWidth( autoRaise ? Metrics::ToolButton_MarginWidth : Metrics::Button_MarginWidth + Metrics::Frame_FrameWidth ); - if( hasInlineIndicator ) size.rwidth() += Metrics::ToolButton_ItemSpacing; + if( hasInlineIndicator ) size.rwidth() += Metrics::ToolButton_InlineIndicatorWidth; size = expandSize( size, marginWidth ); return size; @@ -3879,7 +3883,7 @@ namespace Breeze iconRect.setWidth( iconSize.width() ); textRect = rect; - textRect.adjust( iconRect.width() + 8, 0, 0, 0); + textRect.adjust( iconRect.width() + Metrics::ToolButton_ItemSpacing, 0, 0, 0); // handle right to left layouts iconRect = visualRect( option, iconRect ); @@ -5251,7 +5255,7 @@ namespace Breeze contentsRect= insideMargin( contentsRect, marginWidth ); if( hasInlineIndicator ) { - contentsRect.setRight( contentsRect.right() - Metrics::ToolButton_ItemSpacing ); + contentsRect.setRight( contentsRect.right() - Metrics::ToolButton_InlineIndicatorWidth ); contentsRect = visualRect( option, contentsRect ); } diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h index 28bf52ed..066bf81d 100644 --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -165,8 +165,7 @@ namespace Breeze { return option->rect; } //* checkbox contents - QRect checkBoxContentsRect( const QStyleOption* option, const QWidget* ) const - { return visualRect( option, option->rect.adjusted( Metrics::CheckBox_Size + Metrics::CheckBox_BoxTextSpace, 0, 0, 0 ) ); } + QRect checkBoxContentsRect( const QStyleOption* option, const QWidget* ) const; //* line edit contents QRect lineEditContentsRect( const QStyleOption*, const QWidget* ) const;