From: mzn Date: Thu, 10 Jul 2008 09:39:52 +0000 (+0000) Subject: Fix for bug IPAL20073 (Qt4 porting: "SetBackground()" doesn't change color of the... X-Git-Tag: before_mergefrom_BR_Dev_For_4_0_07Jul08~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e471b0cbf1cd501862097f9d40d552ae7bbfceb6;p=modules%2Fvisu.git Fix for bug IPAL20073 (Qt4 porting: "SetBackground()" doesn't change color of the background). --- diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index 7e94ce88..8ecf13a4 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -785,12 +785,12 @@ namespace VISU { { struct TEvent: public SALOME_Event { - QWidget* myWidget; + SVTK_ViewWindow* myVW; SALOMEDS::Color myColor; public: - TEvent(QWidget* theWidget, + TEvent(SVTK_ViewWindow* theViewWindow, const SALOMEDS::Color& theColor): - myWidget(theWidget), + myVW(theViewWindow), myColor(theColor) {} virtual void Execute(){ @@ -798,14 +798,12 @@ namespace VISU { aColor[0] = int(255.0*myColor.R); aColor[1] = int(255.0*myColor.G); aColor[2] = int(255.0*myColor.B); - QPalette aPal( myWidget->palette() ); - aPal.setColor( myWidget->backgroundRole(), QColor(aColor[0],aColor[1],aColor[2]) ); - myWidget->setPalette( aPal ); - //myWidget->setBackgroundColor(QColor(aColor[0],aColor[1],aColor[2])); + QColor aNewColor (aColor[0],aColor[1],aColor[2]); + myVW->setBackgroundColor(aNewColor); } }; - - SUIT_ViewWindow* aVW = GetViewWindow(); + + SVTK_ViewWindow* aVW = dynamic_cast(GetViewWindow()); if (aVW) ProcessVoidEvent(new TEvent(aVW, theColor)); } @@ -813,22 +811,23 @@ namespace VISU { struct TBackgroundEvent: public SALOME_Event { - QWidget* myWidget; + SVTK_ViewWindow* myVW; typedef SALOMEDS::Color TResult; TResult myResult; - TBackgroundEvent(QWidget* theWidget): - myWidget(theWidget) + TBackgroundEvent(SVTK_ViewWindow* theViewWindow): + myVW(theViewWindow) {} virtual void Execute() { - const QColor& aColor = myWidget->palette().color( myWidget->backgroundRole() ); - myResult.R = aColor.red()/255.0; - myResult.G = aColor.green()/255.0; - myResult.B = aColor.blue()/255.0; + vtkFloatingPointType backint[3]; + GetRenderer(myVW)->GetBackground(backint); + myResult.R = backint[0]; + myResult.G = backint[1]; + myResult.B = backint[2]; } }; @@ -836,7 +835,7 @@ namespace VISU { View_i:: GetBackground() { - SUIT_ViewWindow* aVW = GetViewWindow(); + SVTK_ViewWindow* aVW = dynamic_cast(GetViewWindow()); if (aVW) return ProcessEvent(new TBackgroundEvent(aVW));