Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User kenouz1234's Avatar
    Join Date
    Mar 2009
    Posts
    22
    Hello,
    How I can remove automatically the data of QSettings when uninstalling application?

    (the QSettings is stored in their default location by using:

    Code:
    QSettings setting(“Company", "MyApplication");
    QVariant value = 10;
    setting.setValue("Engine/TimeOutPeriod", value);
    )
    Last edited by kenouz1234; 2011-01-11 at 16:59.

  2. #2
    Registered User Jon Heron's Avatar
    Join Date
    Feb 2010
    Posts
    210
    Code:
    settings.clear();
    Will clear all of the data from the settings file.
    Cheers,
    Jon

  3. #3
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    Of course, you need to somehow automatically run that during app removal.

  4. #4
    Regular Contributor jakoskin's Avatar
    Join Date
    Sep 2008
    Posts
    286
    If you store the settings file in your private directory (use user scope for settings) they will be automatically deleted. For system scope this becomes issue.
    We had discussion about this, thought there was a bugreport even.. http://bugreports.qt.nokia.com/browse/QTBUG-16229

  5. #5
    Registered User tineursic's Avatar
    Join Date
    Jul 2009
    Posts
    37
    The private dir fixes the issue on 5th and ^3. But it doesn't work on 3rd (Qt4.6.3 or Qt4.7.3)

    Code:
    QSettings *settings;
    settings = new QSettings(QApplication::applicationDirPath().append(QDir::separator()).append("set.ini"), QSettings::IniFormat);
    settings->setValue("test",1);
    While the app is running the value "1" can be read:
    settings->value("test", 0)
    After restarting the app, the value is gone.
    The above code works fine on 5th and ^3.

    Tried stuff like:
    Code:
    QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, apppath);
    No luck.

  6. #6
    Registered User tineursic's Avatar
    Join Date
    Jul 2009
    Posts
    37
    Solved.
    Simply made a subdir in the private folder and store the settings file there.

    Code:
        //set Settings file path
        QString thePath = QApplication::applicationDirPath().append(QDir::separator()).append("set");
        if (QDir(thePath).exists())
        {
            settings = new QSettings(thePath.append(QDir::separator()).append("set.ini"), QSettings::NativeFormat);
        }

Similar Threads

  1. Qt Persistent store: QSettings
    By bobford in forum Qt
    Replies: 1
    Last Post: 2011-01-10, 10:26
  2. Replies: 3
    Last Post: 2010-10-29, 14:14
  3. How to delete some files in c drive while uninstalling
    By amit.mangal in forum Symbian C++
    Replies: 14
    Last Post: 2010-02-16, 11:07
  4. Delete file while uninstalling
    By santu.paul@gmail.com in forum Symbian C++
    Replies: 5
    Last Post: 2009-02-06, 06:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved