Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 5f014ad..4653639 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -85,2 +85,7 @@ void TransMenuHandler::reloadSettings() opacity = config. readNumEntry("Opacity", 10); + if ( opacity < -20 ) + opacity = 20; + else if ( opacity > 20 ) + opacity = 20; + shadowText = config. readBoolEntry("ShadowText", true); @@ -90,3 +95,3 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) { - QPopupMenu *p = (QPopupMenu *)obj; + QWidget *p = (QWidget *)obj; @@ -120,3 +125,17 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) } + + if (p->inherits("QPopupMenu")) pixDict.insert(p->winId(), pix); + else { + p->setBackgroundPixmap(*pix); + + QObjectList *ol = p-> queryList("QWidget"); + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { + QWidget *wid = (QWidget *) it.current ( ); + + wid-> setBackgroundPixmap(*pix); + wid-> setBackgroundOrigin(QWidget::ParentOrigin); + } + delete ol; + } } @@ -127,3 +146,25 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); + + if (p->inherits("QPopupMenu")) pixDict.remove(p->winId()); + else { + p->setBackgroundMode(QWidget::PaletteBackground); + + QObjectList *ol = p-> queryList("QWidget"); + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { + QWidget *wid = (QWidget *) it.current ( ); + + wid-> setBackgroundMode( QWidget::PaletteBackground ); + } + delete ol; + } + } + } + else if(ev->type() == QEvent::Paint){ + if(type == TransStippleBg || type == TransStippleBtn || + type == Custom){ +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); + + if (!p->inherits("QPopupMenu")) + p->erase(); } @@ -798,2 +839,6 @@ void LiquidStyle::polish(QWidget *w) w->setBackgroundMode(QWidget::NoBackground); + else if(w-> testWFlags(Qt::WType_Popup)) { + printf("install popup: %s\n", w-> className ( )); + w->installEventFilter(menuHandler); + } @@ -803,2 +848,3 @@ void LiquidStyle::polish(QWidget *w) + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); @@ -888,2 +934,5 @@ void LiquidStyle::unPolish(QWidget *w) w->setBackgroundMode(QWidget::PaletteButton); + else if(w-> testWFlags(Qt::WType_Popup)) { + w->removeEventFilter(menuHandler); + } |