From 4bfd9c3f9e1ec4333027e1c780dc339e5700ae4d Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 6 Aug 2014 11:16:38 +0200 Subject: [PATCH] alter frame palettes at application polishing. this prevent palettes to be double-changed and still allows for client customization --- kstyle/breezestyle.cpp | 22 ++++++++++++---------- kstyle/breezestyle.h | 3 +++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index 20341d8a..dd78ce67 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -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( widget ) ) { - // change palette - widget->setPalette( _helper->framePalette( QGuiApplication::palette() ) ); - // checkable group boxes if( groupBox->isCheckable() ) { groupBox->setAttribute( Qt::WA_Hover ); } - - } else if( qobject_cast( widget ) ) { - - // change palette - widget->setPalette( _helper->framePalette( QGuiApplication::palette() ) ); - } else if( qobject_cast( widget ) && qobject_cast( 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 ); diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h index ed177dc2..c127fa47 100644 --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -88,6 +88,9 @@ namespace Breeze //! destructor virtual ~Style( void ); + //! application polishing + virtual void polish( QApplication* ); + //! widget polishing virtual void polish( QWidget* );