I was wondering where I should put logic for sorting and filtering a Qt tables in a MVC model. I'm working with a
I'm relatively new to the MVC model so bear with me.
Thanks in advance.
Answer:
QAbstractTableModel
. - My tables are handling anywhere from 20 items to 100,000.
- I need to handle multiple views of the same data with different sort and filter criteria.
I'm relatively new to the MVC model so bear with me.
Thanks in advance.
Answer:
If the sorting/filtering is specific to a view, then the filtering/sorting logic belongs in the View.
Edit: I suppose I should add that the logic itself doesn't necessarily belong in the view -- depending on the situation, you might (for example) have a back-end that uses something like SQL, in which case the query that specifies the filtering/sorting goes in the view, but the implementation of the sorting/filtering itself would end up in SQL implementation. Even if you use something less elaborate than SQL, you can still have a generic implementation of the logic in the back-end, and only a specification of what to do in the view itself.
No comments:
Post a Comment