Nominate our 2022 Qt Champions!

Drag/Drop virtual item outside of application

  • Lets assume I have a widget that is displaying some virtual item e.g. an image that was generated in the program, or contents of a zip file, or list of files over a slow network share. That actual image/file on disk doesn't exist on this computer. When a user drags the item and drops it on e.g. desktop. How does that work?

    I'd also like to do some extra processing before actually dropping the file e.g.

    1. User starts dragging [It's treated as a file and CopyAction]
    2. User drops the item on Desktop
    3. At that point, I need to Prompt the User in my application about Export format etc.
    4. User can cancel or select a format.
    5. Create the file on desktop with selected format.

    Essentially, I want to delay processing virtual item until the user actually drops it somewhere. How do I handle that event in my application?

  • Lifetime Qt Champion


    There used to be the Delayed Encoding example that might give you some ideas but IIRC it was not working on all platforms.

  • @SGaist You saved me a lot of heartache! Can you recall which platforms it worked fine on? Probably windows and mac?

  • Lifetime Qt Champion

    From (very old) memory, it think the one having issues was OS X.

Log in to reply