QSettings - how to clear the error?



  • Hi,

    After I call sync(), I get AccessError when I checked the status. Then I fix the permission through program and call sync() again. This synced the settings but the error is not cleared. Is there any way I can forcefully clear it before calling second sync()?

    -Karthik



  • Is there a way to access setStatus(..) of QSettingPrivate by subclassing?

    -Karthik



  • From Qsettings.cpp of -

    "
    /*
    We only set an error if there isn't one set already. This way the user always gets the
    first error that occurred. We always allow clearing errors.
    */
    void QSettingsPrivate::setStatus(QSettings::Status status) const
    "/

    So there should be a public function in QSettings.cpp to clear the errors. Is there any reason why it was skipped?

    Is there anyway to access the private date of QSettings and clear the error?

    -Karthik



  • It looks like QSettings doesn't reset the status (which might be a good thing or a bad thing, depends), but there should be a way to reset it on demand (your use case is a perfect one).

    Do you mind filing a bug report / feature request?


  • Moderators

    I completely agree with Lukas Geyer's perfect answer.
    Only one thing in addition, it would be good to public a link to your bug report here. This allows people voting for your request and may increase its priority.



  • Hi,

    Thanks for your comments. I will file an enhancement request. Can you please give instructions how to file with Qt since this is my first report with them?

    BTW, is there a way to access the private member ( inside qsettings_p ) and get access to setStatus function? I tried subclassing QSettings and QSettingPrivate but that won't work.

    -Karthik



  • [quote author="kartlee" date="1326236201"]Hi,
    Thanks for your comments. I will file an enhancement request. Can you please give instructions how to file with Qt since this is my first report with them?[/quote]
    Just follow "this":http://labs.qt.nokia.com/2010/03/02/how-to-file-a-qt-bug-report-in-the-new-bug-tracker/ link.

    [quote author="kartlee" date="1326236201"]BTW, is there a way to access the private member ( inside qsettings_p ) and get access to setStatus function? I tried subclassing QSettings and QSettingPrivate but that won't work.[/quote]

    Theoretically yes, practically no.



  • [quote author="Lukas Geyer" date="1326190237"]It looks like QSettings doesn't reset the status (which might be a good thing or a bad thing, depends), but there should be a way to reset it on demand (your use case is a perfect one).

    Do you mind filing a bug report / feature request?[/quote]

    https://bugreports.qt.nokia.com/browse/QTBUG-23857

    -Karthik


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.