| 1746 | } |
| 1747 | |
| 1748 | void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, const QPointF& pPos) |
| 1749 | { |
| 1750 | graphicsWidget->setFlag(QGraphicsItem::ItemIsSelectable, true); |
| 1751 | |
| 1752 | addItem(graphicsWidget); |
| 1753 | |
| 1754 | qreal ssf = 1 / UBApplication::boardController->systemScaleFactor(); |
| 1755 | |
| 1756 | graphicsWidget->setTransform(QTransform::fromScale(ssf, ssf), true); |
| 1757 | |
| 1758 | graphicsWidget->setPos(QPointF(pPos.x() - graphicsWidget->boundingRect().width() / 2, |
| 1759 | pPos.y() - graphicsWidget->boundingRect().height() / 2)); |
| 1760 | |
| 1761 | if (graphicsWidget->canBeContent()) |
| 1762 | { |
| 1763 | graphicsWidget->loadMainHtml(); |
| 1764 | |
| 1765 | graphicsWidget->setSelected(true); |
| 1766 | if (mUndoRedoStackEnabled) { //should be deleted after scene own undo stack implemented |
| 1767 | UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(shared_from_this(), 0, graphicsWidget); |
| 1768 | UBApplication::undoStack->push(uc); |
| 1769 | } |
| 1770 | |
| 1771 | setDocumentUpdated(); |
| 1772 | } |
| 1773 | else |
| 1774 | { |
| 1775 | UBApplication::boardController->moveGraphicsWidgetToControlView(graphicsWidget); |
| 1776 | } |
| 1777 | |
| 1778 | UBApplication::boardController->controlView()->setFocus(); |
| 1779 | } |
| 1780 | |
| 1781 | |
| 1782 | UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QList<QGraphicsItem *> items) |
no test coverage detected