Results 1 to 6 of 6

Thread: change path of settings ini file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    248
    Thanks
    29
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: change path of settings ini file

    Bad choice if you expect it to work on Windows Vista or 7 which prohibit unprivileged writing in the Program Files directories. If someone installs the software there it will likely fail.
    true, but as i said it`s a portable program, ie you are not meant to install it.
    Thanks guys, that did the trick.

  2. #2
    Join Date
    Jul 2012
    Posts
    248
    Thanks
    29
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: change path of settings ini file

    alright, here i am again.

    I am tempted to save projekt files (basically a bunch of numbers) on a per-projekt basis to .ini files. This is a popular request, everyone seems to love .ini file and hate my .xml s. :/


    QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, "c:\\");
    QSettings settings(QSettings::IniFormat, QSettings::UserScope, "projekt123", "inifile");

    settings.setValue("projx/asdf", QVariant((quint32)1234589));
    settings.sync();
    THis works fine.
    However:

    - i have to cheat by passing ( "projekt123", "inifile") to the constructor to get a wanted filename.
    - i change the path to "c:\". How can i get the previously set path as to restore it once i am done saving the projekt?


    I feel like i am abusing the QSettigns class a little for this. Does Qt offer any specialzed way for storing data in .ini files?

Similar Threads

  1. Replies: 1
    Last Post: 17th February 2012, 02:28
  2. Replies: 2
    Last Post: 16th November 2011, 11:18
  3. Qt Creator 1.0.0 - LIB & PATH settings in Ubuntu
    By qoo in forum Installation and Deployment
    Replies: 1
    Last Post: 20th April 2009, 08:35
  4. How to change Path
    By shyam prasad in forum Qt Programming
    Replies: 1
    Last Post: 10th January 2007, 08:29
  5. Replies: 3
    Last Post: 31st March 2006, 18:38

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.