Results 1 to 3 of 3

Thread: QStandardPaths returning incorrent folder

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QStandardPaths returning incorrent folder

    Hello!

    I'm learning about the usage of the new Qt 5 class QStandardPaths by reading Qt Assistant, etc.. For curiosity, I decided to get the list of my computer's folders when I call QStandardPaths::standardLocations(StandartLocation ) to see what I got when, for my surprise, after asking for retrieving my downloads folder,

    Qt Code:
    1. qDebug() << QStandardPaths::standardLocations(QStandardPaths::DownloadLocation);
    To copy to clipboard, switch view to plain text mode 

    I received my documents folder ("C:/Users/Endrigo/Documents") instead of my actual downloads folder ("C:/Users/Endrigo/Downloads"). Isn't this a bug in this class? I called the functions multiple times and neither once the correct folder path was given (not forgetting that the result of standartLocations is a QStringList, so no problem if there were other options apart from it insofar "C:/Users/Endrigo/Downloads" was given).



    Thanks,

    Momergil

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QStandardPaths returning incorrent folder

    That will depend on what version of the ever moving target called Windows you are running. Before Vista no such location existed in the Windows special folders. Vista introduced a different function (SHGetKnownFolderPath(FOLDERID_Downloads)) reporting a different range of paths, including FOLDERID_Downloads. The Qt code uses the old method and returns the documents folder as a place you can download to that is available on Windows XP also.

    There is a outstanding bug in work and code that you might adapt to find the location in the meantime.
    https://bugreports.qt-project.org/browse/QTBUG-35194

  3. The following user says thank you to ChrisW67 for this useful post:

    Momergil (20th February 2014)

  4. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QStandardPaths returning incorrent folder

    Quote Originally Posted by ChrisW67 View Post
    There is a outstanding bug in work and code that you might adapt to find the location in the meantime.
    Thanks for the answer, Chris. Thankfully I'm not actually in need for a correct implementation of that method, so I'll wait for further Qt releases.


    Momergil

Similar Threads

  1. QStandardPaths and Windows' C:\ProgramData
    By zethon in forum Qt Programming
    Replies: 2
    Last Post: 21st December 2013, 20:05
  2. Replies: 0
    Last Post: 13th October 2010, 04:27
  3. Replies: 1
    Last Post: 19th January 2010, 21:35
  4. Returning const &
    By frenk_castle in forum Newbie
    Replies: 2
    Last Post: 24th November 2009, 07:01
  5. returning a string
    By mickey in forum General Programming
    Replies: 2
    Last Post: 3rd February 2008, 19:41

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.