ModelView model behind tweets in QTwitdget

One of the design goals of QTwitdget was that there as much as clear separation can between network backend (fetching tweets) and ui frontend (showing tweets). That was achieved with using standart model/view architecture. Model is represented with network backend and view is QML ListView (earlier versions I had designed very crude and simple QGraphicsScene list view). Model fetches tweets from network, constructs a list, view just represents them in UI.

Model classes are inherited from QAbstractListModel, they  reimplement rowCount, data, and adds own delegate roles. All  network interaction is happening in the model classes, UI doesn’t care or know what is happening. Even deleting tweet is happening in model classes. There is one property numNewTweets which is used in model classes (not all model classes have this property) to inform UI that they are new tweets in the ‘pipeline’. For showing new tweets there is special Q_INVOKABLE which can be called from QML side, to show new tweets, which is actually prepending new tweets to a list of tweets.

I must say that I was surprised how easy was to ‘connect’ C++ model classes to a QML ListView element. Inherited QAbstractListModel, add new roles, define new delegate QML element, and inject model to declarative engine (I will write new blog post about this). On the other side, the performance of ListView on Symbian is below par, pretty much useless (unless you do some heavy caching). Add to that using QtNetwork on Symbian slows down user interface… I hope trolls can fixed that.

~ од minimoog на Август 27, 2011.

One Response to “ModelView model behind tweets in QTwitdget”

  1. I am in fact happy to read this web site posts which consists of tons of
    helpful facts, thanks for providing these kinds of data.

Напишете коментар