Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlowLayout中的控件在ExpandSettingCard中无法全部显示问题 #876

Open
gcc2001 opened this issue May 12, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@gcc2001
Copy link

gcc2001 commented May 12, 2024

What happened?

在ExpandSettingCard的viewLayout中利用FlowLayout布置控件,会出现无法正常显示所有控件

Operation System

Windows 11 23H2

Python Version

3.10.11 64-bit

PyQt/PySide Version

5.15.10

PyQt/PySide-Fluent-Widgets Version

1.5.5

How to Reproduce?

如果尝试在ExpandSettingCard的viewLayout中添加FlowLayout,在某些情况下ExpandSettingCard会无法显示所有控件
picture

Minimum code

from PyQt5.QtWidgets import QApplication, QVBoxLayout
from qfluentwidgets import *
from qframelesswindow import *
import sys
from PyQt5.QtGui import *
from PyQt5.QtCore import *


class CustomSettingCard(ExpandSettingCard):
    def __init__(self, icon, parent=None):
        super().__init__(icon, "标题", "子标题", parent)
        layout = FlowLayout()
        for i in range(15):
            chk = CheckBox()
            chk.setText(f"chk{i}")
            layout.addWidget(chk)

        self.viewLayout.addLayout(layout)
        self.viewLayout.setContentsMargins(8, 18, 24, 18)
        self._adjustViewSize()


class MainWindow(FramelessWindow):
    def __init__(self):
        super().__init__()
        self.setTitleBar(StandardTitleBar(self))
        self.titleBar.setAttribute(Qt.WA_StyledBackground)
        self.setWindowTitle("MainWindow")
        self.setGeometry(800, 300, 400, 400)
        layout = QVBoxLayout(self)
        card = CustomSettingCard(FluentIcon.HOME, self)
        layout.addWidget(card)

app = QApplication(sys.argv)
w = MainWindow()
w.show()
app.exec()
@gcc2001 gcc2001 added the bug Something isn't working label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant