zhiyiYo / PyQt-Fluent-Widgets

A fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
https://qfluentwidgets.com
GNU General Public License v3.0
5.61k stars 541 forks source link

关于expand_layout #327

Closed Changgeng-Wei closed 1 year ago

Changgeng-Wei commented 1 year ago

在Setting_card_group中,如果隐藏其中的某一个card,这个card会留下空白,card_group不会自动调整尺寸,adjustsize()也没用, 不知道是不是有什么可以设置吗?我对源码进行了修改,改善了这个问题,在qfluentwidgets.components.layout.expand_layout的__doLayout()中加入if w.isHidden():continue。具体如下:

    for i, w in enumerate(self.__widgets):
        if w.isHidden():
            continue
        y += (i > 0) * self.spacing()
        if move:
            w.setGeometry(QRect(QPoint(x, y), QSize(width, w.height())))

        y += w.height()
zhiyiYo commented 1 year ago

这个布局类是给 SongCardGroup 内部使用的,设计的时候没有考虑隐藏的问题。直接用 QVBoxLayout 应该也能实现相同效果的