alter frame palettes at application polishing.

this prevent palettes to be double-changed and still allows for client customization
wilder-pre-rebase
Hugo Pereira Da Costa 12 years ago
parent fdfd70473f
commit 4bfd9c3f9e
  1. 22
      kstyle/breezestyle.cpp
  2. 3
      kstyle/breezestyle.h

@ -160,6 +160,18 @@ namespace Breeze
delete _helper;
}
//______________________________________________________________
void Style::polish( QApplication* )
{
// alter palette for relevant framed widgets
const QPalette palette( _helper->framePalette( QGuiApplication::palette() ) );
QApplication::setPalette( palette, "QDockWidget" );
QApplication::setPalette( palette, "QGroupBox" );
QApplication::setPalette( palette, "QTabWidget" );
}
//______________________________________________________________
void Style::polish( QWidget* widget )
{
@ -206,19 +218,10 @@ namespace Breeze
} else if( QGroupBox* groupBox = qobject_cast<QGroupBox*>( widget ) ) {
// change palette
widget->setPalette( _helper->framePalette( QGuiApplication::palette() ) );
// checkable group boxes
if( groupBox->isCheckable() )
{ groupBox->setAttribute( Qt::WA_Hover ); }
} else if( qobject_cast<QTabWidget*>( widget ) ) {
// change palette
widget->setPalette( _helper->framePalette( QGuiApplication::palette() ) );
} else if( qobject_cast<QAbstractButton*>( widget ) && qobject_cast<QDockWidget*>( widget->parent() ) ) {
widget->setAttribute( Qt::WA_Hover );
@ -263,7 +266,6 @@ namespace Breeze
// add event filter on dock widgets
// and alter palette
widget->setAutoFillBackground( false );
widget->setPalette( _helper->framePalette( QGuiApplication::palette() ) );
widget->setContentsMargins( Metrics::Frame_FrameWidth, Metrics::Frame_FrameWidth, Metrics::Frame_FrameWidth, Metrics::Frame_FrameWidth );
addEventFilter( widget );

@ -88,6 +88,9 @@ namespace Breeze
//! destructor
virtual ~Style( void );
//! application polishing
virtual void polish( QApplication* );
//! widget polishing
virtual void polish( QWidget* );

Loading…
Cancel
Save