-
-
-void RS_ActionModifyTrim::mouseReleaseEvent(QMouseEvent* e) {
- if (RS2::qtToRsButtonState(e->button())==RS2::LeftButton) {
-
- Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity* se = catchEntity(e);
-
- switch (getStatus()) {
- case ChooseLimitEntity:
- limitCoord = mouse;
- limitEntity = se;
- if (limitEntity!=NULL /*&& limitEntity->isAtomic()*/) {
- limitEntity->setHighlighted(true);
- graphicView->drawEntity(limitEntity);
- setStatus(ChooseTrimEntity);
- }
- break;
-
- case ChooseTrimEntity:
- trimCoord = mouse;
- trimEntity = se;
- if (trimEntity!=NULL && trimEntity->isAtomic()) {
- trigger();
- }
- break;
-
- default:
- break;
- }
- } else if (RS2::qtToRsButtonState(e->button())==RS2::RightButton) {
- deletePreview();
- deleteSnapper();
- if (limitEntity!=NULL) {
- limitEntity->setHighlighted(false);
- graphicView->drawEntity(limitEntity);
- }
- init(getStatus()-1);
- }
+void RS_ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e)
+{
+ if (e->button() == Qt::LeftButton)
+ {
+ Vector mouse = graphicView->toGraph(e->x(), e->y());
+ RS_Entity * se = catchEntity(e);
+
+ switch (getStatus())
+ {
+ case ChooseLimitEntity:
+ limitCoord = mouse;
+ limitEntity = se;
+
+ if (limitEntity != NULL /*&& limitEntity->isAtomic()*/)
+ {
+ limitEntity->setHighlighted(true);
+ graphicView->drawEntity(limitEntity);
+ setStatus(ChooseTrimEntity);
+ }
+ break;
+
+ case ChooseTrimEntity:
+ trimCoord = mouse;
+ trimEntity = se;
+
+ if (trimEntity != NULL && trimEntity->isAtomic())
+ trigger();
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if (e->button() == Qt::RightButton)
+ {
+ deletePreview();
+ deleteSnapper();
+
+ if (limitEntity != NULL)
+ {
+ limitEntity->setHighlighted(false);
+ graphicView->drawEntity(limitEntity);
+ }
+ init(getStatus() - 1);
+ }