Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Read from .ini file with QSettings and real-time performance question



  • Hello

    I have a question about real-time performance and use of QSettings class. I have parameters stored in an .ini file and want to access these with help of the QSettings class. What i wonder is how QSettings handles the data.
    See the following code:

    @QSettings* settings;
    settings = new QSettings(file, QSettings::IniFormat);@

    Does this mean that the file is parsed and stored in the objecs settings or does it only open the file?
    If it only opens the file, then I assume that it will be quite time consuming to read the data from the file every time I want to access it?

    Thank you for your input!
    /qul


  • Moderators

    I have never benchmarked QSettings, but I can tell you that in real life I've seen large apps with huge settings objects being created for every change in the program's preferences: and it's unnoticeable to the user. The thing is fast.

    I think that once you create the object, it's parsed. But you would have to check QSettings source code to be sure.


Log in to reply