Important: Please read the Qt Code of Conduct -

c++ QSetting for store system date

  • My project ... a sort of timeout for control if app run more than 8 mounth for example .... at every run read the past saved data from a QSetting group called "dataControl" .... than

    if there are less than 2 day difference from actual data, I store the new date on QSetting group "dataControl" ...
    than I control the "startingdata" from QSetting group "startingdata" ...
    if the difference from "startingdata" is more than 8 mounth I stop the app
    if less nothing to do.
    else QSetting group "dataControl" is more than 2 I send a messages "someone have modified system data" and stop the app.

    my problem the app maybe run for 10 years or more .... every date that I stored onto Qsetting group required some spaces ... there are a system to delete the oldest data saved on QSettings and saved only the newest? (maybe not uderstand very well the QSetting woking mode .... as I understand basically it is a database ... and every group is only a data table ... is wrong these??)


  • Lifetime Qt Champion

    QSettings is really not a database as such.
    On windows, it stores the values in registry on linux
    in a (text) ini file. Can also save to ini on windows.
    The is no algorithm to remove old ones or anything like that.
    However, you can do that manually.
    If app is to live 10 years saving to registry seems not like
    a good solution as windows might get wiped/reinstalled.

    Why not use QT SQL real database for it ?
    It can easy handled GB of data if enough disk space and
    you can use SQL to find and remove older entries.

  • @mrjj thnks ... I already use with success sqlite database ... in these case i need to protect the data with some program ... I'm on linux and normally I make a custom minimal install ... so system never update requirement to user ... ok I make in these way ... there are some system to connect qt app with a database encription for protect table data from change?


  • Lifetime Qt Champion

    Yes sqlite supports encryption
    To use it free, u have to build it yourself.
    I think this also works

    If you google, there are other options too.

Log in to reply