Qt model/view vs standard widget

戏子无情 提交于 2019-12-12 14:46:55

问题


I am currently reading model/view tutorial from Qt, but I am still not sure if I should use model/view or widget for my Qt program :

I need to do a logger application that will monitor all information in a simulation environment. Basic scenario might be :

  1. User 1 say something to virtual entity B (logger application get what user 1 said and show it in table view or list view)
  2. Virtual entity B reply something to user 1 (logger application get what user 1 said and add it in table view or list view)

etc

The needs of this logger application is to get this information in real time and also, the data collected will NOT be editable. Essentially, this is just to show logs.

So, is it worth it to use modal/view or widget is enough for what I want to do?

Thank you


回答1:


I had simular target and simular question. I looked both solutions.

I created log file with 20 mb size. Then, I loaded him into QTableView with own model, and to QTableWidget with standard model.

QTableView was more faster (about 30 sec) than QTableWidget (about 1.5 min), but solution with QTableWidget was easer.

About you question i think, if you will have big log (many information must be loaded immediately), you should use QTableView with own model. Else more easer is use QTableWidget with standard model.




回答2:


If the logs entries are not saved in a database table, go with the widgets, otherwise I would give a look at the model/view



来源:https://stackoverflow.com/questions/14461213/qt-model-view-vs-standard-widget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!