Results 1 to 3 of 3

Thread: How copy a file to a directory with 2 QTreeViews using drag and drop

  1. #1
    Join Date
    Jul 2010
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Maemo/MeeGo

    Default How copy a file to a directory with 2 QTreeViews using drag and drop

    Hello, just wondering if anyone could answer a quick question regarding drag and drop between 2 QTreeViews, i have created an application that allows me to display a linux file system starting at / in both QTreeView widgets side by side and ive implemented the drag and drop so far from one QTreeView to other QTreeView and i have the filename being displayed with QDebug to the console when files are dropped. The destination direcory model is going to be the directory a usb stick would be mounted under, so when i drag files from the filesystem tree on the left to the usb directory on the right i need the files to actually by copied to that location. So now that im seeing the file names from the QDebug on the console do i need to use somthin like QFile or does the QTreeView actually have ability to copy or move my source file to the destination?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How copy a file to a directory with 2 QTreeViews using drag and drop

    Quote Originally Posted by newbie43 View Post
    do i need to use somthin like QFile or does the QTreeView actually have ability to copy or move my source file to the destination?
    You have to use QFile::copy() or QProcess to call a "nativ" copy command. QTreView is only for representating a model and for nothing else.

  3. #3
    Join Date
    Jul 2010
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Maemo/MeeGo

    Default Re: How copy a file to a directory with 2 QTreeViews using drag and drop

    Thanks Lykurg

Similar Threads

  1. Replies: 0
    Last Post: 4th May 2010, 11:24
  2. Drag and Drop QTableWidget in UI file.
    By tpf80 in forum Qt Programming
    Replies: 3
    Last Post: 21st January 2009, 00:02
  3. Drag & Drop: delayed file delivery (Win & Mac)
    By Conel in forum Qt Programming
    Replies: 3
    Last Post: 19th September 2007, 17:01
  4. Drag-n-Drop with cut and not copy
    By KjellKod in forum Qt Programming
    Replies: 14
    Last Post: 18th February 2007, 12:57
  5. Replies: 4
    Last Post: 24th February 2006, 11:30

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.