Results 1 to 1 of 1

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

  1. #1
    Join Date
    Mar 2010
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    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);
    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 20: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, 22:57
  2. QDesktopServices::openUrl - Problem
    By rmagro in forum Qt Programming
    Replies: 8
    Last Post: 2nd April 2009, 14:21
  3. Problem with QDesktopServices
    By innerhippy in forum Qt Programming
    Replies: 6
    Last Post: 18th November 2008, 20:14
  4. QDesktopServices problem
    By jyoti in forum Qt Programming
    Replies: 2
    Last Post: 21st December 2006, 13:59
  5. error: 'QDesktopServices' has not been declared
    By ucomesdag in forum Qt Programming
    Replies: 7
    Last Post: 24th November 2006, 15:36


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.