How to make grid of album covers QT python

时间:2016-08-31 18:18:06

标签: python qt pyqt qt-designer

Currently i am trying to do it with QTableWidget but i cant seem to adjust the width of the table to the parent element, so when resizing is made, the columns need to increase. QtableWidget is placed in QTabWidget in the first tab. For more info, it is a music player like that: enter image description here

You can see that in the Tab 1 grid is going out of parent bounds horizontally. Vertically is not a problem but i will disable the horizontal scroll and i need the count of columns to fit the current size of the tab WITHOUT cell resizing.Cells must have the same size always except if regulated by the slider below the tab view. Tabs are needed to fit album covers so they will be square later on.

2 个答案:

答案 0 :(得分:1)

最灵活的方法是使用QGraphicsView。您可以创建与视图宽度相同的QGraphicScene,并相应地放置所有专辑封面。根据每个图像的大小和它们之间的填充,您可以计算出一行中可以容纳的数量。

答案 1 :(得分:0)

Problem kinda solved. I replaced the TableWidget with list widget in IconMode view mode.