Skip to content

Model of Models #7538

Answered by tronical
Finkman asked this question in Q&A
Feb 4, 2025 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

As you have noticed, generated CompModel structure has only fields with the directly used types, so changing enabled for example implies no way of finding out that it changed. The barrier of notification here is not the structure but the model, or specifically the model's row the particular CompModel is in.

If the entire row or just an individual field of the struct changes, the model needs know that the row changed, in order to notify the UI (or view in MVC terms) that it may (or may not) need updating.

If you'r using VectorModel, the pattern would be like this:

auto comp_model = *model->row_data(3);
comp_model.enabled = ...;
model->set_row_data(3, comp_model);

The last call will notify …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Finkman
Comment options

@tronical
Comment options

Answer selected by Finkman
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants