]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for bug IPAL20073 (Qt4 porting: "SetBackground()" doesn't change color of the...
authormzn <mzn@opencascade.com>
Thu, 10 Jul 2008 09:39:52 +0000 (09:39 +0000)
committermzn <mzn@opencascade.com>
Thu, 10 Jul 2008 09:39:52 +0000 (09:39 +0000)
src/VISU_I/VISU_View_i.cc

index 7e94ce880024907e2f4050e7f968825ee1bae2c2..8ecf13a4022ed6e4e11b4986342f46cb85c69dee 100644 (file)
@@ -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<SVTK_ViewWindow*>(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<SVTK_ViewWindow*>(GetViewWindow());
     if (aVW)
       return ProcessEvent(new TBackgroundEvent(aVW));