]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
*** empty log message ***
authorvsv <vsv@opencascade.com>
Tue, 5 Oct 2010 14:55:26 +0000 (14:55 +0000)
committervsv <vsv@opencascade.com>
Tue, 5 Oct 2010 14:55:26 +0000 (14:55 +0000)
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewFrame.h

index 28d368be12ff666d1f90595d0b0537907aeda6bb..3b45478cc14ca0158525cd8603e72bb26772361a 100644 (file)
@@ -10,7 +10,7 @@
 
 
 OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel)
-  : OCCViewer_ViewWindow( theDesktop, theModel )
+  : OCCViewer_ViewWindow( theDesktop, theModel ), myPopupRequestedView(0)
 {
   QFrame* centralFrame = new QFrame( this );
   setCentralWidget( centralFrame );
@@ -156,15 +156,24 @@ void OCCViewer_ViewFrame::connectViewSignals(OCCViewer_ViewWindow* theView)
   connect( theView, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ), 
            this, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ) );
 
+  // The signal is used to process get/set bacgrounf\d color from popup
+  connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
+           this, SLOT( onContextMenuRequested(QContextMenuEvent*) ) );
+
   connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
            this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
+
 }
 
 void OCCViewer_ViewFrame::setBackgroundColor( const QColor& theColor)
 {
-  foreach (OCCViewer_ViewWindow* aView, myViews) {
-    aView->setBackgroundColor(theColor); 
-  }
+  if (myPopupRequestedView)
+    myPopupRequestedView->setBackgroundColor(theColor); 
+  else
+    foreach (OCCViewer_ViewWindow* aView, myViews) {
+      if (aView->isVisible())
+        aView->setBackgroundColor(theColor); 
+    }
 }
 
 
@@ -181,3 +190,21 @@ void OCCViewer_ViewFrame::onFitAll()
     aView->onFitAll(); 
   }
 }
+  
+QColor OCCViewer_ViewFrame::backgroundColor() const 
+{ 
+  if (myPopupRequestedView)
+    return myPopupRequestedView->backgroundColor(); 
+
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    if (aView->isVisible())
+      return aView->backgroundColor(); 
+  }
+  return getView(MAIN_VIEW)->backgroundColor(); 
+}
+
+void OCCViewer_ViewFrame::onContextMenuRequested(QContextMenuEvent*)
+{
+  myPopupRequestedView = dynamic_cast<OCCViewer_ViewWindow*>(sender());
+}
+
index 4307479a01ae1e600ae1d7b34dba652fc5e59022..0bf841632332b04d0d5131e2c58ac0f55a6775c3 100644 (file)
@@ -71,9 +71,10 @@ public:
 
   virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
 
-  virtual QColor backgroundColor() const { return getView(MAIN_VIEW)->backgroundColor(); }
+  virtual QColor backgroundColor() const;
   virtual void    setBackgroundColor( const QColor& );
 
+
 public slots:
   virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
   virtual void onViewFitAll();
@@ -105,12 +106,17 @@ public slots:
 
   virtual void onDumpView() { getView(MAIN_VIEW)->onDumpView(); }
 
+private slots:
+  void onContextMenuRequested(QContextMenuEvent*);
+
 private:
   void connectViewSignals(OCCViewer_ViewWindow* theView);
 
 
   QList<OCCViewer_ViewWindow*> myViews;
   QGridLayout* myLayout;
+
+  OCCViewer_ViewWindow* myPopupRequestedView;
 };
 
 #endif