开发者

Qt: How to layout records in a grid? QListView or QGridLayout?

Still learning the fundamental concepts...

I want to layout items that come from a database in a grid. Each item will have a custom view with a preview picture, attributes and controls. The grid can change size, i.e. 3, 4, 5 columns (large-small previews).

Is this best done by adding (looping through the table) custom widgets to a grid, or by using icon list view wit开发者_如何学编程h a "delegate"?

Thanks!


My first inclination would be to go with the icon list view and a delegate (especially if you already have your data in model form). If that doesn't work, you might be able to use the icon list view as a guideline to creating your own list view. Two benefits of the views is that they handle a lot of the repositioning of items if something is inserted into the middle, and often have lazy evaluation of data they need. A side benefit of having your data in a model is the ability to use it in other places as well (such as a combo box, if you want to let the user choose one image elsewhere).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜