implemented toolbar separators

wilder-pre-rebase
Hugo Pereira Da Costa 12 years ago
parent 0238c76bfd
commit 0223f9bb72
  1. 5
      kstyle/breeze.kcfg
  2. 6
      kstyle/breezehelper.cpp
  3. 7
      kstyle/breezehelper.h
  4. 49
      kstyle/breezestyle.cpp
  5. 2
      kstyle/breezestyle.h

@ -45,6 +45,11 @@
<default>MN_NEVER</default>
</entry>
<!-- toolbars -->
<entry name="ToolBarDrawItemSeparator" type="Bool">
<default>true</default>
</entry>
<!-- window dragging -->
<entry name="WindowDragEnabled" type="Bool">
<default>true</default>

@ -190,7 +190,7 @@ namespace Breeze
}
//______________________________________________________________________________
QColor Helper::checkBoxMarkerColor( const QPalette& palette, bool mouseOver, bool active, qreal opacity, AnimationMode mode ) const
QColor Helper::checkBoxIndicatorColor( const QPalette& palette, bool mouseOver, bool active, qreal opacity, AnimationMode mode ) const
{
QColor color( KColorUtils::mix( palette.color( QPalette::Window ), palette.color( QPalette::WindowText ), 0.5 ) );
@ -216,6 +216,10 @@ namespace Breeze
}
//______________________________________________________________________________
QColor Helper::separatorColor( const QPalette& palette ) const
{ return KColorUtils::mix( palette.color( QPalette::Window ), palette.color( QPalette::WindowText ), 0.25 ); }
//______________________________________________________________________________
QPalette Helper::disabledPalette( const QPalette& source, qreal ratio ) const
{

@ -99,8 +99,11 @@ namespace Breeze
//! slider outline color, using animations
QColor sliderOutlineColor( const QPalette&, bool mouseOver, bool hasFocus, qreal opacity, AnimationMode ) const;
//! checkbox marker, using animations
QColor checkBoxMarkerColor( const QPalette&, bool mouseOver, bool active, qreal opacity, AnimationMode ) const;
//! checkbox indicator, using animations
QColor checkBoxIndicatorColor( const QPalette&, bool mouseOver, bool active, qreal opacity, AnimationMode ) const;
//! separator color
QColor separatorColor( const QPalette& ) const;
//! merge active and inactive palettes based on ratio, for smooth enable state change transition
QPalette disabledPalette( const QPalette&, qreal ratio ) const;

@ -598,6 +598,7 @@ namespace Breeze
case PE_IndicatorArrowLeft: fcn = &Style::drawIndicatorArrowLeftPrimitive; break;
case PE_IndicatorArrowRight: fcn = &Style::drawIndicatorArrowRightPrimitive; break;
case PE_IndicatorHeaderArrow: fcn = &Style::drawIndicatorHeaderArrowPrimitive; break;
case PE_IndicatorToolBarSeparator: fcn = &Style::drawIndicatorToolBarSeparatorPrimitive; break;
// frames
case PE_FrameStatusBar: fcn = &Style::emptyPrimitive; break;
@ -2171,7 +2172,7 @@ namespace Breeze
// colors
const QPalette& palette( option->palette );
const QColor color( _helper->checkBoxMarkerColor( palette, mouseOver, enabled && active, opacity, mode ) );
const QColor color( _helper->checkBoxIndicatorColor( palette, mouseOver, enabled && active, opacity, mode ) );
const QColor shadow( _helper->shadowColor( palette ) );
// render
@ -2199,7 +2200,7 @@ namespace Breeze
// colors
const QPalette& palette( option->palette );
const QColor color( _helper->checkBoxMarkerColor( palette, mouseOver, enabled && checked, opacity, mode ) );
const QColor color( _helper->checkBoxIndicatorColor( palette, mouseOver, enabled && checked, opacity, mode ) );
const QColor shadow( _helper->shadowColor( palette ) );
// render
@ -2209,6 +2210,38 @@ namespace Breeze
}
//___________________________________________________________________________________
bool Style::drawIndicatorToolBarSeparatorPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* ) const
{
// do nothing if disabled from options
if( !StyleConfigData::toolBarDrawItemSeparator() ) return true;
const State& flags( option->state );
const bool horizontal( flags & State_Horizontal );
const QRect& rect( option->rect );
const QPalette& palette( option->palette );
painter->setRenderHint( QPainter::Antialiasing, false );
painter->setBrush( Qt::NoBrush );
painter->setPen( _helper->separatorColor( palette ) );
if( horizontal )
{
painter->translate( rect.width()/2, 0 );
painter->drawLine( rect.topLeft(), rect.bottomLeft() );
} else {
painter->translate( 0, rect.height()/2 );
painter->drawLine( rect.topLeft(), rect.topRight() );
}
return true;
}
//___________________________________________________________________________________
bool Style::drawPushButtonLabelControl( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const
{
@ -2755,22 +2788,26 @@ namespace Breeze
case QFrame::HLine:
{
painter->setRenderHint( QPainter::Antialiasing, false );
const QPalette& palette( option->palette );
const QRect rect( option->rect );
const QColor color( KColorUtils::mix( palette.color( QPalette::Window ), palette.color( QPalette::WindowText ), 0.25 ) );
painter->setBrush( Qt::NoBrush );
painter->setPen( QPen( color, 1 ) );
painter->setPen( _helper->separatorColor( palette ) );
painter->translate( 0, rect.height()/2 );
painter->drawLine( rect.topLeft(), rect.topRight() );
return true;
}
case QFrame::VLine:
{
painter->setRenderHint( QPainter::Antialiasing, false );
const QPalette& palette( option->palette );
const QRect rect( option->rect );
const QColor color( KColorUtils::mix( palette.color( QPalette::Window ), palette.color( QPalette::WindowText ), 0.25 ) );
painter->setBrush( Qt::NoBrush );
painter->setPen( QPen( color, 1 ) );
painter->setPen( _helper->separatorColor( palette ) );
painter->translate( rect.width()/2, 0 );
painter->drawLine( rect.topLeft(), rect.bottomLeft() );
return true;
}

@ -328,7 +328,7 @@ namespace Breeze
bool drawIndicatorRadioButtonPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
// bool drawIndicatorTabTearPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
// bool drawIndicatorToolBarHandlePrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
// bool drawIndicatorToolBarSeparatorPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
bool drawIndicatorToolBarSeparatorPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
// bool drawWidgetPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
//@}

Loading…
Cancel
Save