Results 1 to 4 of 4

Thread: Where's the ini?

  1. #1
    Join Date
    Jun 2011
    Posts
    203
    Thanks
    7
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Where's the ini?

    Hi,

    I have the following code:

    Qt Code:
    1. void MyClass::SetDefaultOptions()
    2. {
    3. QSettings Settings(QSettings::IniFormat, QSettings::UserScope, MyCompany", "MyApp");
    4. Settings.setValue("options/dynamicresize", 1);
    5. Settings.setValue("options/width", 480);
    6. Settings.setValue("options/height", 800);
    7. Settings.setValue("options/xcoordinate", 0);
    8. Settings.setValue("options/ycoordinate", 0);
    9. }
    To copy to clipboard, switch view to plain text mode 

    Which gets called in the constructor, but I can't find the ini when I run it. I'm guessing it's supposed to be in the debug/release folder?
    Last edited by Atomic_Sheep; 20th September 2017 at 09:17.

  2. #2
    Join Date
    Jan 2017
    Posts
    58
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Where's the ini?

    You can define the filepath in the constructor: http://doc.qt.io/qt-4.8/qsettings.html#QSettings-4

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Where's the ini?

    I'm guessing it's supposed to be in the debug/release folder?
    Actually, try looking in your C:/Users/<username>/AppData/Local (or Roaming) folder for "MyCompany/MyApp.ini" on Windows.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  4. #4
    Join Date
    Jun 2011
    Posts
    203
    Thanks
    7
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Where's the ini?

    Bingo, found it!

    Thanks ado130 for the tip.

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.