Skip to content

Commit

Permalink
Merge pull request #6163 from johnhaddon/dragDropFixes
Browse files Browse the repository at this point in the history
Small drag & drop fixes
  • Loading branch information
murraystevenson authored Nov 30, 2024
2 parents 4a8b9fe + 5d19325 commit f45b0f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
1.4.15.x (relative to 1.4.15.2)
========

Fixes
-----

- GraphEditor : Fixed errors when dragging an unknown file type into the GraphEditor.
- Widget : Fixed `event.sourceWidget` for DragDropEvents generated from a Qt native drag within the same Gaffer process. This will now reference the `GafferUI.Widget` that the Qt source widget belongs to, if any.

1.4.15.2 (relative to 1.4.15.1)
========
Expand Down
6 changes: 5 additions & 1 deletion python/GafferUI/Widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1578,9 +1578,13 @@ def __foreignDragEnter( self, qObject, qEvent ) :
Widget._modifiers( qEvent.keyboardModifiers() ),
)
dragDropEvent.data = data
dragDropEvent.sourceWidget = None
dragDropEvent.destinationWidget = None

if isinstance( qEvent.source(), QtWidgets.QWidget ) :
dragDropEvent.sourceWidget = GafferUI.Widget._owner( qEvent.source() )
else :
dragDropEvent.sourceWidget = None

if widget._dragEnterSignal( widget, dragDropEvent ) :
qEvent.acceptProposedAction()
self.__foreignDragDropEvent = dragDropEvent
Expand Down
3 changes: 2 additions & 1 deletion startup/gui/graphEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ def __dropLocationData( event ) :
if (
not isinstance( event.data, IECore.StringVectorData ) or
len( event.data ) != 1 or
not event.data[0].startswith( "/" )
not event.data[0].startswith( "/" ) or
event.sourceWidget is None
) :
return None

Expand Down

0 comments on commit f45b0f1

Please sign in to comment.