Qt - How to save a configuration file on multiple platforms

前端 未结 4 942
一生所求
一生所求 2021-01-20 15:35

I\'m writing a Qt application that needs to save some settings to the user\'s configuration directory.

I\'ve come up with the following code to get this folder:

4条回答
  •  不知归路
    2021-01-20 16:22

    I use QSettings for simple values that make sense to put in the Windows registry or an INI file, and SQLite for more complicated setups. In Qt5, put the SQLite database in QStandardPaths::writableLocation(QStandardPaths::ConfigLocation). In Qt4, put the SQLite database in QDesktopServices as gnud suggested (deprecated in Qt5).

提交回复
热议问题