setBackgroundRole( QPalette::NoRole );//NoBackground );
// set focus policy to threat QContextMenuEvent from keyboard
setFocusPolicy( Qt::StrongFocus );
- setAttribute( Qt::WA_PaintOnScreen );
- setAttribute( Qt::WA_NoSystemBackground );
}
/*!
/*!
Repaints the viewport. [ virtual protected ]
*/
-void OCCViewer_ViewPort::paintEvent( QPaintEvent* )
+void OCCViewer_ViewPort::paintEvent( QPaintEvent* e)
{
if ( myPaintersRedrawing )
{
#include <QPaintEvent>
#include <QResizeEvent>
#include <QApplication>
+#include <QPainter>
#include <Visual3d_View.hxx>
#include <V3d_Viewer.hxx>
myScale( 1.0 ),
myDegenerated( true ),
myAnimate( false ),
-myBusy( true )
+myBusy( true ),
+mySizeChanged(false)
{
+ setAttribute( Qt::WA_PaintOnScreen );
+ setAttribute( Qt::WA_NoSystemBackground );
+ setAttribute( Qt::WA_OpaquePaintEvent );
+ setAutoFillBackground(false);
+
selectVisualId();
if ( type == V3d_ORTHOGRAPHIC ) {
{
if (myAnimate) activeView()->SetAnimationModeOff();
if ( !myDegenerated )
- activeView()->SetDegenerateModeOff();
+ activeView()->SetDegenerateModeOff();
activeView()->ZFitAll(1.);
activeView()->SetZSize(0.);
activeView()->Update();
}
}
+/*bool OCCViewer_ViewPort3d::event( QEvent* e)
+{
+ if (e->type() == QEvent::Paint) {
+ paintEvent((QPaintEvent*)e);
+ return true;
+ }
+ return QWidget::event(e);
+}*/
+
+
/*!
Repaints the viewport. [ virtual protected ]
*/
{
QApplication::syncX();
QRect rc = e->rect();
- if ( !myPaintersRedrawing )
+ if (mySizeChanged) {
+ activeView()->MustBeResized();
+ mySizeChanged = false;
+ }
+ if ( !myPaintersRedrawing )
activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() );
}
OCCViewer_ViewPort::paintEvent( e );
myBusy = false;
+ e->accept();
}
/*!
if ( !mapped( activeView() ) )
mapView( activeView() );
#endif
+ //bool aRes = testAttribute(Qt::WA_Resized);
QApplication::syncX();
- if ( !activeView().IsNull() )
- activeView()->MustBeResized();
+ mySizeChanged = true;
+ //if ( !activeView().IsNull() ) {
+ //activeView()->MustBeResized();
+ e->accept();
+ //}
+ //OCCViewer_ViewPort::resizeEvent(e);
}
/*!
void endRotation();
bool isBusy() {return myBusy;} // check that View Port is fully initialized
+
+ virtual QPaintEngine* paintEngine () const { return 0; }
+
protected:
// EVENTS
+ //virtual bool event( QEvent* );
+
virtual void paintEvent( QPaintEvent* );
virtual void resizeEvent( QResizeEvent* );
bool myAnimate;
bool myBusy;
double myScale;
+ bool mySizeChanged;
};
#ifdef WIN32
emit contextMenuRequested( aEvent );
}
return true;
-
default:
break;
}
return SUIT_ViewWindow::eventFilter(watched, e);
}
+/*void OCCViewer_ViewWindow::resizeEvent( QResizeEvent* e )
+{
+ bool aRes = testAttribute(Qt::WA_Resized);
+ resize(e->size());
+ SUIT_ViewWindow::resizeEvent(e);
+ e->accept();
+}*/
+
+
/*!
\brief Update state of enable draw mode state.
*/
void Hide( QHideEvent * );
protected:
+ //virtual void resizeEvent( QResizeEvent* );
+
virtual QImage dumpView();
virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
virtual QString filter() const;