QML vs QGraphicsView - choosing the right level of abstraction
For what types of projects is QML the right level of abstraction and when is QGraphicsView more suitable? All of the example QML applications I have seen are small "iPhone-style apps", viewers or from-like database frontends. Is QML suitable for applications that deal with editing documents, like a word processor, for example?
Two aspects interest me in particular:
QGraphicsView is advertised as being able to cope with millions of items. Is the same true of QML? In the word-processor example, would it be practical to represent every paragraph of text by a separate QML item? Would this approach scale to a 100 page novel? Or does the overhead imposed by QML over QGraphicsView make this impractical?
If the number of items in a QDeclarativeView changes dynamically (as in the paragraphs in a novel example), is it still practical to manage these changes from QML? Or would the traditional C++ approach be the tool of choice? Also, I find the tools for describing abstract state machines in Qt very appealing, but these seem to be focused on small finite state machines (or at most states parameterized by scalar variables). I take it that handling an unbounded list of paragraphs, each with its own internal state, impractical, especially if paragraphs might be nested?
Please let me know your thoughts on the matter!
No. Go for ordinary widgets. The features of QML/QGV (and their overhead) aren't much of help in case of a word processor.
Hi peppe, thanks for your reply. Even though I am dealing with a word-processor-like application, I will have to do a lot of custom drawing. I investigated the use of ordinary widgets with custom paint methods, which turned out to be too slow. I will require the optimizations that only a proper canvas can afford. This lead me to QGV.
Nonetheless, I think you are right, peppe, and QML is not the right tool for the job.
Well I start to slowly change some of my applications to QML. For the moment only small objects, so the speed doesn't slow. Once the QML scene graph is done , I will probably move almost all the interface to QML. At least for me it works because I want to add more kinky-animated look to my applications. Depends what do you want.