Results 1 to 5 of 5

Thread: [qt4.1,win,g++] QSettings does not write settings

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    84
    Thanks
    7
    Thanked 2 Times in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [qt4.1,win,g++] QSettings does not write settings

    hi,

    before an application is exited a method is called where the settings should
    be written to the registry:


    void
    fdi_MainWindow::write_settings()
    {

    QSettings settings;

    settings.setValue(fdinsight_settings + "/version", version );
    settings.setValue(fdinsight_settings + "/window/posx", x() );
    settings.setValue(fdinsight_settings + "/window/posy", y() );
    settings.setValue(fdinsight_settings + "/window/width", width() );
    settings.setValue(fdinsight_settings + "/window/height", height() );

    }


    i cannot find the settings in the registry, when the app tries to read
    the settings they could not be read as well.

    what's wrong?

    regards,
    jh

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [qt4.1,win,g++] QSettings does not write settings

    What does QSettings::status() return? What is the value of fdinsight_settings variable?

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    84
    Thanks
    7
    Thanked 2 Times in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [qt4.1,win,g++] QSettings does not write settings

    fdinsight_settings is just a qstring.

    status returns:

    QSettings::AccessError

    how can it be that an access error occurs while trying to
    write the registry? did i forget anything?
    (btw. the code worked with qt3)

    regards,
    jh

  4. #4
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [qt4.1,win,g++] QSettings does not write settings

    Add this behind the QApplication constructor of your main():

    Qt Code:
    1. QApplication a(argc, argv);
    2. a.setOrganizationName("My Company");
    3. a.setOrganizationDomain("mycompany.com");
    4. a.setApplicationName("My Application");
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    84
    Thanks
    7
    Thanked 2 Times in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [qt4.1,win,g++] QSettings does not write settings

    it works. thanx a lot!

    jh

Similar Threads

  1. QSettings problem?
    By cyberboy in forum Qt Programming
    Replies: 2
    Last Post: 28th June 2008, 22:14

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.