| 687 | } |
| 688 | |
| 689 | bool UBGraphicsScene::inputDeviceRelease(int tool, Qt::KeyboardModifiers modifiers) |
| 690 | { |
| 691 | bool accepted = false; |
| 692 | |
| 693 | if (mPointer) |
| 694 | { |
| 695 | mPointer->hide(); |
| 696 | accepted = true; |
| 697 | } |
| 698 | |
| 699 | if (tool < 0) |
| 700 | { |
| 701 | tool = UBDrawingController::drawingController()->stylusTool(); |
| 702 | } |
| 703 | |
| 704 | UBStylusTool::Enum currentTool = (UBStylusTool::Enum)tool; |
| 705 | UBDrawingController *dc = UBDrawingController::drawingController(); |
| 706 | |
| 707 | if (dc->isDrawingTool(tool) || mDrawWithCompass) |
| 708 | { |
| 709 | if(mArcPolygonItem){ |
| 710 | |
| 711 | UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup(); |
| 712 | |
| 713 | // Add the arc |
| 714 | mAddedItems.remove(mArcPolygonItem); |
| 715 | removeItem(mArcPolygonItem); |
| 716 | UBCoreGraphicsScene::removeItemFromDeletion(mArcPolygonItem); |
| 717 | mArcPolygonItem->setStrokesGroup(pStrokes); |
| 718 | pStrokes->addToGroup(mArcPolygonItem); |
| 719 | |
| 720 | // Add the center cross |
| 721 | foreach(QGraphicsItem* item, mAddedItems){ |
| 722 | mAddedItems.remove(item); |
| 723 | removeItem(item); |
| 724 | UBCoreGraphicsScene::removeItemFromDeletion(item); |
| 725 | UBGraphicsPolygonItem* pi = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item); |
| 726 | if (pi) |
| 727 | pi->setStrokesGroup(pStrokes); |
| 728 | pStrokes->addToGroup(item); |
| 729 | } |
| 730 | |
| 731 | mAddedItems.clear(); |
| 732 | mAddedItems << pStrokes; |
| 733 | addItem(pStrokes); |
| 734 | |
| 735 | mDrawWithCompass = false; |
| 736 | } |
| 737 | else if (mCurrentStroke){ |
| 738 | if (mTempPolygon) { |
| 739 | UBGraphicsPolygonItem * poly = dynamic_cast<UBGraphicsPolygonItem*>(mTempPolygon->deepCopy()); |
| 740 | removeItem(mTempPolygon); |
| 741 | mTempPolygon = NULL; |
| 742 | addPolygonItemToCurrentStroke(poly); |
| 743 | } |
| 744 | |
| 745 | // replace the stroke by a simplified version of it |
| 746 | if ((currentTool == UBStylusTool::Pen && UBSettings::settings()->boardSimplifyPenStrokes->get().toBool()) |
no test coverage detected