Results 1 to 2 of 2

Thread: How to create lock on .ini using QSetting?

  1. #1
    Join Date
    Jun 2015
    Qt products
    Unix/X11 Windows

    Default How to create lock on .ini using QSetting?


    I have created a .ini file but want to lock this file so that the user cannot change it manually.

    give me your suggestions or let me know what other solutions to lock the .ini file


  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 711 Times in 701 Posts
    Qt products
    Windows Android

    Default Re: How to create lock on .ini using QSetting?

    My suggestions are to:

    1 - Zip the file with encryption. Read the encrypted file into memory, decrypt it, and then read from the decrypted string; reverse the operations to write it - or -
    2 - Leave the file itself unencrypted, but encrypt the strings in it.

    Option 1 will involve writing your own QSettings format. Years ago I posted code here for an implementation of QSettings which used XML instead of INI format. You might be able to adapt that for reading settings from an in-memory string.

    Option 2 probably will require you to convert the INI string into a QByteArray, encrypt that into another QByteArray, and then use the standard QSettings class to write that out. The user will see the strings in the INI file, but if you encrypt both keys and values, they will be nonsense and not retrievable.
    <=== 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.

Similar Threads

  1. Read INI file from QSetting
    By puneet in forum Qt Quick
    Replies: 4
    Last Post: 26th December 2014, 09:32
  2. Some QSetting Questions and some more...
    By aguayro in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2012, 13:43
  3. How to use QSetting for different resolutions.
    By pastispast in forum Qt Programming
    Replies: 3
    Last Post: 8th October 2010, 13:26
  4. QVector and QSetting
    By mattia in forum Newbie
    Replies: 1
    Last Post: 8th November 2007, 16:21
  5. QSetting value() not correct
    By bpetty in forum Newbie
    Replies: 1
    Last Post: 14th August 2006, 19:58

Tags for this Thread


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.