Results 1 to 4 of 4

Thread: [solved]drag a picture to a different application

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    195
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 4 Times in 4 Posts

    Default [solved]drag a picture to a different application

    hi
    I want to drag a picture to a different application (f.e. gimp). It works fine with that code:
    Qt Code:
    1. QMimeData* mimedata = new QMimeData;
    2. mimedata->setImageData(QImage("/home/user/picture.jpeg"));
    3. QDrag *drag = new QDrag(this);
    4. drag->setMimeData(mimedata);
    5. QPixmap& pic = *picture;
    6. drag->setPixmap(pic);
    7. drag->exec(Qt::MoveAction);
    To copy to clipboard, switch view to plain text mode 
    But there is a problem. The picture is in the application, but it doesn't point to the picture on the file system. It's just a paste command. Does anybody know what I have to do?

    thanks
    Last edited by Qiieha; 20th June 2011 at 09:31.

Similar Threads

  1. Drag & Drop in MDI application
    By Koas in forum Qt Programming
    Replies: 2
    Last Post: 2nd September 2011, 08:25
  2. Qt move picture per drag and drop
    By Qiieha in forum Qt Programming
    Replies: 0
    Last Post: 14th June 2011, 11:02
  3. Replies: 2
    Last Post: 2nd December 2010, 10:06
  4. drag and drop from outside qt application
    By elflord in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2009, 15:40
  5. Drag and drop outside the application
    By jpn in forum Newbie
    Replies: 7
    Last Post: 27th August 2006, 15:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.