implemented tab close

wilder-pre-rebase
Hugo Pereira Da Costa 12 years ago
parent 430cf3193f
commit 239850bcbe
  1. 36
      kstyle/breezestyle.cpp
  2. 2
      kstyle/breezestyle.h

@ -725,6 +725,9 @@ namespace Breeze
// menu indicator
case PE_IndicatorButtonDropDown: fcn = &Style::drawIndicatorButtonDropDownPrimitive; break;
// tab close
case PE_IndicatorTabClose: fcn = &Style::drawIndicatorTabClosePrimitive; break;
// arrows
case PE_IndicatorArrowUp: fcn = &Style::drawIndicatorArrowUpPrimitive; break;
case PE_IndicatorArrowDown: fcn = &Style::drawIndicatorArrowDownPrimitive; break;
@ -2998,6 +3001,39 @@ namespace Breeze
}
//___________________________________________________________________________________
bool Style::drawIndicatorTabClosePrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const
{
// get icon and check
QIcon icon( standardIcon( SP_TitleBarCloseButton, option, widget ) );
if( icon.isNull() ) return false;
// store state
const State& state( option->state );
const bool enabled( state & State_Enabled );
const bool active( state & State_Raised );
const bool sunken( state & State_Sunken );
// decide icon mode and state
QIcon::Mode iconMode;
if( enabled ) iconMode = active ? QIcon::Active:QIcon::Normal;
else iconMode = QIcon::Disabled;
const QIcon::State iconState( sunken ? QIcon::On : QIcon::Off );
// icon size
const int iconWidth( pixelMetric(QStyle::PM_SmallIconSize, option, widget ) );
const QSize iconSize( iconWidth, iconWidth );
// get pixmap
const QPixmap pixmap( icon.pixmap( iconSize, iconMode, iconState ) );
// render
drawItemPixmap( painter, option->rect, Qt::AlignCenter, pixmap );
return true;
}
//___________________________________________________________________________________
bool Style::drawIndicatorToolBarSeparatorPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* ) const
{

@ -265,7 +265,7 @@ namespace Breeze
bool drawFrameTabWidgetPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
bool drawFrameTabBarBasePrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
bool drawFrameWindowPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
// bool drawIndicatorTabClose( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const;
bool drawIndicatorTabClosePrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const;
bool drawIndicatorArrowUpPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const
{ return drawIndicatorArrowPrimitive( ArrowUp, option, painter, widget ); }

Loading…
Cancel
Save