Customizing the settings location and format

The constructor of the QSettings class has a number of overloads that allow you to change the location where the data will be stored by a particular QSettings object, instead of using the default location. First, you can override the organization name and the application name:

QSettings settings("Packt", "Game Programming using Qt"); 

Next, you can use the system-wide storage location by passing QSettings::SystemScope as the scope argument:

QSettings settings(QSettings::SystemScope,     "Packt", "Game Programming using Qt");

In this case, QSettings will try to read the settings for all users and then fall back to the user-specific location. Note that a system-wide location may not be writable, so ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.