#endif
setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background
+
+ myCursor = NULL;
}
/*!
*/
OCCViewer_ViewPort3d::~OCCViewer_ViewPort3d()
{
+ if ( myCursor )
+ {
+ delete myCursor;
+ myCursor = NULL;
+ }
+
emit vpClosed(this);
Handle(V3d_View) aView = activeView();
if (!aView.IsNull())
}
aView->Update();
}
+
+/*
+ * Create default cursor with a specific shape
+ */
+void OCCViewer_ViewPort3d::setDefaultCursor( Qt::CursorShape theCursorShape )
+{
+ if ( !myCursor )
+ myCursor = new QCursor();
+
+ myCursor->setShape( theCursorShape );
+}
+
+/*
+ * Get default cursor with a specific shape
+ */
+QCursor* OCCViewer_ViewPort3d::getDefaultCursor() const
+{
+ return myCursor;
+}
myPreselectionEnabled = true;
mySelectionEnabled = true;
+ myCursorIsHand = false;
clearViewAspects();
void OCCViewer_ViewWindow::activateZoom()
{
if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
+ saveCursor(); /* save old cursor */
if ( myOperation != ZOOMVIEW ) {
QPixmap zoomPixmap (imageZoomCursor);
void OCCViewer_ViewWindow::activatePanning()
{
if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); // save old cursor
+ saveCursor(); // save old cursor
if ( myOperation != PANVIEW ) {
QCursor panCursor (Qt::SizeAllCursor);
void OCCViewer_ViewWindow::activateRotation()
{
if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); // save old cursor
+ saveCursor(); // save old cursor
if ( myOperation != ROTATE ) {
QPixmap rotatePixmap (imageRotateCursor);
{
QCursor handCursor (Qt::PointingHandCursor);
myCursorIsHand = true;
- myCursor = cursor();
+ saveCursor();
myViewPort->setCursor( handCursor );
}
myRotationPointSelection = true;
QCursor glPanCursor (globalPanPixmap);
myCurScale = aView3d->Scale();
aView3d->FitAll(0.01, false);
- myCursor = cursor(); // save old cursor
+ saveCursor(); // save old cursor
myViewPort->fitAll(); // fits view before selecting a new scene center
if( setTransformRequested( PANGLOBAL ) )
myViewPort->setCursor( glPanCursor );
void OCCViewer_ViewWindow::activateWindowFit()
{
if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
+ saveCursor(); /* save old cursor */
if ( myOperation != WINDOWFIT ) {
QCursor handCursor (Qt::PointingHandCursor);
if ( !myCursorIsHand ) { // we are going to sketch a rectangle
QCursor handCursor (Qt::PointingHandCursor);
myCursorIsHand = true;
- myCursor = cursor();
+ saveCursor();
myViewPort->setCursor( handCursor );
}
}
}
+/*!
+ Save old cursor. [ protected ]
+*/
+void OCCViewer_ViewWindow::saveCursor()
+{
+ QCursor* aCursor = NULL;
+ if ( myViewPort )
+ aCursor = myViewPort->getDefaultCursor();
+ myCursor = ( aCursor ? *aCursor : cursor() );
+}
+
+
/*!
Creates default sketcher. [ virtual protected ]
*/