Qt software development - QSettings manages user environment variables (modification, output)

1 Introduction

In software development, it may be necessary to modify user environment variables and add new values. For example, adding the paths of some executable files and some dynamic libraries to the system environment PATH enables the corresponding dlls to be found during the execution of the executable files.

It can be implemented in Qt. The QSettingsQSettings class provides a platform-independent application setting. Qt has been encapsulated. Modifying and reading the user's environment variables does not require administrator permissions, and the modification is also directly modified for the system's environment configuration. , is not valid for the current process (so modify it with caution).

image-20220905112808474

2. QSettings

QSettings can modify the registry, support storing custom data formats, generally save application settings, save and restore application settings.

The detailed functions of QSettings are described in detail on the Qt help page. Currently, this is only a use case for QSettings to modify user environment variables, and other functions are not introduced in detail.

Here's an introduction to the Qt help page:

QSettings类提供持久的独立于平台的应用程序设置。
用户通常期望应用程序在会话中记住其设置(窗口大小和位置、选项等)。这些信息通常存储在Windows上的系统注册表中,以及macOS和iOS上的属性列表文件中。在Unix系统上,在没有标准的情况下,许多应用程序(包括KDE应用程序)使用INI文本文件。
QSettings是围绕这些技术的抽象,使能够以可移植的方式保存和恢复应用程序设置。

Guess you like

Origin blog.csdn.net/xiaolong1126626497/article/details/126702088
Recommended