From kde-commits Mon Nov 01 20:43:56 2004 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Mon, 01 Nov 2004 20:43:56 +0000 To: kde-commits Subject: kdebase/kicker/buttons Message-Id: <20041101204356.55D8016C7C () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=109934185320689 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(parent()->parent()->parent()); - if (!area->transparent()) + ContainerArea* area = 0; + QObject* ancestor = parent(); + while (ancestor && !area) + { + area = dynamic_cast(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;