{"id":984,"date":"2023-11-24T07:40:33","date_gmt":"2023-11-24T07:40:33","guid":{"rendered":"http:\/\/robinluo.top\/?p=984"},"modified":"2023-12-02T10:31:33","modified_gmt":"2023-12-02T10:31:33","slug":"qt-designer-%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/robinluo.top\/?p=984","title":{"rendered":"QT designer \u4f7f\u7528"},"content":{"rendered":"\n<p>\u4f7f\u7528QT designer\u4f1a\u751f\u6210\u4e00\u7cfb\u5217ui\u540e\u7f00\u6587\u4ef6<\/p>\n\n\n\n<p>\u901a\u8fc7pyuic\u53ef\u4ee5\u5c06ui\u6587\u4ef6\u8f6c\u5316\u4e3apy\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python -m PyQt5.uic.pyuic 1.ui -o 1.py\npyuic5 1.ui -o 1.py\npyside6-uic form.ui -o ui_form.py\n<\/code><\/pre>\n\n\n\n<p>\u628a1.ui \u8f6c\u6362\u4e3a 1.py<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class MainForm(QtWidgets.QMainWindow):\n\tdef __init__(self,parent=None):\n\t\tsuper(MainForm,self).__init__(parent)\n\t\t__content = Ui_MainWindow.Ui_MainWindow()\n\t\t__content.setupUi(self)\n\t\t\n\t\n\nif  __name__ == \"__main__\" :\n\ttry: \n\t\tprint('start')\n\t\t__app = QtWidgets.QApplication(sys.argv) \n\t\t__win = MainForm()\n\t\t__win .show()\n\t\tsys.exit(__app.exec_())\n\texcept KeyboardInterrupt :\n\t\tprint('destroy')<\/code><\/pre>\n\n\n\n<p>__content = Ui_MainWindow.Ui_MainWindow()<\/p>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u53ef\u4ee5\u6362\u6210\u4e0d\u540c\u7684UI generate\u7684\u4ee3\u7801 \u5c31\u53ef\u4ee5 \u5207\u6362ui\u6587\u4ef6 \u770b\u6548\u679c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528QT designer\u4f1a\u751f\u6210\u4e00\u7cfb\u5217ui\u540e\u7f00\u6587\u4ef6 \u901a\u8fc7pyuic\u53ef\u4ee5\u5c06ui\u6587\u4ef6\u8f6c\u5316\u4e3apy\u6587\u4ef6 \u628a1.ui \u8f6c\u6362\u4e3a 1.py __content = Ui_MainWindow.Ui_MainWindow() \u8fd9\u6bb5\u4ee3\u7801\u53ef\u4ee5\u6362\u6210\u4e0d\u540c\u7684UI generate\u7684\u4ee3\u7801 \u5c31\u53ef\u4ee5 \u5207\u6362ui\u6587\u4ef6 \u770b\u6548\u679c<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[156],"_links":{"self":[{"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/posts\/984"}],"collection":[{"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robinluo.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=984"}],"version-history":[{"count":6,"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/posts\/984\/revisions"}],"predecessor-version":[{"id":998,"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/posts\/984\/revisions\/998"}],"wp:attachment":[{"href":"https:\/\/robinluo.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robinluo.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robinluo.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}