Skip to content

Files

Latest commit

ostr00000pre-commit-ci[bot]chennes
Jan 5, 2024
ceea112 · Jan 5, 2024

History

History
29 lines (20 loc) · 1.7 KB

preferences.md

File metadata and controls

29 lines (20 loc) · 1.7 KB
layout
default

Handling Preferences

How to retrieve and update user preferences.

The user.cfg XML file contains a hierarchical list of all the preferences used by FreeCAD.

Each module has its own branch of the hierarchy starting under Preferences/Mod.

There are two ways of updating preferences:

  • the Tools > Edit parameters menu entry
    • this is a general purpose preference editor that can change any parameter in the hierarchy. This editor does not perform any validation or suggest valid values.
  • custom preference dialogs
    • a sample dialog
    • these dialogs use custom FreeCAD widgets to update preference values. Each preference widget has two special properties: prefEntry and prefPath. prefPath is the identifies the branch of the preference hierarchy and prefEntry identifies the leaf node to be updated.
    • two entries are needed in the dialog for each preference value - onSave() in saveSettings and onRestore() in loadSettings().

Preference values are retrieved (and sometimes set) using functions from Base/Parameter.cpp.

Good examples of retrieving parameters can be found in:

See also