Results 1 to 9 of 9

Thread: How to use QSettings to read INI file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Location
    Bangalore, India.
    Posts
    28
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to use QSettings to read INI file

    Hi
    my .ini file is

    [System.Setting]
    auto_check_update=false
    auto_check_mode=weekly

    & the code to read is
    QString strKey("System.Setting/");
    QSettings * settings = 0;
    settings = new QSettings( file_path, QSettings::IniFormat );
    QString strMode = settings->value( strKey + "auto_check_mode", "r").toString();

    no problem with the code compiling & running. when i try to print strMode program is unexpectedly finising.. this is happening with QString, Date (Derived data types). but fine with basic data types like int, float, bool...
    using printf to print the values. qDebug is not working in this project. what could be the problem?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to use QSettings to read INI file

    Does your derived data type(Date) support QVariant ?
    QSettings use QVariant to work.

Similar Threads

  1. Replies: 5
    Last Post: 27th May 2009, 12:49
  2. Read binary from file
    By weldpua2008 in forum Newbie
    Replies: 2
    Last Post: 3rd April 2009, 23:50
  3. QFile can't read a file
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 11th February 2009, 20:24
  4. [Java] read and write a file
    By mickey in forum General Programming
    Replies: 3
    Last Post: 22nd June 2008, 10:43
  5. Using QSettings to read pre-made INI file..
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 05: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.