Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is there any way to be notified of the start of a drag operation?
Forum Updated to NodeBB v4.3 + New Features

Is there any way to be notified of the start of a drag operation?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 281 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Guy GizmoG Offline
    Guy GizmoG Offline
    Guy Gizmo
    wrote on last edited by
    #1

    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!

    C 1 Reply Last reply
    0
    • Guy GizmoG Guy Gizmo

      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!

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @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 GizmoG 1 Reply Last reply
      3
      • C ChrisW67

        @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 GizmoG Offline
        Guy GizmoG Offline
        Guy Gizmo
        wrote on last edited by
        #3

        @ChrisW67
        Not sure how I missed that one, but that's precisely what I needed. Thanks!

        1 Reply Last reply
        0
        • Guy GizmoG Guy Gizmo has marked this topic as solved on

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved