O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required