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

[Bug]: LineEdit和PushButton设置最小尺寸,放在QHBoxLayout中,出现不对齐现象 #1011

Open
yuhou0814 opened this issue Nov 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@yuhou0814
Copy link

What happened?

Operation System

win10

Python Version

3.9

PyQt/PySide Version

PyQt5-Qt5 5.15.2

PyQt/PySide-Fluent-Widgets Version

V1.7.1

How to Reproduce?

12234

Minimum code

class test1(QWidget):
    def __init__(self):
        super().__init__()
        self.line=LineEdit(self)
        self.ptn=PushButton('123',self)
        self.label=QLabel("sadfa",self)
        self.space_item=QSpacerItem(10,10,QSizePolicy.Minimum,QSizePolicy.Minimum)
        
        self.h_layout=QHBoxLayout()
        self.h_layout.addItem(self.space_item)
        self.h_layout.addWidget(self.label)
        self.h_layout.addItem(self.space_item)
        self.h_layout.addWidget(self.line,Qt.AlignCenter)
        self.h_layout.addItem(self.space_item)
        self.h_layout.addWidget(self.ptn,Qt.AlignCenter)
        self.h_layout.addItem(self.space_item)
        self.g_layout=QGridLayout()
        for i in [self.line,self.ptn,self.label]:
            i.setMinimumSize(50,40)
        self.setLayout(self.g_layout)
        self.g_layout.addLayout(self.h_layout,0,0,1,2)

        for i,factor in enumerate([2,3,1,8,1,2,4]):
            self.h_layout.setStretch(i,factor)
        self.resize(100, 100)
if __name__ == '__main__':
    app = QApplication(sys.argv)
    test=test1()
    test.show()
  
    
    sys.exit(app.exec_())



版本```python
Name: PyQt-Fluent-Widgets
Version: 1.7.1
Summary: A fluent design widgets library based on PyQt5
Home-page: https://qfluentwidgets.com
Author: zhiyiYo
Author-email: shokokawaii@outlook.com
License: GPLv3
Location: e:\anaconda3\envs\pytorch529\lib\site-packages
Requires: darkdetect, PyQt5, PyQt5-Frameless-Window
Required-by:
@yuhou0814 yuhou0814 added the bug Something isn't working label Nov 19, 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