Chart Model-View

From ParaQ Wiki
Jump to navigationJump to search

Using Qt's Model-View

What are the pros and cons of using Qt's model-view to implement the charting widgets?

The main benefit of using Qt's model-view architecture is that is is already designed. This benefit can also be viewed as a stumbling block. Qt's model-view architecture is a little complicated. Unwanted behavior can be built in too. Qt uses private classes to do much of the work. These private classes make it difficult to override behavior. I ran into this a few times when building the flat tree view. The selection highlighting is still unresolved. Qt doesn't honor all the item flags when selecting items. Items can be made the current item even if they are not selectable.

--Mark Richardson 19:03, 10 Aug 2006 (EDT)

Another pro for using Qt's Model-View is that, when appropriate, we can use the same model with chart widgets and widgets that come with Qt. For example, if the x-y plot chart accepted values in a Qt model 2 column table, that same data could be put in a QTableView, which could be handy. If we were able to use the Qt selection classes, the selection could be easily linked, too.

--Ken 09:16, 11 Aug 2006 (EDT)

Qt views always ask for the data as a string. The call will convert a number to a string, but doesn't give us an option of how to convert it. We would have to make our own delegate class to be able to format the numbers how we want them. The delegate could most likely be derived from Qt's concrete delegate class to provide most of the functionality. This isn't a show stopper, but something to be aware of.
--Mark Richardson 11:49, 11 Aug 2006 (EDT)

Creating a New Model-View

What are the pros and cons of creating a new model-view architecture for the charting widgets?

Building our own model-view architecture will take time. It's unclear which path will take less time though. The main benefit of designing our own architecture is that it will behave exactly how we want it too. The interface can be tailored to fit PGraph. I think we can make the interaction between the model and the view simpler than Qt's without losing any functionality. The models in Qt are nice and simple, but the views are a little tangled. Our own design can be made more efficient than Qt's implementation as well.

--Mark Richardson 19:03, 10 Aug 2006 (EDT)