From c4a25a670c74fc9e735bed2da9c943d2f233bc59 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 19 Dec 2005 09:15:06 +0000 Subject: [PATCH] Fix for bug 10456: An exception is raised after application closing. --- src/OCCViewer/OCCViewer_ViewWindow.cxx | 22 +++++++++------------- src/Plot2d/Plot2d_ViewFrame.cxx | 20 +++++++++++--------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index ed907ed61..13445103a 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -154,19 +154,6 @@ const char* imageCrossCursor[] = { "................................", "................................", "................................"}; - - -QPixmap zoomPixmap(imageZoomCursor); -QPixmap rotatePixmap(imageRotateCursor); -QPixmap globalPanPixmap(imageCrossCursor); - -QCursor defCursor(Qt::ArrowCursor); -QCursor handCursor(Qt::PointingHandCursor); -QCursor panCursor(Qt::SizeAllCursor); -QCursor zoomCursor(zoomPixmap); -QCursor rotCursor(rotatePixmap); -QCursor glPanCursor(globalPanPixmap); - ////////////////////////////////////////////////////////////////////// @@ -331,6 +318,8 @@ void OCCViewer_ViewWindow::activateZoom() myCursor = cursor(); /* save old cursor */ if ( myOperation != ZOOMVIEW ) { + QPixmap zoomPixmap (imageZoomCursor); + QCursor zoomCursor (zoomPixmap); setTransformRequested ( ZOOMVIEW ); setCursor( zoomCursor ); } @@ -347,6 +336,7 @@ void OCCViewer_ViewWindow::activatePanning() myCursor = cursor(); // save old cursor if ( myOperation != PANVIEW ) { + QCursor panCursor (Qt::SizeAllCursor); setTransformRequested ( PANVIEW ); setCursor( panCursor ); } @@ -362,6 +352,8 @@ void OCCViewer_ViewWindow::activateRotation() myCursor = cursor(); // save old cursor if ( myOperation != ROTATE ) { + QPixmap rotatePixmap (imageRotateCursor); + QCursor rotCursor (rotatePixmap); setTransformRequested ( ROTATE ); setCursor( rotCursor ); } @@ -372,6 +364,8 @@ void OCCViewer_ViewWindow::activateGlobalPanning() { Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { + QPixmap globalPanPixmap (imageCrossCursor); + QCursor glPanCursor (globalPanPixmap); myCurScale = aView3d->Scale(); aView3d->FitAll(0.01, false); myCursor = cursor(); // save old cursor @@ -391,6 +385,7 @@ void OCCViewer_ViewWindow::activateWindowFit() myCursor = cursor(); /* save old cursor */ if ( myOperation != WINDOWFIT ) { + QCursor handCursor (Qt::PointingHandCursor); setTransformRequested ( WINDOWFIT ); setCursor ( handCursor ); myCursorIsHand = true; @@ -447,6 +442,7 @@ void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent) if ( myDrawRect ) { drawRect(); if ( !myCursorIsHand ) { // we are going to sketch a rectangle + QCursor handCursor (Qt::PointingHandCursor); myCursorIsHand = true; myCursor = cursor(); setCursor( handCursor ); diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 3e800e09b..014184776 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -127,13 +127,6 @@ const char* imageCrossCursor[] = { "................................"}; -QPixmap zoomPixmap(imageZoomCursor); -QPixmap globalPanPixmap(imageCrossCursor); - -QCursor panCursor(Qt::SizeAllCursor); -QCursor zoomCursor(zoomPixmap); -QCursor glPanCursor(globalPanPixmap); - //================================================================================= // Plot2d_ViewFrame implementation //================================================================================= @@ -894,8 +887,12 @@ int Plot2d_ViewFrame::testOperation( const QMouseEvent& me ) switch (btn) { case zoomBtn: - myPlot->canvas()->setCursor( zoomCursor ); - return ZoomId; + { + QPixmap zoomPixmap (imageZoomCursor); + QCursor zoomCursor (zoomPixmap); + myPlot->canvas()->setCursor( zoomCursor ); + return ZoomId; + } case panBtn: myPlot->canvas()->setCursor( QCursor( Qt::SizeAllCursor ) ); return PanId; @@ -1503,6 +1500,7 @@ void Plot2d_ViewFrame::wheelEvent(QWheelEvent* event) */ void Plot2d_ViewFrame::onViewPan() { + QCursor panCursor (Qt::SizeAllCursor); myPlot->canvas()->setCursor( panCursor ); myOperation = PanId; qApp->installEventFilter( this ); @@ -1512,6 +1510,8 @@ void Plot2d_ViewFrame::onViewPan() */ void Plot2d_ViewFrame::onViewZoom() { + QPixmap zoomPixmap (imageZoomCursor); + QCursor zoomCursor (zoomPixmap); myPlot->canvas()->setCursor( zoomCursor ); myOperation = ZoomId; qApp->installEventFilter( this ); @@ -1537,6 +1537,8 @@ void Plot2d_ViewFrame::onViewFitArea() */ void Plot2d_ViewFrame::onViewGlobalPan() { + QPixmap globalPanPixmap (imageCrossCursor); + QCursor glPanCursor (globalPanPixmap); myPlot->canvas()->setCursor( glPanCursor ); myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, false ); myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, false ); -- 2.39.2