Currently the data representation looks like this (conceptual)
Flat array ⇋ Tree QStandardItemModel
Where the actual data structures are these (for each parameter type)
2 maps for QStandardItem* ⇋ parameter index
2 maps for const char* parameter name ⇋ parameter index
array of ParameterInfo<type> holding boundary value and write status, indexed by parameter index
array of type holding actual value, indexed by parameter index
If I could redesign it I'd have a single parameter data structure for all types, holding its own type information, variant value, variant value boundaries, write status, name, and parameter index, held in an array indexed by the parameter index. I still wouldn't make the base data structure a tree because there's the requirement of no dynamic memory allocation for embedded usage (data structure is unfortunately shared between PC and onboard...).
Your suggestion of having an intermediate tree data structure would make it (conceptually)
Flat array ⇋ Tree of a new struct holding a variant for a value ⇋ Tree QStandardItemModel
Except here it's a many-to-1 mapping from flat array to the tree holding the data structure I mentioned above (with the addition of a list of children).
It seems like a lot of work for not so much gain.
If this is the minimum amount of work to merge the trees, I would be fine with a solution that presented the trees in parallel like
foo
└── bar
foo
└── baz
Not sure what you mean, each type's filter model will be a separate signal source.
The QSortFilterProxyModel is a signal source, but does it forward its underlying model's signals?
What I mean is that from the documentations, there is no QSortFilterProxyModel::itemChanged signal.
To establish context (and to set your expectation of my knowledge level so you know the intent behind my questions), I'm relatively inexperienced with Qt programming and aren't sure if the following is allowed:
connect(myProxyModel[type], &QStandardItemModel::itemChanged, this, myCallback[type]);
connect(myProxyModel[type], &QStandardItemModel::itemChanged, this, myCallback[type]);
To copy to clipboard, switch view to plain text mode
Don't you already know the type of an entry? How would you otherwise even filter for a type?
I do know the type of each entry; it's just that it's implicitly rather than explicitly encoded right now.
Currently we know the type of an entry based on which model it's in, since each model holds only parameters of that type.
My question relates to my previous premise that I couldn't distinguish the type based on the signal source.
However, if the previous line of code I posted is valid (i.e. the type can still be implicitly encoded in which proxy model is the signal source),
then this is not needed.
I'm assuming that if the previous line is valid, the proxy model doesn't fire on items that were filtered out.
Bookmarks