updateEnabledDrawMode();
myClippingDlg = 0;
mySetRotationPointDlg = 0;
+ myRectBand = 0;
+}
+
+/*!
+ \brief Destructor.
+*/
+OCCViewer_ViewWindow::~OCCViewer_ViewWindow()
+{
+ endDrawRect();
}
/*!
if ( theEvent->button() == Qt::LeftButton && myDrawRect ) {
myDrawRect = false;
drawRect();
+ endDrawRect();
resetState();
myViewPort->update();
}
*/
void OCCViewer_ViewWindow::drawRect()
{
- QRubberBand* aRB = new QRubberBand( QRubberBand::Rectangle, myViewPort );
+ if ( !myRectBand )
+ myRectBand = new QRubberBand( QRubberBand::Rectangle, myViewPort );
+
QRect aRect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY);
if ( !myRect.isEmpty() ) {
- aRB->setGeometry( myRect );
- aRB->setVisible( myRect.isValid() );
+ myRectBand->setGeometry( myRect );
+ myRectBand->setVisible( myRect.isValid() );
}
- aRB->setGeometry( aRect );
- aRB->setVisible( aRect.isValid() );
+ myRectBand->setGeometry( aRect );
+ myRectBand->setVisible( aRect.isValid() );
myRect = aRect;
-
- delete aRB;
+}
+
+/*!
+ \brief Delete rubber band on the end on the dragging operation.
+*/
+void OCCViewer_ViewWindow::endDrawRect()
+{
+ delete myRectBand;
+ myRectBand = 0;
}
/*!
#include <QCursor>
+class QRubberBand;
+
class SUIT_Desktop;
class OCCViewer_ViewPort3d;
enum RotationPointType{ GRAVITY, SELECTED };
OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
- virtual ~OCCViewer_ViewWindow() {};
+ virtual ~OCCViewer_ViewWindow();
OCCViewer_ViewPort3d* getViewPort() { return myViewPort; }
void resetState();
void drawRect();
+ void endDrawRect();
void createActions();
void createToolBar();
OCCViewer_SetRotationPointDlg* mySetRotationPointDlg;
QtxAction* mySetRotationPointAction;
-
+
+ QRubberBand* myRectBand; //!< selection rectangle rubber band
};
#ifdef WIN32