Saving and restoring settings
Although the clock can be moved, it won't restore its last position after restarting. In addition to this, we can give users some choices to adjust the clock's appearance, such as the font color. To make it work, we need the QSettings
class, which provides platform-independent persistent settings. It needs a company or organization name and the name of an application. A typical QSettings
object can be constructed by using this line:
QSettings settings("Qt5 Blueprints", "Fancy Clock");
Here, Qt5 Blueprints
is the organization's name and Fancy Clock
is the application's name.
The settings are stored in the system registry on Windows, while they are stored in the XML preferences files on Mac OS X and the INI text files ...
Get Qt 5 Blueprints 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.