octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

model/view design question


From: John W. Eaton
Subject: model/view design question
Date: Fri, 28 Jun 2019 18:37:46 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1

I noticed that in most cases where we are using model/view programming, we store the model and view objects together in the same class. For example, our files_dock_widget class owns a QFileSystemModel object and a QTreeView object. But the the workspace_view class (also a dock widget) only owns a QTableView object and the corresponding model objects is owned by the main_window class. Is there a reason for this difference?

Given that there could be multiple view objects that use the same model, maybe they should not be owned by the same parent object? But if not, then who should own the model data (or at least the model objects that can access the data from the interpreter)?

Maybe these model classes should be stored in the gui application object or the QObject adapter class that manages the Octave interpreter? Then any number of views could (in theory, anyway) be attached to them and the would be independent of any one particular view.

OTOH, if we know that we will only ever have one view of these models, then it might be simpler to package them together?

Either way, it seems like it would be good to fix things so that we are doing things consistently for all these model/view classes.

Comments and suggestions welcome.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]