One QAbstractItemModel for every setting of one app. More...
| Header: | #include <ConfigModel> |
| Inherits: | QAbstractItemModel |
The model holds the app's schemas, for example the paint schema and the shortcut schema, and each schema adds its top categories to the tree. Every surface that shows settings is a view on it, often through a proxy, so an edit in one view reaches every other view through dataChanged (config-ui §CFGV-1).
Three kinds of node: category, section and setting. A category holds categories or sections, and a section holds settings. A category path that holds settings directly gets a section of its own name. A setting row returns Qt::ItemNeverHasChildren, so QTreeView::expandAll() makes no persistent index for it.
The nodes live in one flat vector with the parent and the row in each node, so index() and parent() are O(1). The model never uses QStandardItemModel, which costs one heap object per cell (config-ui §CFGV-2).
Every write from a view goes through setData(), which validates and pushes a SetCommand, or records the edit in the history of the document that owns the level (§CFGV-3a). The resolver then emits its change signal, and the model turns it into dataChanged on one row with an explicit role list. A write from outside, an OPAL task or app code, takes the same path from the resolver on.