当前位置: PyQt5> Qt Designer安装及使用教程> Qt Designer控件及布局操作

Qt Designer控件及布局操作

2021年4月22日 02:36 900浏览 PyQt5中文网 Qt Designer安装及使用教程

Qt Designer控件及布局操作

def setupUi(self, Form):
    Form.setObjectName("Form")
    Form.resize(605, 432)
    self.pushButton = QtWidgets.QPushButton(Form)
    self.pushButton.setGeometry(QtCore.QRect(70, 150, 311, 41))
    self.pushButton.setStyleSheet("color: rgb(85, 255, 0);\n"
                                  "background-image: url(:/source/login.png);")
    self.pushButton.setText("")
    self.pushButton.setObjectName("pushButton")
    self.layoutWidget = QtWidgets.QWidget(Form)
    self.layoutWidget.setGeometry(QtCore.QRect(120, 60, 195, 48))
    self.layoutWidget.setObjectName("layoutWidget")
    self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget)
    self.gridLayout.setContentsMargins(0, 0, 0, 0)
    self.gridLayout.setObjectName("gridLayout")
    self.label = QtWidgets.QLabel(self.layoutWidget)
    self.label.setObjectName("label")
    self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
    self.lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
    self.lineEdit.setObjectName("lineEdit")
    self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1)
    self.label_2 = QtWidgets.QLabel(self.layoutWidget)
    self.label_2.setObjectName("label_2")
    self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
    self.lineEdit_2 = QtWidgets.QLineEdit(self.layoutWidget)
    self.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.Password)
    self.lineEdit_2.setObjectName("lineEdit_2")
    self.gridLayout.addWidget(self.lineEdit_2, 1, 1, 1, 1)

    self.retranslateUi(Form)
    QtCore.QMetaObject.connectSlotsByName(Form)

def retranslateUi(self, Form):
    _translate = QtCore.QCoreApplication.translate
    Form.setWindowTitle(_translate("Form", "Form"))
    self.label.setText(_translate("Form", "账号:"))
    self.label_2.setText(_translate("Form", "密码:"))


标签栏目

炫酷界面