Results 1 to 1 of 1

Thread: QDesktopServices::storageLocation(QDesktopServices ::DataLocation);

  1. #1
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDesktopServices::storageLocation(QDesktopServices ::DataLocation);

    having problem using
    Qt Code:
    1. QString dataPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
    2. QString dataRoot = dataPath;
    3. dataPath += "\\TestProgram\\";
    4. QDir dataDir(dataPath);
    5.  
    6. if(!dataDir.exists())
    7. {
    8. QDir dataRootD(dataRoot);
    9. dataRootD.mkdir("TestProgram");
    10. }
    To copy to clipboard, switch view to plain text mode 

    this works just fine, but apparently it doesn't like writing a text file in here, if it doesn't exist already? isn't that the whole purpose of a datalocation?


    Added after 52 minutes:


    duh.... this works just fine, and writes just fine....

    didn't realize I was trying to Open/Read a non-existing file first... before a check to create the file if it doesn't exist....
    Last edited by budda; 16th November 2011 at 21:57.

Similar Threads

  1. how to open a pdf file using QDesktopServices
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 1
    Last Post: 25th October 2011, 23:57
  2. QDesktopServices::openUrl - Problem
    By rmagro in forum Qt Programming
    Replies: 8
    Last Post: 2nd April 2009, 15:21
  3. Problem with QDesktopServices
    By innerhippy in forum Qt Programming
    Replies: 6
    Last Post: 18th November 2008, 21:14
  4. QDesktopServices problem
    By jyoti in forum Qt Programming
    Replies: 2
    Last Post: 21st December 2006, 14:59
  5. error: 'QDesktopServices' has not been declared
    By ucomesdag in forum Qt Programming
    Replies: 7
    Last Post: 24th November 2006, 16:36

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.