diff --git a/kstyle/breeze.kcfg b/kstyle/breeze.kcfg --- a/kstyle/breeze.kcfg +++ b/kstyle/breeze.kcfg @@ -40,7 +40,7 @@ - + true @@ -97,7 +97,7 @@ true - + true @@ -185,6 +185,11 @@ false + + + 100 + + diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -33,6 +33,10 @@ #include +#if !BREEZE_USE_KDE4 +#include +#endif + #include #include #include @@ -3609,18 +3613,28 @@ //___________________________________________________________________________________ bool Style::drawPanelMenuPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { - /* * do nothing if menu is embedded in another widget * this corresponds to having a transparent background */ if( widget && !widget->isWindow() ) return true; const auto& palette( option->palette ); - const auto background( _helper->frameBackgroundColor( palette ) ); const auto outline( _helper->frameOutlineColor( palette ) ); + auto background( _helper->frameBackgroundColor( palette ) ); const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); + int menuOpacity = StyleConfigData::menuOpacity(); + + if (hasAlpha && menuOpacity < 100) { + + #if !BREEZE_USE_KDE4 + KWindowEffects::enableBlurBehind(widget->winId(), true); + #endif + + background.setAlphaF(menuOpacity / 100.0); + } + _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); return true; diff --git a/kstyle/config/breezestyleconfig.cpp b/kstyle/config/breezestyleconfig.cpp --- a/kstyle/config/breezestyleconfig.cpp +++ b/kstyle/config/breezestyleconfig.cpp @@ -64,6 +64,7 @@ connect( _scrollBarAddLineButtons, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); connect( _scrollBarSubLineButtons, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); connect( _windowDragMode, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); + connect( _menuOpacity, SIGNAL(valueChanged(int)), SLOT(updateChanged()) ); } @@ -84,7 +85,8 @@ StyleConfigData::setScrollBarSubLineButtons( _scrollBarSubLineButtons->currentIndex() ); StyleConfigData::setAnimationsEnabled( _animationsEnabled->isChecked() ); StyleConfigData::setAnimationsDuration( _animationsDuration->value() ); - StyleConfigData::setWindowDragMode( _windowDragMode->currentIndex() ); + StyleConfigData::setWindowDragMode( _windowDragMode->currentIndex() ); + StyleConfigData::setMenuOpacity( _menuOpacity->value() ); #if BREEZE_USE_KDE4 StyleConfigData::self()->writeConfig(); @@ -147,6 +149,7 @@ else if( _animationsEnabled->isChecked() != StyleConfigData::animationsEnabled() ) modified = true; else if( _animationsDuration->value() != StyleConfigData::animationsDuration() ) modified = true; else if( _windowDragMode->currentIndex() != StyleConfigData::windowDragMode() ) modified = true; + else if( _menuOpacity->value() != StyleConfigData::menuOpacity() ) modified = true; emit changed(modified); @@ -171,6 +174,7 @@ _animationsEnabled->setChecked( StyleConfigData::animationsEnabled() ); _animationsDuration->setValue( StyleConfigData::animationsDuration() ); _windowDragMode->setCurrentIndex( StyleConfigData::windowDragMode() ); + _menuOpacity->setValue( StyleConfigData::menuOpacity() ); } diff --git a/kstyle/config/ui/breezestyleconfig.ui b/kstyle/config/ui/breezestyleconfig.ui --- a/kstyle/config/ui/breezestyleconfig.ui +++ b/kstyle/config/ui/breezestyleconfig.ui @@ -6,10 +6,16 @@ 0 0 - 522 - 257 + 562 + 264 + + + 0 + 0 + + 0 @@ -177,7 +183,7 @@ false - Anima&tions duration: + A&nimations duration: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -380,6 +386,140 @@ + + + Transparency + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Transparent + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Opaque + + + + + + + + + + + Menu: + + + + + + + 0 + + + 100 + + + 1 + + + 10 + + + 100 + + + Qt::Horizontal + + + false + + + false + + + QSlider::TicksBelow + + + 10 + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 542 + 20 + + + + + +