Results 1 to 2 of 2

Thread: Android - Open file with QFile

  1. #1
    Join Date
    Nov 2014
    Posts
    33
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Android - Open file with QFile

    After recording a video with the Camera on an Android device, the actualLocation is file:///storage/emulated/0/DCIM/VID_00000012.3gp

    How can I open it?

    Qt Code:
    1. QFile videoLocation;
    2. videoLocation.setFileName(actualLocation);
    3. if (videoLocation.open(QIODevice::ReadOnly)) {
    4. ...
    5. }
    6. else {
    7. qDebug() << videoLocation.errorString();
    8. }
    To copy to clipboard, switch view to plain text mode 

    The open method fails an the errorString prints No such file or directory

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,325
    Thanks
    36
    Thanked 1,527 Times in 1,478 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Android - Open file with QFile

    actualLocation is a file URI, not a file name, QFile works on file names.
    QUrl::toLocalFile().

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 20th July 2013, 18:16
  2. Replies: 4
    Last Post: 9th May 2011, 09:52
  3. QFile open file on a shared drive
    By gaddlord in forum Qt Programming
    Replies: 0
    Last Post: 24th August 2010, 23:19
  4. QFile open question
    By chenxuelian in forum Qt Programming
    Replies: 9
    Last Post: 2nd April 2010, 10:00
  5. QFile::writeBlock: File not open
    By safknw in forum Qt Tools
    Replies: 1
    Last Post: 16th September 2006, 13:21

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.