Changeset View
Standalone View
kstyle/breezestyle.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show All 24 Lines | |||||
25 | #include "breezemdiwindowshadow.h" | 25 | #include "breezemdiwindowshadow.h" | ||
26 | #include "breezemnemonics.h" | 26 | #include "breezemnemonics.h" | ||
27 | #include "breezepropertynames.h" | 27 | #include "breezepropertynames.h" | ||
28 | #include "breezeshadowhelper.h" | 28 | #include "breezeshadowhelper.h" | ||
29 | #include "breezesplitterproxy.h" | 29 | #include "breezesplitterproxy.h" | ||
30 | #include "breezestyleconfigdata.h" | 30 | #include "breezestyleconfigdata.h" | ||
31 | #include "breezewidgetexplorer.h" | 31 | #include "breezewidgetexplorer.h" | ||
32 | #include "breezewindowmanager.h" | 32 | #include "breezewindowmanager.h" | ||
33 | #include "breezeblurhelper.h" | ||||
33 | 34 | | |||
34 | #include <KColorUtils> | 35 | #include <KColorUtils> | ||
35 | 36 | | |||
36 | #include <QApplication> | 37 | #include <QApplication> | ||
37 | #include <QCheckBox> | 38 | #include <QCheckBox> | ||
38 | #include <QComboBox> | 39 | #include <QComboBox> | ||
39 | #include <QDial> | 40 | #include <QDial> | ||
40 | #include <QDBusConnection> | 41 | #include <QDBusConnection> | ||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | 148 | Style::Style(): | |||
152 | , _helper( new Helper( "breeze" ) ) | 153 | , _helper( new Helper( "breeze" ) ) | ||
153 | #else | 154 | #else | ||
154 | , _helper( new Helper( StyleConfigData::self()->sharedConfig() ) ) | 155 | , _helper( new Helper( StyleConfigData::self()->sharedConfig() ) ) | ||
155 | #endif | 156 | #endif | ||
156 | 157 | | |||
157 | , _shadowHelper( new ShadowHelper( this, *_helper ) ) | 158 | , _shadowHelper( new ShadowHelper( this, *_helper ) ) | ||
158 | , _animations( new Animations( this ) ) | 159 | , _animations( new Animations( this ) ) | ||
159 | , _mnemonics( new Mnemonics( this ) ) | 160 | , _mnemonics( new Mnemonics( this ) ) | ||
161 | , _blurHelper( new BlurHelper( this, *_helper ) ) | ||||
160 | , _windowManager( new WindowManager( this ) ) | 162 | , _windowManager( new WindowManager( this ) ) | ||
161 | , _frameShadowFactory( new FrameShadowFactory( this ) ) | 163 | , _frameShadowFactory( new FrameShadowFactory( this ) ) | ||
162 | , _mdiWindowShadowFactory( new MdiWindowShadowFactory( this ) ) | 164 | , _mdiWindowShadowFactory( new MdiWindowShadowFactory( this ) ) | ||
163 | , _splitterFactory( new SplitterFactory( this ) ) | 165 | , _splitterFactory( new SplitterFactory( this ) ) | ||
164 | , _widgetExplorer( new WidgetExplorer( this ) ) | 166 | , _widgetExplorer( new WidgetExplorer( this ) ) | ||
165 | , _tabBarData( new BreezePrivate::TabBarData( this ) ) | 167 | , _tabBarData( new BreezePrivate::TabBarData( this ) ) | ||
166 | #if BREEZE_HAVE_KSTYLE||BREEZE_USE_KDE4 | 168 | #if BREEZE_HAVE_KSTYLE||BREEZE_USE_KDE4 | ||
167 | , SH_ArgbDndWindow( newStyleHint( QStringLiteral( "SH_ArgbDndWindow" ) ) ) | 169 | , SH_ArgbDndWindow( newStyleHint( QStringLiteral( "SH_ArgbDndWindow" ) ) ) | ||
▲ Show 20 Lines • Show All 265 Lines • ▼ Show 20 Line(s) | 434 | { | |||
433 | 435 | | |||
434 | // register widget to animations | 436 | // register widget to animations | ||
435 | _animations->unregisterWidget( widget ); | 437 | _animations->unregisterWidget( widget ); | ||
436 | _frameShadowFactory->unregisterWidget( widget ); | 438 | _frameShadowFactory->unregisterWidget( widget ); | ||
437 | _mdiWindowShadowFactory->unregisterWidget( widget ); | 439 | _mdiWindowShadowFactory->unregisterWidget( widget ); | ||
438 | _shadowHelper->unregisterWidget( widget ); | 440 | _shadowHelper->unregisterWidget( widget ); | ||
439 | _windowManager->unregisterWidget( widget ); | 441 | _windowManager->unregisterWidget( widget ); | ||
440 | _splitterFactory->unregisterWidget( widget ); | 442 | _splitterFactory->unregisterWidget( widget ); | ||
443 | _blurHelper->unregisterWidget( widget ); | ||||
441 | 444 | | |||
442 | // remove event filter | 445 | // remove event filter | ||
443 | if( qobject_cast<QAbstractScrollArea*>( widget ) || | 446 | if( qobject_cast<QAbstractScrollArea*>( widget ) || | ||
444 | qobject_cast<QDockWidget*>( widget ) || | 447 | qobject_cast<QDockWidget*>( widget ) || | ||
445 | qobject_cast<QMdiSubWindow*>( widget ) || | 448 | qobject_cast<QMdiSubWindow*>( widget ) || | ||
446 | widget->inherits( "QComboBoxPrivateContainer" ) ) | 449 | widget->inherits( "QComboBoxPrivateContainer" ) ) | ||
447 | { widget->removeEventFilter( this ); } | 450 | { widget->removeEventFilter( this ); } | ||
448 | 451 | | |||
▲ Show 20 Lines • Show All 3155 Lines • ▼ Show 20 Line(s) | 3605 | } else { | |||
3604 | return false; | 3607 | return false; | ||
3605 | 3608 | | |||
3606 | } | 3609 | } | ||
3607 | 3610 | | |||
3608 | } | 3611 | } | ||
3609 | //___________________________________________________________________________________ | 3612 | //___________________________________________________________________________________ | ||
3610 | bool Style::drawPanelMenuPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3613 | bool Style::drawPanelMenuPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3611 | { | 3614 | { | ||
3612 | | ||||
3613 | /* | 3615 | /* | ||
3614 | * do nothing if menu is embedded in another widget | 3616 | * do nothing if menu is embedded in another widget | ||
3615 | * this corresponds to having a transparent background | 3617 | * this corresponds to having a transparent background | ||
3616 | */ | 3618 | */ | ||
3617 | if( widget && !widget->isWindow() ) return true; | 3619 | if( widget && !widget->isWindow() ) return true; | ||
3618 | 3620 | | |||
3619 | const auto& palette( option->palette ); | 3621 | const auto& palette( option->palette ); | ||
3620 | const auto background( _helper->frameBackgroundColor( palette ) ); | | |||
3621 | const auto outline( _helper->frameOutlineColor( palette ) ); | 3622 | const auto outline( _helper->frameOutlineColor( palette ) ); | ||
3623 | auto background( _helper->frameBackgroundColor( palette ) ); | ||||
3622 | 3624 | | |||
3623 | const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); | 3625 | const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); | ||
3626 | int menuOpacity = StyleConfigData::menuOpacity(); | ||||
3627 | | ||||
3628 | if (hasAlpha && menuOpacity < 100) { | ||||
3629 | background.setAlphaF(menuOpacity / 100.0); | ||||
zzag: buggy..
`background.setAlphaF(StyleConfigData::menuTransparency() / 100.0f);` | |||||
The slider has 10 steps and goes from 0 to 10, that's why it's / 10.0 And we need to invert the value of it because the setAlphaF works inverted to our slider and it needs a value between 0.0 and 1.0 anemeth: The slider has 10 steps and goes from 0 to 10, that's why it's `/ 10.0`
100 steps would be too… | |||||
IMO, transparency should be in range 0-100.
Why? zzag: IMO, transparency should be in range 0-100.
> It would be great if we could set the slider to… | |||||
This should be called only if StyleConfigData::menuOpacity() is < 100 hpereiradacosta: This should be called only if StyleConfigData::menuOpacity() is < 100
And in fact, I wonder if… | |||||
3630 | | ||||
3631 | // force registration of widget | ||||
3632 | _blurHelper->registerWidget( widget->window() ); | ||||
This should go to Breeze::Style::polish. hpereiradacosta: This should go to Breeze::Style::polish.
There is already a "if( qobject_cast<QMenu*>( widget… | |||||
3633 | } | ||||
3634 | | ||||
3624 | _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); | 3635 | _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); | ||
3625 | 3636 | | |||
3626 | return true; | 3637 | return true; | ||
3627 | 3638 | | |||
3628 | } | 3639 | } | ||
3629 | 3640 | | |||
3630 | //___________________________________________________________________________________ | 3641 | //___________________________________________________________________________________ | ||
3631 | bool Style::drawPanelTipLabelPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3642 | bool Style::drawPanelTipLabelPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
▲ Show 20 Lines • Show All 3510 Lines • Show Last 20 Lines |
buggy..
background.setAlphaF(StyleConfigData::menuTransparency() / 100.0f);