]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Exclude reparent event for ViewWindow V5-MDI-fix
authorvsv <vsv@opencascade.com>
Thu, 2 Apr 2009 10:45:06 +0000 (10:45 +0000)
committervsv <vsv@opencascade.com>
Thu, 2 Apr 2009 10:45:06 +0000 (10:45 +0000)
src/STD/STD_MDIDesktop.cxx
src/SUIT/SUIT_Desktop.cxx
src/SUIT/SUIT_Desktop.h
src/SUIT/SUIT_ViewManager.cxx
src/SUIT/SUIT_ViewWindow.cxx

index de0dcf8802f9728a9a94518d4c836398b0450bcf..52cd57421331af4d99e685c21c409fc185a578cc 100755 (executable)
@@ -31,6 +31,7 @@
 
 #include <QFrame>
 #include <QVBoxLayout>
+#include <QStatusBar>
 
 #include <stdarg.h>
 
@@ -102,10 +103,27 @@ QList<SUIT_ViewWindow*> STD_MDIDesktop::windows() const
 */
 void STD_MDIDesktop::addWindow( QWidget* w )
 {
-  if ( !w || !workspace() )
+  if ( !w || !myWorkspace )
     return;
 
-  workspace()->addWindow( w );
+  QWidget* aWnd = myWorkspace->addWindow( w );
+  //aWnd->setAutoFillBackground(false);
+  //setBackgroundRole(QPalette::NoRole);
+  QSize aSize = myWorkspace->size();
+
+  QWidget* aCurrWnd = myWorkspace->activeWindow();
+  int xPos = 0, yPos = 0;
+  if (aCurrWnd) {
+    const QRect& aCurrGeom = aCurrWnd->geometry();
+    int aShift = 20;
+    if (statusBar())
+      aShift = statusBar()->geometry().height();
+    int aXLow = aSize.width() * 1./3.;
+    int aYLow = aSize.height() * 1./3.;
+    xPos = (aCurrGeom.x() > aXLow)? 0 : aCurrGeom.x() + aShift;
+    yPos = (aCurrGeom.y() > aYLow)? 0 : aCurrGeom.y() + aShift;
+  } 
+  aWnd->setGeometry(xPos, yPos, aSize.width() * 2./3., aSize.height() * 2./3.);
 }
 
 /*!Call method perform for operation \a type.*/
index e7019f4677e70ae6d6d7e7e57333a6ab0fd27427..c661d1c2b9c2907c1f832773ba899de475aeb31d 100755 (executable)
@@ -102,15 +102,15 @@ void SUIT_Desktop::closeEvent( QCloseEvent* e )
 /*!
   Child event.
 */
-void SUIT_Desktop::childEvent( QChildEvent* e )
+/*void SUIT_Desktop::childEvent( QChildEvent* e )
 {
   if ( e->type() == QEvent::ChildAdded && e->child()->isWidgetType() )
     QApplication::postEvent( this, new ReparentEvent( QEvent::Type( Reparent ), e->child() ) );
   else
     QtxMainWindow::childEvent( e );
-}
+}*/
 
-void SUIT_Desktop::customEvent( QEvent* e )
+/*void SUIT_Desktop::customEvent( QEvent* e )
 {
   if ( (int)e->type() != Reparent )
     return;
@@ -125,7 +125,7 @@ void SUIT_Desktop::customEvent( QEvent* e )
     addWindow( wid );
     wid->setShown( !invis );
   }
-}
+}*/
 
 /*!
   Gets menu manager.
index ad49bd55e5462240f27173eb38f98ba86e813877..b119c6cb9b0ecc8e356835bd24fa2e49e3cfb0c7 100755 (executable)
@@ -71,6 +71,8 @@ public:
   void                     emitActivated();
   void                     emitMessage( const QString& );
 
+  virtual void             addWindow( QWidget* ) = 0;
+
 signals:
   void                     activated();
   void                     deactivated();
@@ -80,11 +82,10 @@ signals:
 
 protected:
   virtual bool             event( QEvent* );
-  virtual void             customEvent( QEvent* );
+  //virtual void             customEvent( QEvent* );
   virtual void             closeEvent( QCloseEvent* );
-  virtual void             childEvent( QChildEvent* );
+  //virtual void             childEvent( QChildEvent* );
 
-  virtual void             addWindow( QWidget* ) = 0;
 
 private:
   QtxActionMenuMgr*        myMenuMgr;
index c3ff10c41508c1d40f3e3eea98d1c2362680dd71..2950503582b929dc31d2ccf4af6796065fb006fe 100755 (executable)
@@ -153,7 +153,7 @@ SUIT_ViewWindow* SUIT_ViewManager::createViewWindow()
   setViewName( aView );
   aView->setWindowIcon( QIcon( myIcon ) );
 
-  //myDesktop->addViewWindow( aView );
+  myDesktop->addWindow( aView );
   //it is done automatically during creation of view
 
   aView->setViewManager( this );
@@ -162,6 +162,7 @@ SUIT_ViewWindow* SUIT_ViewManager::createViewWindow()
   // Special treatment for the case when <aView> is the first one in this view manager
   // -> call onWindowActivated() directly, because somebody may always want
   // to use getActiveView()
+  aView->show();
   if ( !myActiveView )
     onWindowActivated( aView );
 
index cb7045eee7d7dca2be79e4dcf253ee278c103002..9b6a628633a6b3e5ff0f47761eb527288bccf0b6 100755 (executable)
@@ -192,7 +192,7 @@ bool SUIT_ViewWindow::event( QEvent* e )
       SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );
 
     return true;
-  }
+  } 
   return QMainWindow::event( e );
 }