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

List:       kde-commits
Subject:    kdebase/kicker/buttons
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2004-11-01 20:43:56
Message-ID: 20041101204356.55D8016C7C () office ! kde ! org
[Download RAW message or body]

CVS commit by aseigo: 

the great grandparent of the button is not always a container area! this
makes kicker work once again on my work box. no idea why it works at home
or on wicky's machine or on anyone else but not this one ;-) in any case
the fix was trivial once i figured it out.


  M +18 -7     panelbuttonbase.cpp   1.54


--- kdebase/kicker/buttons/panelbuttonbase.cpp  #1.53:1.54
@@ -251,5 +251,7 @@ void PanelButtonBase::setArrowDirection(
 void PanelButtonBase::setBackground()
 {
-    if( !parent() ) { //parent() is null for ZoomButtons
+    if (!parent())
+    {
+        //parent() is null for ZoomButtons
         _bg = QPixmap();
         return;
@@ -257,6 +259,13 @@ void PanelButtonBase::setBackground()
 
     // inheritance is ButtonContainer - ScrollView - ContainerArea
-    ContainerArea* area = static_cast<ContainerArea*>(parent()->parent()->parent());
-    if (!area->transparent())
+    ContainerArea* area = 0;
+    QObject* ancestor = parent();
+    while (ancestor && !area)
+    {
+        area = dynamic_cast<ContainerArea*>(ancestor);
+        ancestor = ancestor->parent();
+    }
+
+    if (area && !area->transparent())
     {
         _bg = QPixmap();
@@ -263,11 +272,13 @@ void PanelButtonBase::setBackground()
         return;
     }
+
     // Get the pixmap from the container area object
-    const QPixmap* containerBG = area->completeBackgroundPixmap();
+    const QPixmap* containerBG = area ? area->completeBackgroundPixmap() : 0;
 
     // Make sure the background pixmap exists
-    if ( containerBG )
+    if (containerBG)
+    {
+        if(containerBG->isNull())
     {
-        if( containerBG->isNull() ) {
             _bg = QPixmap();
             return;


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

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