mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Diagram command add QGraphicsItem and derived :
Remove each comand for each type and replace it by generic class by using template class (addItemComand). git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3368 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -313,7 +313,7 @@ void DiagramView::handleTitleBlockDrop(QDropEvent *e) {
|
||||
*/
|
||||
void DiagramView::handleTextDrop(QDropEvent *e) {
|
||||
if (scene -> isReadOnly() || (e -> mimeData() -> hasText() == false) ) return;
|
||||
scene -> undoStack().push(new AddTextCommand(scene, new IndependentTextItem (e -> mimeData() -> text()), mapToScene(e->pos())));
|
||||
scene -> undoStack().push(new AddItemCommand<IndependentTextItem *>(new IndependentTextItem (e -> mimeData() -> text()), scene, mapToScene(e->pos())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -844,8 +844,8 @@ bool DiagramView::addElementAtPos(const ElementsLocation &location, const QPoint
|
||||
return(false);
|
||||
}
|
||||
|
||||
// pose de l'element sur le schema
|
||||
diagram() -> undoStack().push(new AddElementCommand(diagram(), el, mapToScene(pos)));
|
||||
//Add element to diagram
|
||||
diagram() -> undoStack().push (new AddItemCommand<Element *>(el, diagram(), mapToScene(pos)));
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user