Results 1 to 12 of 12

Thread: Dragging files from QListWidget to another app (file browser)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Dragging files from QListWidget to another app (file browser)

    Quote Originally Posted by madcat
    You say I have a way to get informed of the place where the file was dropped (ie. explorer/nautilus/konqueror/... will inform me of the folder ?).
    No, unfortunately I don't I don't have the slightest idea how to retrieve the "path". It all depends on what object you actually perform the drop. It doesn't have to be a "path" at all.

    The other app (the file browser) shouldn't be informed when the download is finished, the application will tell the user it is.
    It should, because it has to react on the drop. It should work in such a way, that you transfer the contents of the file to that "other" application and it saves the file (or whatever it is) to the appropriate place. That's how in general drag&drop works.

  2. #2
    Join Date
    Apr 2006
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Re: Dragging files from QListWidget to another app (file browser)

    If it is more clear for you : imagine an ftp client where the user could drag the files from the client to the Finder/Explorer/Konqueror/Nautilus/other... The idea is to get the place where the file was dropped, and to download the file to this place. I don't want to drop file on my app, this function is already working. Thanks for your answers though

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Dragging files from QListWidget to another app (file browser)

    Quote Originally Posted by madcat
    If it is more clear for you : imagine an ftp client where the user could drag the files from the client to the Finder/Explorer/Konqueror/Nautilus/other... The idea is to get the place where the file was dropped, and to download the file to this place. I don't want to drop file on my app, this function is already working. Thanks for your answers though
    You miss one point. What happens if you drop a remote file on, for example, a text editor? According to me the file should get downloaded to some temporary file and opened in the editor. So in this case there is no "path" to download the file to. The object of the drag is the file contents itself. It is the editor which handles the drop and the ftp client which provides the contents of the file. Doing otherwise neglects the design of drag and drop. If you insist on such a behaviour, then you should do it the other way round -- drag the directory icon to your ftp client and drop it there, this way the pattern will be preserved (the target application processes the drag object (the directory) according to its own needs), you'll get the destination, etc. Of course it would be a little illogical this way... The best way is to download the file and then let the target application (the desktop manager or file manager in this case) handle the rest, bear in mind there can be no path to the target ("there is no spoon"), for example for virtual file systems.

  4. #4
    Join Date
    Apr 2006
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Re: Dragging files from QListWidget to another app (file browser)

    Hi,
    I agree with you, but then we return to the first problem : you say I should download the file, the drag and drop will take maybe two seconds while the download can take hours... So let's say on a drag event I create a temporary file, and start to download the contents to it. When the users drop the file on the text editor or whatever it is, it will read what have been downloaded, which could be only a part of the final file.
    Also, I don't know any qt operation that has this feature... If you have any idea, I could look at the source and try to figure out the way it's done

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Dragging files from QListWidget to another app (file browser)

    Quote Originally Posted by madcat
    Hi,
    I agree with you, but then we return to the first problem : you say I should download the file, the drag and drop will take maybe two seconds while the download can take hours... So let's say on a drag event I create a temporary file, and start to download the contents to it. When the users drop the file on the text editor or whatever it is, it will read what have been downloaded, which could be only a part of the final file.
    No, because the actual drop would have to take place only when the file is already downloaded.

    Also, I don't know any qt operation that has this feature... If you have any idea, I could look at the source and try to figure out the way it's done
    KDE, its desktop manager, file manager (konqueror) and applications like kate, ark, ones that use kio_slaves to provide virtual file systems.

  6. #6
    Join Date
    Apr 2006
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Re: Dragging files from QListWidget to another app (file browser)

    Quote Originally Posted by wysota
    No, because the actual drop would have to take place only when the file is already downloaded.
    But does that mean the user will have the icon sticked to his mouse until the file is downloaded ?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Dragging files from QListWidget to another app (file browser)

    No, it means that the drop would have to be processed by the application when the download is already finished and not sooner. We'd probably have to check the X11 DND specs to see how it's done (as Qt follows the specs and mimics it on other platforms).

Similar Threads

  1. Suggestions/Ideas about a file browser
    By SkripT in forum Qt Programming
    Replies: 31
    Last Post: 6th April 2011, 23:17
  2. Opening swf file in the default browser
    By munna in forum Qt Programming
    Replies: 16
    Last Post: 5th May 2006, 09:33
  3. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 10:28

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.