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 106 Lines • ▼ Show 20 Line(s) | 145 | { | |||
147 | Style::Style(): | 148 | Style::Style(): | ||
148 | _addLineButtons( SingleButton ) | 149 | _addLineButtons( SingleButton ) | ||
149 | , _subLineButtons( SingleButton ) | 150 | , _subLineButtons( SingleButton ) | ||
150 | 151 | | |||
151 | #if BREEZE_USE_KDE4 | 152 | #if BREEZE_USE_KDE4 | ||
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() ) ) | ||
156 | , _blurHelper( new BlurHelper( this ) ) | ||||
155 | #endif | 157 | #endif | ||
156 | 158 | | |||
157 | , _shadowHelper( new ShadowHelper( this, *_helper ) ) | 159 | , _shadowHelper( new ShadowHelper( this, *_helper ) ) | ||
158 | , _animations( new Animations( this ) ) | 160 | , _animations( new Animations( this ) ) | ||
159 | , _mnemonics( new Mnemonics( this ) ) | 161 | , _mnemonics( new Mnemonics( this ) ) | ||
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 ) ) | ||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Line(s) | 312 | } else if( widget->parentWidget() && widget->parentWidget()->parentWidget() && qobject_cast<QToolBox*>( widget->parentWidget()->parentWidget()->parentWidget() ) ) { | |||
312 | widget->setBackgroundRole( QPalette::NoRole ); | 314 | widget->setBackgroundRole( QPalette::NoRole ); | ||
313 | widget->setAutoFillBackground( false ); | 315 | widget->setAutoFillBackground( false ); | ||
314 | widget->parentWidget()->setAutoFillBackground( false ); | 316 | widget->parentWidget()->setAutoFillBackground( false ); | ||
315 | 317 | | |||
316 | } else if( qobject_cast<QMenu*>( widget ) ) { | 318 | } else if( qobject_cast<QMenu*>( widget ) ) { | ||
317 | 319 | | |||
318 | setTranslucentBackground( widget ); | 320 | setTranslucentBackground( widget ); | ||
319 | 321 | | |||
322 | #if !BREEZE_USE_KDE4 | ||||
323 | if ( _helper->hasAlphaChannel( widget ) && StyleConfigData::menuOpacity() < 100 ) { | ||||
324 | _blurHelper->registerWidget( widget->window() ); | ||||
325 | } | ||||
326 | #endif | ||||
327 | | ||||
320 | #if QT_VERSION >= 0x050000 | 328 | #if QT_VERSION >= 0x050000 | ||
321 | } else if( qobject_cast<QCommandLinkButton*>( widget ) ) { | 329 | } else if( qobject_cast<QCommandLinkButton*>( widget ) ) { | ||
322 | 330 | | |||
323 | addEventFilter( widget ); | 331 | addEventFilter( widget ); | ||
324 | #endif | 332 | #endif | ||
325 | } else if( auto comboBox = qobject_cast<QComboBox*>( widget ) ) { | 333 | } else if( auto comboBox = qobject_cast<QComboBox*>( widget ) ) { | ||
326 | 334 | | |||
327 | if( !hasParent( widget, "QWebView" ) ) | 335 | if( !hasParent( widget, "QWebView" ) ) | ||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Line(s) | 440 | { | |||
434 | // register widget to animations | 442 | // register widget to animations | ||
435 | _animations->unregisterWidget( widget ); | 443 | _animations->unregisterWidget( widget ); | ||
436 | _frameShadowFactory->unregisterWidget( widget ); | 444 | _frameShadowFactory->unregisterWidget( widget ); | ||
437 | _mdiWindowShadowFactory->unregisterWidget( widget ); | 445 | _mdiWindowShadowFactory->unregisterWidget( widget ); | ||
438 | _shadowHelper->unregisterWidget( widget ); | 446 | _shadowHelper->unregisterWidget( widget ); | ||
439 | _windowManager->unregisterWidget( widget ); | 447 | _windowManager->unregisterWidget( widget ); | ||
440 | _splitterFactory->unregisterWidget( widget ); | 448 | _splitterFactory->unregisterWidget( widget ); | ||
441 | 449 | | |||
450 | #if !BREEZE_USE_KDE4 | ||||
451 | _blurHelper->unregisterWidget( widget ); | ||||
452 | #endif | ||||
453 | | ||||
442 | // remove event filter | 454 | // remove event filter | ||
443 | if( qobject_cast<QAbstractScrollArea*>( widget ) || | 455 | if( qobject_cast<QAbstractScrollArea*>( widget ) || | ||
444 | qobject_cast<QDockWidget*>( widget ) || | 456 | qobject_cast<QDockWidget*>( widget ) || | ||
445 | qobject_cast<QMdiSubWindow*>( widget ) || | 457 | qobject_cast<QMdiSubWindow*>( widget ) || | ||
446 | widget->inherits( "QComboBoxPrivateContainer" ) ) | 458 | widget->inherits( "QComboBoxPrivateContainer" ) ) | ||
447 | { widget->removeEventFilter( this ); } | 459 | { widget->removeEventFilter( this ); } | ||
448 | 460 | | |||
449 | ParentStyleClass::unpolish( widget ); | 461 | ParentStyleClass::unpolish( widget ); | ||
▲ Show 20 Lines • Show All 3154 Lines • ▼ Show 20 Line(s) | 3614 | } else { | |||
3604 | return false; | 3616 | return false; | ||
3605 | 3617 | | |||
3606 | } | 3618 | } | ||
3607 | 3619 | | |||
3608 | } | 3620 | } | ||
3609 | //___________________________________________________________________________________ | 3621 | //___________________________________________________________________________________ | ||
3610 | bool Style::drawPanelMenuPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3622 | bool Style::drawPanelMenuPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | ||
3611 | { | 3623 | { | ||
3612 | | ||||
3613 | /* | 3624 | /* | ||
3614 | * do nothing if menu is embedded in another widget | 3625 | * do nothing if menu is embedded in another widget | ||
3615 | * this corresponds to having a transparent background | 3626 | * this corresponds to having a transparent background | ||
3616 | */ | 3627 | */ | ||
3617 | if( widget && !widget->isWindow() ) return true; | 3628 | if( widget && !widget->isWindow() ) return true; | ||
3618 | 3629 | | |||
3619 | const auto& palette( option->palette ); | 3630 | const auto& palette( option->palette ); | ||
3620 | const auto background( _helper->frameBackgroundColor( palette ) ); | | |||
3621 | const auto outline( _helper->frameOutlineColor( palette ) ); | 3631 | const auto outline( _helper->frameOutlineColor( palette ) ); | ||
3622 | | ||||
3623 | const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); | 3632 | const bool hasAlpha( _helper->hasAlphaChannel( widget ) ); | ||
3633 | auto background( _helper->frameBackgroundColor( palette ) ); | ||||
3634 | | ||||
3635 | #if !BREEZE_USE_KDE4 | ||||
3636 | if ( hasAlpha ) { | ||||
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… | |||||
3637 | background.setAlphaF(StyleConfigData::menuOpacity() / 100.0); | ||||
3638 | } | ||||
3639 | #endif | ||||
This should go to Breeze::Style::polish. hpereiradacosta: This should go to Breeze::Style::polish.
There is already a "if( qobject_cast<QMenu*>( widget… | |||||
3640 | | ||||
3624 | _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); | 3641 | _helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha ); | ||
3625 | 3642 | | |||
3626 | return true; | 3643 | return true; | ||
3627 | 3644 | | |||
3628 | } | 3645 | } | ||
3629 | 3646 | | |||
3630 | //___________________________________________________________________________________ | 3647 | //___________________________________________________________________________________ | ||
3631 | bool Style::drawPanelTipLabelPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const | 3648 | 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);