I have several QStandardItemModels (each wrapped in a QSortedFilterProxyModel) that are populated in a tree-like way.
Conceptually what I'm modelling is variable values.
These variables exist under namespaces, which are potentially nested.
Each namespace item has 1 column (name), and is the parent item of all namespace and value items underneath it.
Each value item has 3 columns (name, modifiable status, value), and are the leaf nodes.

I have several of these models, one for each data type (int8_t, int16_t, float, ...), and currently I have a QTreeView and a QTab for each of them.
The views exist in their own tabs.

Now I want to be able to display a merged version of all the variables in a single window - assume I don't have access to the original data source, and that no fully qualified variable name conflicts.
Since namespaces are shared between data types, ideally the children of that namespace should all belong to the same parent - rather than copies of the namespace.

e.g. if I have foo.bar (float) and foo.baz (int), I would prefer the combined tree view to show

foo
├── bar
└── baz

rather than

foo
└── bar
foo
└── baz

I have already implemented this when serializing into YAML format by keeping track of the existence of namespace nodes; if they exist, attach to it; if not, create it, but I don't know if this would translate into the same solution when merging models.

It's also important to maintain the itemChanged signals of the original models, since I have different slots depending on the type I'm changing.

How do I achieve this sort of tree merge? I saw a post here about wrapping multiple QStandardItemModels, but no one replied to that post,
and the result we're looking for is slightly different (they want parallel trees, I want merged trees).