简体   繁体   English

使流布局适应Qt表

[英]Adapt Flow Layout to a Qt Table

I'm working on a project in which I'd like to make something like the pattern explorer in Photoshop (as in this picture http://uploads.siteduzero.com/files/392001_393000/392193.png )`; 我正在开发一个项目,我想在Photoshop中创建类似于模式资源管理器的项目(如图所示http://uploads.siteduzero.com/files/392001_393000/392193.png )`;

I originally was doing so using a custom QAbstractTableModel coupled with a QTableView but I have to set the numbers of rows and cols from the Model itself. 我最初使用自定义QAbstractTableModel和QTableView这样做,但我必须设置模型本身的行数和列数。 This is a problem because I want the columns to adapt to the viewer width as in the FlowLayout example : http://qt-project.org/doc/qt-4.8/layouts-flowlayout.html 这是一个问题,因为我希望列适应查看器宽度,如FlowLayout示例中所示: http//qt-project.org/doc/qt-4.8/layouts-flowlayout.html

It seems that the model/view system isn't adapted to what I want to do, but I don't know how to make my widget look like a table (as in the screenshot above). 似乎模型/视图系统不适应我想做的事情,但我不知道如何使我的小部件看起来像一张桌子(如上面的截图所示)。

Could you help me on that point ? 你能帮我解决这个问题吗?

Thanks a lot ! 非常感谢 !

Use QListView with 使用QListView

setViewMode(QListView::IconMode);
setFlow(QListView::LeftToRight);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM