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.8k stars 562 forks source link

[Bug]: HorizontalFlipViewc初始化后添加图片会导致图片位置不对 #1007

Open ShionCox opened 3 weeks ago

ShionCox commented 3 weeks ago

What happened?

HorizontalFlipViewc初始化后添加图片会导致图片位置不对,要点击一下切换才会正常,

Operation System

WINDOWS11

Python Version

3.11.4 64位

PyQt/PySide Version

PySide6

PyQt/PySide-Fluent-Widgets Version

1.7.0

How to Reproduce?

.

Minimum code

from qfluentwidgets import HorizontalFlipView
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout, QWidget

class Test(QMainWindow):
    def __init__(self):
        super().__init__()
        self.view = HorizontalFlipView()
        self.view.setSpacing(20)

        self.button = QPushButton("添加图片")
        self.button.clicked.connect(self.add_images)

        layout = QVBoxLayout()
        layout.addWidget(self.view)
        layout.addWidget(self.button)

        container = QWidget()
        container.setLayout(layout)
        self.setCentralWidget(container)

    def add_images(self):
        self.view.addImages(['images/userinfo/01.jpg', 'images/userinfo/01.jpg'])

if __name__ == "__main__":
    app = QApplication([])
    test = Test()
    test.show()
    app.exec_()