Is there any way to be notified of the start of a drag operation?
-
I'm working on a macOS Qt plugin, and I need to know when the host application has started a drag operation. This could be a drag operating started manually using
QDrag::exec()
, but it could also be a drag triggered by any number of widgets, for exmaple dragging on an item inside of a QListView or QTableView.Is there any way to do that? I've tried putting an event filter on the shared QApplication instance and looking for useful events, but I don't see any there that correspond to the start of a drag operation initiated by the host app. There is a
QDragEnterEvent
, but that could apply to any drag operation, including those started by another application, and I don't think there's any way of discovering what actually triggered the drag.Maybe there's some way to do that using private Qt functions? I'd prefer for this plug-in to maintain backwards compatibility with older Qt versions, but if necessary I could have it be compiled for a specific Qt version.
Since this a macOS plug-in, I could also potentially swizzle some Objective-C methods, but I'd prefer to avoid that if possible!
-
I'm working on a macOS Qt plugin, and I need to know when the host application has started a drag operation. This could be a drag operating started manually using
QDrag::exec()
, but it could also be a drag triggered by any number of widgets, for exmaple dragging on an item inside of a QListView or QTableView.Is there any way to do that? I've tried putting an event filter on the shared QApplication instance and looking for useful events, but I don't see any there that correspond to the start of a drag operation initiated by the host app. There is a
QDragEnterEvent
, but that could apply to any drag operation, including those started by another application, and I don't think there's any way of discovering what actually triggered the drag.Maybe there's some way to do that using private Qt functions? I'd prefer for this plug-in to maintain backwards compatibility with older Qt versions, but if necessary I could have it be compiled for a specific Qt version.
Since this a macOS plug-in, I could also potentially swizzle some Objective-C methods, but I'd prefer to avoid that if possible!
@Guy-Gizmo said in Is there any way to be notified of the start of a drag operation?:
There is a QDragEnterEvent, but that could apply to any drag operation, including those started by another application, and I don't think there's any way of discovering what actually triggered the drag
It seems to me that QDropEvent::source() (QDragEvent is a subclass) can tell you if the event originated with this application or another (nullptr).
-
@Guy-Gizmo said in Is there any way to be notified of the start of a drag operation?:
There is a QDragEnterEvent, but that could apply to any drag operation, including those started by another application, and I don't think there's any way of discovering what actually triggered the drag
It seems to me that QDropEvent::source() (QDragEvent is a subclass) can tell you if the event originated with this application or another (nullptr).
-
G Guy Gizmo has marked this topic as solved on