Closed XiaoYouChR closed 2 months ago
在 PFW 的 ExpandLayout 中的 __doLayout 函数中 y 值的计算似乎被意外地加上了 margin.bottom() , 导致了整体控件的向下偏移
ExpandLayout
__doLayout
margin.bottom()
Manjaro Linux 6.9.12-1-MANJARO X11
3.11.9 64-bit
PySide6 6.7.2
v1.6.0
ExpandLayout 里的控件明显向下偏
from PySide6.QtWidgets import QApplication, QWidget, QHBoxLayout, QFrame from qfluentwidgets import ExpandLayout, ScrollArea, PrimaryPushButton, PushButton, MSFluentWindow, \ TitleLabel, CardWidget from qfluentwidgets import FluentIcon as FIF class MainWindow(MSFluentWindow): def __init__(self, parent=None): super().__init__(parent) self.setWindowTitle("Fluent Window") self.setMinimumSize(800, 600) self.homeInterface = HomeInterface(self) self.addSubInterface(self.homeInterface, FIF.HOME, "Home") class HomeInterface(ScrollArea): def __init__(self, parent=None): super().__init__(parent) self.setObjectName("homeInterface") self.setupUi() self.setWidget(self.scrollWidget) def setupUi(self): self.setFrameShape(QFrame.NoFrame) self.scrollWidget = QWidget() self.scrollWidget.setObjectName("scrollWidget") self.expandLayout = ExpandLayout(self.scrollWidget) self.expandLayout.setObjectName("expandLayout") self.expandLayout.setSpacing(0) print(self.expandLayout.contentsMargins()) # TaskCard self.taskCard = CardWidget(self.scrollWidget) self.taskCard.setObjectName("taskCard") self.taskCard.setMinimumSize(300, 100) self.expandLayout.addWidget(self.taskCard) # ToolsBar self.toolsBar = QWidget(self.scrollWidget) self.toolsBar.setObjectName("toolsBar") self.toolsBar.resize(447, 60) self.horizontalLayout = QHBoxLayout(self.toolsBar) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.toolsBar.setLayout(self.horizontalLayout) self.allStartButton = PrimaryPushButton(self.toolsBar) self.allStartButton.setObjectName(u"allStartButton") self.allStartButton.setIcon(FIF.PLAY) self.horizontalLayout.addWidget(self.allStartButton) self.allPauseButton = PushButton(self.toolsBar) self.allPauseButton.setObjectName(u"allPauseButton") self.allPauseButton.setIcon(FIF.STOP_WATCH) self.horizontalLayout.addWidget(self.allPauseButton) self.expandLayout.addWidget(self.toolsBar) self.noTaskLabel = TitleLabel("NoTask", self.scrollWidget) self.noTaskLabel.setObjectName("noTaskLabel") self.expandLayout.addWidget(self.noTaskLabel) self.scrollWidget.setMinimumWidth(600) if __name__ == "__main__": import sys app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec())
已修复此问题
What happened?
在 PFW 的
ExpandLayout
中的__doLayout
函数中 y 值的计算似乎被意外地加上了margin.bottom()
, 导致了整体控件的向下偏移Operation System
Manjaro Linux 6.9.12-1-MANJARO X11
Python Version
3.11.9 64-bit
PyQt/PySide Version
PySide6 6.7.2
PyQt/PySide-Fluent-Widgets Version
v1.6.0
How to Reproduce?
ExpandLayout
里的控件明显向下偏Minimum code