Results 1 to 3 of 3

Thread: QSettings usage for multiple processes

  1. #1
    Join Date
    Nov 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Question QSettings usage for multiple processes

    I am planning to use QSettings to save certain parameters of my application. These are to be used for recovery and restoration of the application to the saved state. As I understand from the documentation, the QSettings file can be used across parallel instances of the same application. But for my use case, I will be running parallel instances of the same application, but each application can have a different state which I want to persist. That is, the changes made in one instance should not be propagated to the other instances. Is this possible using QSettings? If so, how?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,199
    Thanks
    237
    Thanked 668 Times in 658 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QSettings usage for multiple processes

    The default QSettings file format is the same as a Windows INI file, with a hierarchy of key=value fields within groups. If you have a way of giving a unique identifier to each of your parallel processes, then you can define top-level groups using those IDs as the group names. Within each of these top-level groups, you can then have the same subgroup / key-value hierarchy. When any process reads or writes parameters, it must first open the top-level group corresponding to its ID so it gets its own unique set.

    I am not sure how you can define unique identifiers for the processes that will be persistent across different invocations. Perhaps there is something on stackoverflow with a solution to this problem.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Nov 2019
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSettings usage for multiple processes

    Quote Originally Posted by d_stranz View Post
    The default QSettings file format is the same as a Windows INI file, with a hierarchy of key=value fields within groups. If you have a way of giving a unique identifier to each of your parallel processes, then you can define top-level groups using those IDs as the group names. Within each of these top-level groups, you can then have the same subgroup / key-value hierarchy. When any process reads or writes parameters, it must first open the top-level group corresponding to its ID so it gets its own unique set.

    I am not sure how you can define unique identifiers for the processes that will be persistent across different invocations. Perhaps there is something on stackoverflow with a solution to this problem.
    Thank you! Will try this out.

Similar Threads

  1. Replies: 2
    Last Post: 23rd September 2014, 16:23
  2. Wait for multiple processes
    By Eubie in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2012, 17:39
  3. QUdpSocket broadcast to multiple processes
    By tomschuring in forum Qt Programming
    Replies: 1
    Last Post: 30th September 2010, 02:33
  4. Display from multiple processes in one GUI
    By abernat in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2009, 21:08
  5. QProcess Bash in Event Filter (Multiple Processes)
    By Arsenic in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2008, 09:42

Tags for this Thread

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.