Salome HOME
INT PAL 53422: FitAll does't work in OCC viewer
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewPort3d.cxx
index b0ba526d440ae4db77d3cfc0cc9e2074180b359d..4a2cb3a222ceb4af644dd3845a939e90e2b21128 100755 (executable)
 #include <QPaintEvent>
 #include <QResizeEvent>
 #include <QApplication>
+#include <QTimer>
 
-#include <Visual3d_View.hxx>
-#include <V3d_Viewer.hxx>
+#if OCC_VERSION_MAJOR < 7
+  #include <Visual3d_View.hxx>
+#endif
 
 #if OCC_VERSION_LARGE > 0x06070100
 #include <V3d_View.hxx>
@@ -595,9 +597,14 @@ void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e )
 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QApplication::syncX();
 #endif
-    QRect rc = e->rect();
-    if ( !myPaintersRedrawing )
+    if ( !myPaintersRedrawing ) {
+#if OCC_VERSION_MAJOR < 7
+      QRect rc = e->rect();
       activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() );
+#else
+      activeView()->Redraw();
+#endif
+    }
   }
   OCCViewer_ViewPort::paintEvent( e );
   myBusy = false;
@@ -616,21 +623,19 @@ void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e )
 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QApplication::syncX();
 #endif
-  if ( !activeView().IsNull() )
-    activeView()->MustBeResized();
+  QTimer::singleShot( 0, this, SLOT( repaintViewAfterMove() ) );
 }
 
 /*!
   Moved the viewport
 */
-/*
 void OCCViewer_ViewPort3d::repaintViewAfterMove( )
 {
   if ( !activeView().IsNull() ){
     activeView()->MustBeResized();
   }
 }
-*/
+
 /*!
   Fits all objects in view. [ virtual protected ]
 */