About UE4.24 Qt
4.24只有python27没有3.X,所以byebye PySide2 :XX,改用PySide
Framework:
这边假设已经设计好UI并且转换为py文件:
class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(647, 161) Dialog.setMinimumSize(QtCore.QSize(647, 161)) Dialog.setMaximumSize(QtCore.QSize(647, 161)) Dialog.setBaseSize(QtCore.QSize(647, 161)) self.FileButton = QtGui.QPushButton(Dialog) self.FileButton.setGeometry(QtCore.QRect(530, 20, 75, 23)) self.FileButton.setObjectName("FileButton") self.PathEdit = QtGui.QLineEdit(Dialog) self.PathEdit.setGeometry(QtCore.QRect(20, 20, 491, 20)) self.PathEdit.setObjectName("PathEdit") self.DeleteButton = QtGui.QPushButton(Dialog) self.DeleteButton.setGeometry(QtCore.QRect(530, 80, 75, 23)) self.DeleteButton.setObjectName("DeleteButton") self.FrameCountBox = QtGui.QSpinBox(Dialog) self.FrameCountBox.setGeometry(QtCore.QRect(420, 80, 91, 22)) self.FrameCountBox.setMaximum(100000) self.FrameCountBox.setProperty("value", 100) self.FrameCountBox.setObjectName("FrameCountBox") self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) self.FileButton.setText(QtGui.QApplication.translate("Dialog", "文件夹目录", None, QtGui.QApplication.UnicodeUTF8)) self.DeleteButton.setText(QtGui.QApplication.translate("Dialog", "删除帧", None, QtGui.QApplication.UnicodeUTF8))
然后自己写的MainUI这边:
class MainUI(QtGui.QWidget, ui.Ui_Dialog): def __init__(self, parent= None): super(MainUI, self).__init__(parent) self.setupUi(self) self.setWindowTitle('FileDelete V1.0') self.create_context_menu() def create_context_menu(self): self.FileButton.clicked.connect(self.set_path) ... #最后main: if __name__ == '__main__': APP = None if not QtGui.QApplication.instance(): APP = QtGui.QApplication(sys.argv) main = MainUI() main.show() sys.exit(APP.exec_()) #其中如果是UE内的插件不用exec_()