[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/runtime/kstyles/oxygen
From:       Hugo Pereira Da Costa <hugo.pereira () free ! fr>
Date:       2010-02-03 21:32:59
Message-ID: 1265232779.545144.17019.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1084867 by hpereiradacosta:

moved QMenu background painting to drawPrimitive( PE_PanelMenu, ...) and removed the \
corresponding event filter. This is more straigtforward and consistent with what is \
intended in QStyle.

 M  +39 -72    oxygen.cpp  


--- trunk/KDE/kdebase/runtime/kstyles/oxygen/oxygen.cpp #1084866:1084867
@@ -407,6 +407,41 @@
     switch (element)
     {
 
+        case PE_PanelMenu:
+        {
+
+            const QStyleOptionMenuItem* mOpt( qstyleoption_cast<const \
QStyleOptionMenuItem*>(option) ); +            if( !mOpt ) return;
+            QRect r = mOpt->rect;
+            QColor color = mOpt->palette.window().color();
+
+            if( compositingActive() )
+            {
+                TileSet *tileSet( _helper.roundCorner(color) );
+                tileSet->render( r, p );
+
+                // set clip region
+                p->setClipRegion( _helper.roundedRegion( r.adjusted( 1, 1, -1, -1 ) \
), Qt::IntersectClip ); +
+            }
+
+            // background
+            int splitY = qMin(200, 3*r.height()/4);
+
+            QRect upperRect = QRect(0, 0, r.width(), splitY);
+            QPixmap tile = _helper.verticalGradient(color, splitY);
+            p->drawTiledPixmap(upperRect, tile);
+
+            QRect lowerRect = QRect(0,splitY, r.width(), r.height() - splitY);
+            p->fillRect(lowerRect, _helper.backgroundBottomColor(color));
+
+            // frame
+            if( compositingActive() ) p->setClipping( false );
+            _helper.drawFloatFrame( p, r, color );
+            return;
+
+        }
+
         // disable painting of PE_PanelScrollAreaCorner
         // the default implementation fills the rect with the window background \
color  // which does not work for windows that have gradients.
@@ -3656,11 +3691,11 @@
 
     } else if (qobject_cast<QMenu*>(widget) ) {
 
-        widget->installEventFilter(this);
         widget->setAttribute(Qt::WA_TranslucentBackground);
-#ifdef Q_WS_WIN
-        widget->setWindowFlags(widget->windowFlags() | Qt::FramelessWindowHint); \
//FramelessWindowHint is needed on windows to make WA_TranslucentBackground work \
                properly
-#endif
+        #ifdef Q_WS_WIN
+        //FramelessWindowHint is needed on windows to make WA_TranslucentBackground \
work properly +        widget->setWindowFlags(widget->windowFlags() | \
Qt::FramelessWindowHint); +        #endif
 
     } else if (widget->inherits("QComboBoxPrivateContainer")) {
 
@@ -3751,7 +3786,6 @@
 
         widget->setAttribute(Qt::WA_PaintOnScreen, false);
         widget->setAttribute(Qt::WA_NoSystemBackground, false);
-        widget->removeEventFilter(this);
         widget->clearMask();
 
     } else if (widget->inherits("QComboBoxPrivateContainer")) \
widget->removeEventFilter(this); @@ -6057,73 +6091,6 @@
         }
     }
 
-    // QMenu
-    if (QMenu *m = qobject_cast<QMenu*>(obj))
-    {
-        switch(ev->type()) {
-            case QEvent::Show:
-            case QEvent::Resize:
-            {
-
-                // make sure mask is appropriate
-                if( compositingActive() )
-                {
-                    if( m->mask() != QRegion() )
-                    { m->clearMask(); }
-
-                } else if( m->mask() == QRegion() ) {
-
-                    m->setMask( _helper.roundedMask( m->rect() ) );
-
-                }
-
-                return false;
-
-            }
-
-            case QEvent::Paint:
-            {
-
-                QPainter p(m);
-                QPaintEvent *e = (QPaintEvent*)ev;
-                p.setClipRegion(e->region());
-
-                QRect r = m->rect();
-                QColor color = m->palette().window().color();
-
-                if( compositingActive() )
-                {
-                    TileSet *tileSet( _helper.roundCorner(color) );
-                    tileSet->render( r, &p );
-
-                    // set clip region
-                    p.setClipRegion( _helper.roundedRegion( r.adjusted( 1, 1, -1, -1 \
                ) ), Qt::IntersectClip );
-
-                }
-
-                // background
-                int splitY = qMin(200, 3*r.height()/4);
-
-                QRect upperRect = QRect(0, 0, r.width(), splitY);
-                QPixmap tile = _helper.verticalGradient(color, splitY);
-                p.drawTiledPixmap(upperRect, tile);
-
-                QRect lowerRect = QRect(0,splitY, r.width(), r.height() - splitY);
-                p.fillRect(lowerRect, _helper.backgroundBottomColor(color));
-
-                // frame
-                if( compositingActive() ) p.setClipping( false );
-                _helper.drawFloatFrame( &p, r, color );
-
-                return false;
-            }
-
-            default: return false;
-
-        }
-
-    }
-
     // combobox container
     QWidget *widget = static_cast<QWidget*>(obj);
     if (widget->inherits("QComboBoxPrivateContainer"))


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic