BIM: Added delay to ifc viewprovider drag and drop - fixes #15259

This commit is contained in:
Yorik van Havre
2024-07-10 12:02:47 +02:00
committed by Yorik van Havre
parent af5a9dd53c
commit 14c232b96d

View File

@@ -315,12 +315,20 @@ class ifc_vp_object:
def dropObject(self, vobj, incoming_object):
"""Add an object to the view provider by d&d"""
from nativeifc import ifc_tools # lazy import
from PySide import QtCore # lazy import
self.incoming_object = incoming_object
# delay the action to prevent the object to be deleted
# before the end of the drop
QtCore.QTimer.singleShot(100, self.onDrop)
parent = vobj.Object
ifc_tools.aggregate(incoming_object, parent)
if self.hasChildren(parent):
self.expandChildren(parent)
def onDrop(self):
"""Delayed action to be taken when dropping an object"""
from nativeifc import ifc_tools # lazy import
ifc_tools.aggregate(self.incoming_object, self.Object)
if self.hasChildren(self.Object):
self.expandChildren(self.Object)
del self.incoming_object
def activate(self):
"""Marks this container as active"""