QSettings settings("MyCompany", "MyApp"); settings.setValue("defaultColor", QColor(Qt::red));
QSettings settings; settings.setValue("fontSize", 12);In this example, we create a QSettings object without specifying the company and application name. We then set the value of the "fontSize" key to an integer value of 12. This setting will also be saved in the application's configuration file. In both examples, we use the setValue() function to set the value of a key in the QSettings object. The data type of the value can be any supported data type. The library used for the QSettings class is QtCore.