PDA

View Full Version : MVC question



^NyAw^
16th June 2009, 13:00
Hi,

I have a class (class CTool) that I want to be represented using MVC approach.
Class CTool has three types of parameters that have to be represented on a QTreeView, Configuration, Input and Output. The parameters are stored on a single QList.

I'm thinking on creating a QDockWidget that will contain a QTabWidget(three tabs for each parameter type). Each tab have a QTreeView(I think so).

Have I to use three QTreeViews, one for each tab? Have you a better idea how to represent this data?

Thanks,

wysota
16th June 2009, 13:20
If you want them to be independent then you need three views. But you can represent three types of information in one view, where the type of information is one level of data and the information itself is a sub-level. In other words parameters are child items of parameter types.

^NyAw^
16th June 2009, 13:31
Hi,

And what about representing it on a QTableView(or a Tree view)? First row "Configuration", then the Configuration parameters. Then another row "Input" and the Input parameters, ...

I think that maybe will be clearer by the user.

Sometimes I don't really know how to represent some data to be beautiful because I'm the only programmer. :confused: An then, asking here and reading your ideas is perfect.:)

Thanks,

^NyAw^
16th June 2009, 18:30
Hi,

I'm creating the Model that will represent my classes.

I have a list like "QList<myClass>" and I want to represent "myClass" at index depending on the application state, so one time I have to show the "myClass" at position 0, then maybe I need to shot the "myClass" at position N.
Have I to create a Model for each "myClass" instance or can I use the same model clearing it and filling it again with the new data?

^NyAw^
17th June 2009, 09:59
Hi,

Have I to create a Model for every "myClass" instance and change the model of the view?

Thanks,

^NyAw^
17th June 2009, 13:11
Hi,

I don't know where to start.
I have a class "CTool" that have a "QList<CParameter>". Each parameter can store "int", "double" or "QString" depending on its type. The "CTool" objects are created dynamically and also can be deleted.
I want to create a Model that have two columns, first one "parameter name" and the second one "value".
When I create a "CTool" object I have also to create a model that represent it, right? Where I create it? Have I to create a "CToolModel" into the "CTool" class?

I'm reading the docs and don't know how to do this.

Thanks,