Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6371009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:00:17+00:00 2026-05-25T01:00:17+00:00

I am using Qsettings for non gui products to store its settings into xml

  • 0

I am using Qsettings for non gui products to store its settings into xml files. This is written as a library which gets used in C, C++ programs. There will be 1 xml file file for each product. Each product might have more than one sub products and they are written into xml by subproduct grouping as follows –

File: “product1.xml”

<product1>
    <subproduct1>
       <settings1>..</settings1>
       ....
       <settingsn>..</settingsn>
    </subproduct1>
    ...
    <subproductn>
       <settings1>..</settings1>
       ....
       <settingsn>..</settingsn>
    </subproductn>

 </product1>

File: productn.xml

<productn>
   <subproduct1>
       <settings1>..</settings1>
       ....
       <settingsn>..</settingsn>
   </subproduct1>
   ...
   <subproductn>
       <settings1>..</settings1>
       ....
       <settingsn>..</settingsn>
   </subproductn>

 </productn>

The code in one process does the following –

settings = new QSettings("product1.xml", XmlFormat);
settings.setValue("settings1",<value>)
sleep(20);
settings.setValue("settings2", <value2>)
settings.sync();

When the first process goes to sleep, I start another process which does the following –

settings = new QSettings("product1.xml", XmlFormat);
settings.remove("settings1")
settings.setValue("settings3", <value3>)
settings.sync();

I would expect the settings1 to go away from product1.xml file but it still persist in the file – product1.xml at the end of above two process. I am not using QCoreApplication(..) in my settings library. Please point issues if there is anything wrong in the above design.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:00:17+00:00Added an answer on May 25, 2026 at 1:00 am

    This is kind of an odd thing that you’re doing, but one thing to note is that the sync() call is what actually writes the file to disk. In this case if you want your second process to actually see the changes you’ve made, then you’ll need to call sync() before your second process accesses the file in order to guarantee that it will actually see your modifications. Thus I would try putting a settings.sync() call right before your sleep(20)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To store application settings, I am using the Settings tab in the project properties.
I'm using nhibernate to store some user settings for an app in a SQL
I am using .Net 2 and the normal way to store my settings. I
I have a single-threaded non-blocking socket IO server written in Java using nio. When
When using a Settings.settings file in .NET, where is the config actually stored? I
Is it possible to apply (and remove) Windows group policy settings using .NET? I
How to extract the path c:/documents and settings/user using Java... Is there any method??
I've got a class that I'm using as a settings class that is serialized
Using Sinatra in Ruby you can set the server's settings by doing: set :myvariable,
I am using a PreferenceActivity to show some settings for my application. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.