我正在尝试创建登录窗口,该窗口在QLabel下具有QLineEdit,但是当前的QLabel在Window中占用了太多空间,我不知道为什么,这是图片:
QLabel { background-color: red; }
我的代码:
self.text = QLabel("LOGIN")
# self.text.setStyleSheet("QLabel { background-color: red; color : white;margin-top: 50px;margin-bottom: 0px; }")
self.text.setAlignment(Qt.AlignCenter)
# self.text.setContentsMargins(0, 0, 0, 0)
# self.text.setGeometry(QRect(10,10,30,80))
font = QFont("Sans-Serif", 30)
self.text.setFont(font)
form = QLineEdit("Write my name here..")
form.setAlignment(Qt.AlignCenter)
# form.setAlignment(Qt.AlignHCenter)
self.layout = QVBoxLayout()
# self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setSpacing(0)
self.layout.addWidget(self.text)
self.layout.addWidget(form)
self.layout.addWidget(self.button)
self.setLayout(self.layout)
我正在尝试创建登录窗口,该窗口在QLabel下具有QLineEdit,但是当前的QLabel在Window中占用了太多空间,我不知道为什么,这是图片:QLabel {background-color:red; } ...
我看不到OP提供的代码与要从中复制结构的LOGIN窗口之间的关系,因此请从头开始创建以下代码。