Index: kstyle/breeze.h =================================================================== --- kstyle/breeze.h +++ kstyle/breeze.h @@ -44,58 +44,58 @@ { // frames - Frame_FrameWidth = 2, + Frame_FrameWidth = 1, Frame_FrameRadius = 3, // layout Layout_TopLevelMarginWidth = 10, Layout_ChildMarginWidth = 6, - Layout_DefaultSpacing = 6, + Layout_DefaultSpacing = 7, // line editors - LineEdit_FrameWidth = 6, + LineEdit_FrameWidth = 4, // menu items Menu_FrameWidth = 0, MenuItem_MarginWidth = 5, MenuItem_MarginHeight = 3, MenuItem_ItemSpacing = 4, - MenuItem_AcceleratorSpace = 16, - MenuButton_IndicatorWidth = 20, + MenuItem_AcceleratorSpace = 8, + MenuButton_IndicatorWidth = 12, // combobox - ComboBox_FrameWidth = 6, + ComboBox_FrameWidth = 4, // spinbox SpinBox_FrameWidth = LineEdit_FrameWidth, - SpinBox_ArrowButtonWidth = 20, + SpinBox_ArrowButtonWidth = 15, // groupbox title margin GroupBox_TitleMarginWidth = 4, // buttons Button_MinWidth = 80, - Button_MarginWidth = 6, - Button_ItemSpacing = 4, + Button_MarginWidth = 4, + Button_ItemSpacing = 3, // tool buttons - ToolButton_MarginWidth = 6, - ToolButton_ItemSpacing = 4, - ToolButton_InlineIndicatorWidth = 12, + ToolButton_MarginWidth = 4, + ToolButton_ItemSpacing = 3, + ToolButton_InlineIndicatorWidth = 8, // checkboxes and radio buttons - CheckBox_Size = 20, - CheckBox_FocusMarginWidth = 2, - CheckBox_ItemSpacing = 4, + CheckBox_Size = 16, + CheckBox_FocusMarginWidth = 3, + CheckBox_ItemSpacing = 5, // menubar items MenuBarItem_MarginWidth = 10, - MenuBarItem_MarginHeight = 6, + MenuBarItem_MarginHeight = 5, // scrollbars ScrollBar_Extend = 21, ScrollBar_SliderWidth = 6, - ScrollBar_MinSliderHeight = 20, + ScrollBar_MinSliderHeight = 15, ScrollBar_NoButtonHeight = (ScrollBar_Extend-ScrollBar_SliderWidth)/2, ScrollBar_SingleButtonHeight = ScrollBar_Extend, ScrollBar_DoubleButtonHeight = 2*ScrollBar_Extend, @@ -105,7 +105,7 @@ ToolBar_HandleExtent = 10, ToolBar_HandleWidth = 6, ToolBar_SeparatorWidth = 8, - ToolBar_ExtensionWidth = 20, + ToolBar_ExtensionWidth = 15, ToolBar_ItemSpacing = 0, // progressbars @@ -120,13 +120,13 @@ Slider_TickLength = 8, Slider_TickMarginWidth = 2, Slider_GrooveThickness = 6, - Slider_ControlThickness = 20, + Slider_ControlThickness = 15, // tabbar TabBar_TabMarginHeight = 4, TabBar_TabMarginWidth = 8, TabBar_TabMinWidth = 80, - TabBar_TabMinHeight = 28, + TabBar_TabMinHeight = 18, TabBar_TabItemSpacing = 8, TabBar_TabOverlap = 1, TabBar_BaseOverlap = 2, @@ -145,12 +145,12 @@ // list headers Header_MarginWidth = 6, Header_ItemSpacing = 4, - Header_ArrowSize = 10, + Header_ArrowSize = 7, // tree view - ItemView_ArrowSize = 10, - ItemView_ItemMarginWidth = 3, - SidePanel_ItemMarginWidth = 4, + ItemView_ArrowSize = 5, + ItemView_ItemMarginWidth = 4, + SidePanel_ItemMarginWidth = 5, // splitter Splitter_SplitterWidth = 1, Index: kstyle/breezestyle.cpp =================================================================== --- kstyle/breezestyle.cpp +++ kstyle/breezestyle.cpp @@ -2957,7 +2957,9 @@ // copy palette and rect const auto& palette( option->palette ); - const auto& rect( option->rect ); + const auto& rect( option->rect ); + if(widget) + painter->setFont(widget->font()); // detect title widgets const bool isTitleWidget( @@ -3021,7 +3023,11 @@ // copy palette and rect const auto& palette( option->palette ); const auto& rect( option->rect ); - + + const auto lineEdit = qobject_cast( widget ); + if(lineEdit) + painter->setFont(lineEdit->font()); + // make sure there is enough room to render frame if( rect.height() < 2*Metrics::LineEdit_FrameWidth + option->fontMetrics.height()) { @@ -3055,7 +3061,6 @@ _helper->renderFrame( painter, rect, background, outline ); } - return true; } @@ -3064,7 +3069,10 @@ bool Style::drawFrameFocusRectPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { // no focus indicator on buttons / scrollbars, since it is rendered elsewhere - if ( qobject_cast( widget ) || qobject_cast( widget ) || qobject_cast( widget ) ) + const auto abstractButton = qobject_cast( widget ); + const auto scrollBar = qobject_cast( widget ) ; + const auto groupBox = qobject_cast( widget ); + if ( abstractButton || scrollBar || groupBox ) { return true; } // no focus indicator on ComboBox list items @@ -3089,6 +3097,16 @@ painter->setRenderHint( QPainter::Antialiasing, false ); painter->setPen( outlineColor ); painter->drawLine( QPoint( rect.bottomLeft() - QPoint( 0,1 ) ), QPoint( rect.bottomRight() - QPoint( 0,1 ) ) ); + + //Set font + if(abstractButton) + painter->setFont(abstractButton->font()); + + if(scrollBar) + painter->setFont(scrollBar->font()); + + if(groupBox) + painter->setFont(groupBox->font()); return true; @@ -3099,7 +3117,8 @@ { // only draw frame for (expanded) toolbars and QtQuick controls // do nothing for other cases, for which frame is rendered via drawPanelMenuPrimitive - if( qobject_cast( widget ) ) + const auto toolBar = qobject_cast( widget ); + if( toolBar ) { const auto& palette( option->palette ); @@ -3108,6 +3127,8 @@ const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); + + painter->setFont(toolBar->font()); } else if( isQtQuickControl( option, widget ) ) { @@ -3134,7 +3155,7 @@ // no frame for flat groupboxes if( frameOption->features & QStyleOptionFrame::Flat ) return true; - + // normal frame const auto& palette( option->palette ); const auto background( _helper->frameBackgroundColor( palette ) ); @@ -3147,7 +3168,6 @@ painter->setClipRegion( option->rect ); _helper->renderFrame( painter, option->rect, background, outline ); - return true; } @@ -3214,7 +3234,11 @@ const auto background( _helper->frameBackgroundColor( palette ) ); const auto outline( _helper->frameOutlineColor( palette ) ); _helper->renderTabWidgetFrame( painter, rect, background, outline, corners ); - + + //Widget font + if(widget) + painter->setFont(widget->font()); + return true; } @@ -3236,6 +3260,8 @@ painter->setBrush( Qt::NoBrush ); painter->setRenderHint( QPainter::Antialiasing, false ); painter->setPen( QPen( outline, 1 ) ); + + // render switch( tabOption->shape ) @@ -3282,7 +3308,7 @@ // render frame outline const auto outline( _helper->frameOutlineColor( palette, false, selected ) ); _helper->renderMenuFrame( painter, rect, QColor(), outline ); - + return true; } @@ -3370,6 +3396,9 @@ // render _helper->renderArrow( painter, rect, color, orientation ); + + if(widget) + painter->setFont(widget->font()); return true; } @@ -3410,6 +3439,10 @@ const auto buttonOption( qstyleoption_cast< const QStyleOptionButton* >( option ) ); if( !buttonOption ) return true; + //Widget font + if(widget) + painter->setFont(widget->font()); + // rect and palette const auto& rect( option->rect ); @@ -3454,9 +3487,9 @@ // render _helper->renderButtonFrame( painter, rect, background, outline, shadow, hasFocus, sunken ); - } + return true; } @@ -3469,6 +3502,10 @@ const auto& palette( option->palette ); auto rect( option->rect ); + //Widget font + if(widget) + painter->setFont(widget->font()); + // store relevant flags const State& state( option->state ); const bool autoRaise( state & State_AutoRaise ); @@ -3495,6 +3532,7 @@ const auto shadow( _helper->shadowColor( palette ) ); const auto outline( _helper->buttonOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) ); const auto background( _helper->buttonBackgroundColor( palette, mouseOver, hasFocus, sunken, opacity, mode ) ); + painter->setFont(toolButton->font()); // adjust frame in case of menu if( hasPopupMenu ) @@ -3502,6 +3540,7 @@ painter->setClipRect( rect ); rect.adjust( 0, 0, Metrics::Frame_FrameRadius + 2, 0 ); rect = visualRect( option, rect ); + painter->setFont(toolButton->font()); } // render @@ -3513,7 +3552,7 @@ _helper->renderToolButtonFrame( painter, rect, color, sunken ); } - + return true; } @@ -3523,10 +3562,10 @@ // copy palette and rect auto rect( option->rect ); - + // static_cast is safe here since check was already performed in calling function const QTabBar* tabBar( static_cast( widget->parentWidget() ) ); - + // overlap. // subtract 1, because of the empty pixel left the tabwidget frame const int overlap( Metrics::TabBar_BaseOverlap - 1 ); @@ -3568,7 +3607,7 @@ painter->setPen( Qt::NoPen ); painter->setBrush( color ); painter->drawRect( rect ); - + painter->setFont(parent->font()); return true; } @@ -3588,6 +3627,7 @@ painter->setBrush( scrollArea->viewport()->palette().color( scrollArea->viewport()->backgroundRole() ) ); painter->setPen( Qt::NoPen ); painter->drawRect( option->rect ); + painter->setFont(scrollArea->font()); return true; } else { @@ -3600,6 +3640,9 @@ //___________________________________________________________________________________ bool Style::drawPanelMenuPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); /* * do nothing if menu is embedded in another widget * this corresponds to having a transparent background @@ -3616,7 +3659,7 @@ } _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); - + painter->setFont(widget->font()); return true; } @@ -3627,7 +3670,11 @@ // force registration of widget if( widget && widget->window() ) - { _shadowHelper->registerWidget( widget->window(), true ); } + { + _shadowHelper->registerWidget( widget->window(), true ); + //font widget + painter->setFont(widget->font()); + } const auto& palette( option->palette ); const auto &background = palette.color( QPalette::ToolTipBase ); @@ -3646,10 +3693,13 @@ // cast option and check const auto viewItemOption = qstyleoption_cast( option ); if( !viewItemOption ) return false; + else painter->setFont(viewItemOption->font); // try cast widget const auto abstractItemView = qobject_cast( widget ); - + if(abstractItemView) + painter->setFont(abstractItemView->font()); + // store palette and rect const auto& palette( option->palette ); auto rect( option->rect ); @@ -3720,7 +3770,10 @@ //___________________________________________________________________________________ bool Style::drawIndicatorCheckBoxPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { - + //Set font + if(widget) + painter->setFont(widget->font()); + // copy rect and palette const auto& rect( option->rect ); const auto& palette( option->palette ); @@ -3761,6 +3814,10 @@ bool Style::drawIndicatorRadioButtonPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // copy rect and palette const auto& rect( option->rect ); const auto& palette( option->palette ); @@ -3800,6 +3857,10 @@ bool Style::drawIndicatorButtonDropDownPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto toolButtonOption( qstyleoption_cast( option ) ); if( !toolButtonOption ) return true; @@ -3857,6 +3918,10 @@ bool Style::drawIndicatorTabClosePrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // get icon and check QIcon icon( standardIcon( SP_TitleBarCloseButton, option, widget ) ); if( icon.isNull() ) return false; @@ -3996,6 +4061,10 @@ bool Style::drawIndicatorToolBarSeparatorPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + /* * do nothing if disabled from options * also need to check if widget is a combobox, because of Qt hack using 'toolbar' separator primitive @@ -4100,6 +4169,10 @@ bool Style::drawPushButtonLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto buttonOption( qstyleoption_cast( option ) ); if( !buttonOption ) return true; @@ -4222,7 +4295,11 @@ // cast option and check const auto toolButtonOption( qstyleoption_cast(option) ); - + + //Set font + if(toolButtonOption) + painter->setFont(toolButtonOption->font); + // copy rect and palette const auto& rect = option->rect; const auto& palette = option->palette; @@ -4355,6 +4432,10 @@ bool Style::drawCheckBoxLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto buttonOption( qstyleoption_cast(option) ); if( !buttonOption ) return true; @@ -4419,6 +4500,10 @@ //___________________________________________________________________________________ bool Style::drawComboBoxLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + const auto comboBoxOption( qstyleoption_cast( option ) ); if( !comboBoxOption ) return false; if( comboBoxOption->editable ) return false; @@ -4491,6 +4576,10 @@ bool Style::drawMenuBarItemControl( const QStyleOption* option, QPainter* painter, const QWidget* widget) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto menuItemOption = qstyleoption_cast( option ); if( !menuItemOption ) return true; @@ -4809,6 +4898,10 @@ bool Style::drawProgressBarControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + const auto progressBarOption( qstyleoption_cast( option ) ); if( !progressBarOption ) return true; @@ -4958,6 +5051,10 @@ bool Style::drawScrollBarSliderControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto sliderOption( qstyleoption_cast( option ) ); if( !sliderOption ) return true; @@ -5020,6 +5117,10 @@ bool Style::drawScrollBarAddLineControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // do nothing if no buttons are defined if( _addLineButtons == NoButton ) return true; @@ -5102,6 +5203,10 @@ bool Style::drawScrollBarSubLineControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // do nothing if no buttons are set if( _subLineButtons == NoButton ) return true; @@ -5183,6 +5288,10 @@ bool Style::drawShapedFrameControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto frameOpt = qstyleoption_cast( option ); if( !frameOpt ) return false; @@ -5288,6 +5397,9 @@ painter->setBrush( color ); painter->setPen( Qt::NoPen ); painter->drawRect( rect ); + //Set font + if(widget) + painter->setFont(widget->font()); // outline painter->setBrush( Qt::NoBrush ); @@ -5375,6 +5487,10 @@ bool Style::drawTabBarTabLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // call parent style method ParentStyleClass::drawControl( CE_TabBarTabLabel, option, painter, widget ); @@ -5456,6 +5572,10 @@ bool Style::drawTabBarTabShapeControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + const auto tabOption( qstyleoption_cast( option ) ); if( !tabOption ) return true; @@ -5645,6 +5765,10 @@ bool Style::drawToolBoxTabLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // rendering is similar to drawPushButtonLabelControl // cast option and check const auto toolBoxOption( qstyleoption_cast( option ) ); @@ -5723,6 +5847,10 @@ bool Style::drawToolBoxTabShapeControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto toolBoxOption( qstyleoption_cast( option ) ); if( !toolBoxOption ) return true; @@ -5774,6 +5902,10 @@ bool Style::drawDockWidgetTitleControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto dockWidgetOption = qstyleoption_cast( option ); if( !dockWidgetOption ) return true; @@ -5842,6 +5974,10 @@ bool Style::drawGroupBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // base class method ParentStyleClass::drawComplexControl( CC_GroupBox, option, painter, widget ); @@ -5890,6 +6026,10 @@ bool Style::drawToolButtonComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto toolButtonOption( qstyleoption_cast( option ) ); if( !toolButtonOption ) return true; @@ -6003,6 +6143,10 @@ bool Style::drawComboBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto comboBoxOption( qstyleoption_cast( option ) ); if( !comboBoxOption ) return true; @@ -6142,6 +6286,10 @@ bool Style::drawSpinBoxComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + const auto spinBoxOption( qstyleoption_cast( option ) ); if( !spinBoxOption ) return true; @@ -6184,6 +6332,10 @@ bool Style::drawSliderComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto sliderOption( qstyleoption_cast( option ) ); if( !sliderOption ) return true; @@ -6337,6 +6489,10 @@ bool Style::drawDialComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto sliderOption( qstyleoption_cast( option ) ); if( !sliderOption ) return true; @@ -6419,6 +6575,10 @@ //______________________________________________________________ bool Style::drawScrollBarComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + //the animation for QStyle::SC_ScrollBarGroove is special: it will animate //the opacity of everything else as well, included slider and arrows qreal opacity( _animations->scrollBarEngine().opacity( widget, QStyle::SC_ScrollBarGroove ) ); @@ -6475,6 +6635,10 @@ bool Style::drawTitleBarComplexControl( const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { + //Set font + if(widget) + painter->setFont(widget->font()); + // cast option and check const auto titleBarOption( qstyleoption_cast( option ) ); if( !titleBarOption ) return true;