首页 > 其他 > 详细

About UE4.24 Qt

时间:2020-08-27 17:32:23      阅读:77      评论:0      收藏:0      [点我收藏+]

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_()

 

About UE4.24 Qt

原文:https://www.cnblogs.com/sunchuankai/p/13572325.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!