我正在尝试在我正在编写的应用程序中移动布局。对于使用函数 move 的小部件,我尝试了以下操作,但无法正常工作:
布局代码:
self.layoutWidget_3 = QtGui.QWidget(Dialog)
self.layoutWidget_3.setGeometry(QtCore.QRect(420, 346, 158, 32))
self.layoutWidget_3.setObjectName(_fromUtf8("layoutWidget_3"))
self.horizontalLayout_4 = QtGui.QHBoxLayout(self.layoutWidget_3)
self.horizontalLayout_4.setMargin(0)
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
self.OK_btn = QtGui.QPushButton(self.layoutWidget_3)
font = QtGui.QFont()
font.setFamily(_fromUtf8("Times New Roman"))
font.setPointSize(12)
self.OK_btn.setFont(font)
self.OK_btn.setStyleSheet(_fromUtf8(""))
self.OK_btn.setAutoDefault(False)
self.OK_btn.setObjectName(_fromUtf8("OK_btn"))
self.horizontalLayout_4.addWidget(self.OK_btn)
self.Cancel_btn = QtGui.QPushButton(self.layoutWidget_3)
font = QtGui.QFont()
font.setFamily(_fromUtf8("Times New Roman"))
font.setPointSize(12)
self.Cancel_btn.setFont(font)
self.Cancel_btn.setAutoDefault(False)
self.Cancel_btn.setObjectName(_fromUtf8("Cancel_btn"))
self.horizontalLayout_4.addWidget(self.Cancel_btn)
移动代码
#index is an integer
self.ui.horizontalLayout_4.setGeometry(QtCore.QRect(420, 346+5*index, 158, 32))