MVC in Qt vs Gtk +

I am a Qt C ++ programmer with some interest in Gtk +. I wonder how Gtk + implemented Model-View-Controller. In Qt, they basically screwed it up, and basically admitted it themselves. I can try to explain the flaws in Qt and for those who know Gtk +, perhaps you can answer whether Gtk + has the same or worse problems:

Access to any node, for example, in a tree based on QModelIndex. Therefore, each node has its own unique identifier. This creates many complications. You must create special methods to create the index and to create the index of the parent of the QModelIndex object. It can become quite attractive. It's hard to say, create two model objects and attach one of them as a node in the other model. QModelIndex objects returned from one model are not compatible with others.

I think Cocoa made a much simpler model with NSOutlineView and NSOutlineViewDataSource. The Qt approach is more flexible, but at the expense of too complicated use and proper use. With Cocoa, you do not use an index object, but instead ask the question that the child of object X has index Y. Then you can ask about the value for the given column of table Z and object X.

Qt does not have a particularly easy-to-use way to invalidate a node in a tree to reload it. With Cocoa, you can call reloadItem to make a specific object in the tree, and perhaps its children will be reloaded from Model.

This is part of my assessment of how Gtk + fits. I am not trying to declare my winner here; -)

+3
1

, (GTK + model-view-controller , , , ), GtkTreeModel.

GtkTreeIter "" .

, , GTK +.

node , row-changed, . , .

+3

Source: https://habr.com/ru/post/1744940/


All Articles