mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Improve the way how an element is updated in the new element panel.
Now Qet only use the new embbeded collection (XmlElementCollection). No need to reload the old element panel for add a new element created by the new element panel Elements are always imported to the embbeded collection of a project git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4468 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -279,18 +279,18 @@ void DiagramView::dropEvent(QDropEvent *e) {
|
||||
Handle the drop of an element.
|
||||
@param e the QDropEvent describing the current drag'n drop
|
||||
*/
|
||||
void DiagramView::handleElementDrop(QDropEvent *e)
|
||||
void DiagramView::handleElementDrop(QDropEvent *event)
|
||||
{
|
||||
//fetch the element location from the drop event
|
||||
QString elmt_path = e -> mimeData() -> text();
|
||||
|
||||
ElementsLocation location(elmt_path);
|
||||
|
||||
// verifie qu'il existe un element correspondant a cet emplacement
|
||||
ElementsCollectionItem *dropped_item = QETApp::collectionItem(location);
|
||||
if (!dropped_item) return;
|
||||
//Build an element from the text of the mime data
|
||||
ElementsLocation location(event->mimeData()->text());
|
||||
|
||||
diagram()->setEventInterface(new DiagramEventAddElement(location, diagram(), mapToScene(e->pos())));
|
||||
if ( !(location.isElement() && location.exist()) )
|
||||
{
|
||||
qDebug() << "DiagramView::handleElementDrop, location can't be use : " << location;
|
||||
return;
|
||||
}
|
||||
|
||||
diagram()->setEventInterface(new DiagramEventAddElement(location, diagram(), mapToScene(event->pos())));
|
||||
//Set focus to the view to get event
|
||||
this->setFocus();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user