{"id":80483,"date":"2026-03-05T08:33:27","date_gmt":"2026-03-05T00:33:27","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/80483.html"},"modified":"2026-03-05T08:33:27","modified_gmt":"2026-03-05T00:33:27","slug":"%e6%89%8b%e6%8a%8a%e6%89%8b%e5%b8%a6%e4%bd%a0%e7%bc%96%e5%86%99-qt-%e5%ba%94%e7%94%a8%e4%b8%bb%e7%aa%97%e4%bd%93","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/80483.html","title":{"rendered":"\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260305003325-69a8cf55abec9.png\" alt=\"\" \/><\/p>\n<p>\u672c\u6587\u7b80\u5355\u8bb0\u5f55\u4e00\u4e0b\u5728\u4e0d\u4f7f\u7528 Qt Designer \u751f\u6210 .ui \u6587\u4ef6\u7684\u60c5\u51b5\u4e0b&#xff0c;\u624b\u5199\u4e00\u4e2a\u4e3b\u7a97\u4f53\u7684\u57fa\u672c\u6d41\u7a0b&#xff0c;\u5305\u62ec&#xff1a;\u521b\u5efa\u9879\u76ee &#x1f81a; \u6dfb\u52a0 Central Widget &#x1f81a; \u8bbe\u7f6e\u5e03\u5c40 &#x1f81a; \u6dfb\u52a0\u4e3b\u4f5c\u4e1a\u533a\u63a7\u4ef6 &#x1f81a; \u6dfb\u52a0\u83dc\u5355 &#x1f81a; \u6dfb\u52a0\u5de5\u5177\u84dd &#x1f81a; \u6dfb\u52a0\u72b6\u6001\u680f\u3002 \u8fd9\u4e2a\u8fc7\u7a0b\u5bf9\u521d\u5b66\u8005\u5e2e\u52a9\u5f88\u5927&#xff0c;\u662f\u5b66\u4e60\u548c\u4f7f\u7528 Qt \u7684\u4e00\u4e2a\u6781\u597d\u5165\u95e8\u5f62\u5f0f\u3002\u9996\u5148\u4ecb\u7ecd\u4e00\u4e0b\u6211\u4eec\u8981\u521b\u5efa\u7684\u4e3b\u7a97\u4f53\u7684\u201c\u7ed3\u6784\u201d&#xff1a;<\/p>\n<ul>\n<li>\u754c\u9762\u7ed3\u6784\u6811&#xff08;\u903b\u8f91\u7ec4\u7ec7\u7ed3\u6784&#xff09;<\/li>\n<\/ul>\n<p>QMainWindow ( mainWindow )<br \/>\n   \u251c\u2500\u2500 QMenuBar ( menuBar )<br \/>\n   \u2502       \u2514\u2500\u2500 QMenu ( menuFile )<br \/>\n   \u2502              \u2514\u2500\u2500 QAction ( actionOpen )<br \/>\n   \u251c\u2500\u2500 QToolBar ( toolBar )<br \/>\n   \u2502       \u2514\u2500\u2500 QAction ( actionOpen )<br \/>\n   \u251c\u2500\u2500 QWidget ( centralWidget )<br \/>\n   \u2502       \u2514\u2500\u2500 QVBoxLayout ( verticalLayout )<br \/>\n   \u2502              \u2514\u2500\u2500 QTextEdit ( textEdit )<br \/>\n   \u2514\u2500\u2500 QStatusBar ( statusBar )<\/p>\n<p>\u8fd9\u662f\u7a97\u4f53\u4e0a\u6240\u6709\u63a7\u4ef6\u548c\u5e03\u5c40\u6309\u5b9e\u9645\u4ee3\u7801\u6392\u5e03\u51fa\u7684\u7ed3\u6784&#xff0c;\u8fd9\u79cd\u7ed3\u6784\u5e94\u8be5\u6709\u4e00\u4e2a\u4e13\u6709\u540d\u8bcd&#xff0c;\u4f46\u662f\u5f88\u9057\u61be\u5927\u5bb6\u7684\u53eb\u6cd5\u5e76\u4e0d\u7edf\u4e00&#xff0c;\u672c\u6587\u6211\u4eec\u4f1a\u4f7f\u7528\u201c\u754c\u9762\u7ed3\u6784\u6811\u201d\u6765\u6307\u4ee3\u3002\u4e0e\u6b64\u540c\u65f6&#xff0c;\u5404\u4e2a\u63a7\u4ef6\u5728\u521b\u5efa\u65f6\u8fd8\u4f1a\u8bbe\u7f6e\u81ea\u5df1\u7684 parent&#xff0c;\u4ece\u800c\u5f62\u6210\u4e00\u4e2a\u201c\u5bf9\u8c61\u6811\u201d&#xff0c;\u8fd9\u5728 Qt \u91cc\u662f\u6709\u786e\u5207\u5b9a\u4e49\u7684\u3002\u5bf9\u5e94\u4e0a\u9762\u7684\u754c\u9762\u7ed3\u6784\u6811&#xff0c;\u6211\u4eec\u5c06\u8981\u521b\u5efa\u7684\u5bf9\u8c61\u6811\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>\u5bf9\u8c61\u6811&#xff08;\u63a7\u4ef6\u751f\u547d\u5468\u671f\u7ba1\u7406\u5173\u7cfb&#xff09;<\/li>\n<\/ul>\n<p>QMainWindow ( mainWindow )<br \/>\n   \u251c\u2500\u2500 QMenuBar ( menuBar )<br \/>\n   \u2502       \u2514\u2500\u2500 QMenu ( menuFile )<br \/>\n   \u251c\u2500\u2500 QToolBar ( toolBar )<br \/>\n   \u251c\u2500\u2500 QAction ( actionOpen )<br \/>\n   \u251c\u2500\u2500 QWidget ( centralWidget )<br \/>\n   \u2502       \u2514\u2500\u2500 QTextEdit ( textEdit )<br \/>\n   \u2514\u2500\u2500 QStatusBar ( statusBar )<\/p>\n<p>\u81f3\u4e8e\u4e3a\u4ec0\u4e48\u4f1a\u5b58\u5728\u8fd9\u4e24\u79cd\u6811\u4ee5\u53ca\u5b83\u4eec\u4e4b\u95f4\u6709\u4ec0\u4e48\u533a\u522b\u548c\u8054\u7cfb&#xff0c;\u6211\u4eec\u5728\u300a\u89e3\u8bfb Qt \u201c\u5bf9\u8c61\u6811\u201d\u548c\u201c\u754c\u9762\u7ed3\u6784\u6811\u201d\u7684\u5e95\u5c42\u903b\u8f91\u300b\u4e00\u6587\u4f5c\u4e86\u4e13\u9898\u4ecb\u7ecd\u3002\u4e0b\u9762\u5c31\u5f00\u59cb\u5b9e\u9645\u7684\u4ee3\u7801\u7f16\u5199\u4e86\u3002<\/p>\n<h2>1. \u521b\u5efa\u9879\u76ee<\/h2>\n<p>\u4f7f\u7528 Qt Creator \u521b\u5efa Qt Widgets Application&#xff0c;\u8bb0\u5f97\u5728\u5411\u5bfc\u4e2d\u53d6\u6d88\u52fe\u9009\u201c\u751f\u6210 UI \u6587\u4ef6\u201d&#xff0c;\u540c\u65f6\u5728\u9009\u62e9\u6784\u5efa\u5de5\u5177\u65f6\u9009\u62e9 CMake&#xff0c;\u8fd9\u6837\u65b9\u4fbf\u540e\u7eed\u4f7f\u7528\u5176\u4ed6 IDE \u7ee7\u7eed\u7f16\u5199\u9879\u76ee\u3002\u9879\u76ee\u751f\u6210\u540e&#xff0c;\u53ef\u4ee5\u6309\u7167 C&#043;&#043; \u9879\u76ee\u7684\u9ed8\u8ba4\u89c4\u8303\u521b\u5efa incluce \u548c src \u6587\u4ef6\u5939&#xff0c;\u7136\u540e\u5c06\u81ea\u52a8\u751f\u6210\u7684\u6587\u4ef6\u79fb\u52a8\u5230\u5bf9\u5e94\u7684\u6587\u4ef6\u5939\u4e2d\u3002\u5efa\u8bae\u4f7f\u7528 CLion \u6765\u8fdb\u884c\u6b64\u6b65\u64cd\u4f5c&#xff0c;\u5b83\u4f1a\u81ea\u52a8\u91cd\u6784 CMakeLists.txt \u6587\u4ef6&#xff0c;\u4e0d\u9700\u8981\u6211\u4eec\u624b\u52a8\u4fee\u6539\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260305003326-69a8cf564cdcb.png\" alt=\"\" \/><\/p>\n<h2>2. \u6dfb\u52a0 Central Widget&#xff08;\u4f5c\u4e3a\u5e03\u5c40\u7684\u5bb9\u5668&#xff09;<\/h2>\n<p>\u9009\u62e9\u4e0d\u81ea\u52a8\u751f\u6210 UI \u6587\u4ef6\u7684\u8bdd&#xff0c;\u9879\u76ee\u7684\u521d\u59cb\u4ee3\u7801\u662f\u975e\u5e38\u7b80\u6d01\u7684&#xff0c;\u9664\u4e86\u4e3b\u7a97\u4f53\u7684\u7c7b\u548c\u58f0\u660e\u5916&#xff0c;\u51e0\u4e4e\u6ca1\u6709\u4efb\u4f55\u5185\u5bb9&#xff0c;\u56e0\u6b64&#xff0c;\u7b2c\u4e00\u4ef6\u4e8b\u662f&#xff1a;\u6dfb\u52a0centralWidget\u3002centralWidget \u662f\u4e00\u4e2a plain QWidget&#xff0c;\u6ca1\u6709\u4efb\u4f55\u663e\u793a\u4efb\u52a1\u548c\u903b\u8f91&#xff0c;\u5b83\u552f\u4e00\u4f5c\u7528\u5c31\u662f&#xff1a;\u6211\u4eec\u60f3\u628a\u7a97\u4f53\u4e2d\u5fc3\u90e8\u5206\u7684\u5e03\u5c40\u8bbe\u7f6e\u4e3a\u5782\u76f4\u5e03\u5c40&#xff0c;\u4f46\u5e03\u5c40\u5fc5\u987b\u4f9d\u9644\u4e8e\u4e00\u4e2a QWidget&#xff0c;\u56e0\u6b64\u9700\u8981\u5148\u6dfb\u52a0\u4e00\u4e2a centralWidget&#xff0c;\u628a\u5b83\u7684\u5e03\u5c40\u8bbe\u4e3a\u5782\u76f4\u5e03\u5c40&#xff0c;\u5173\u4e8e\u8fd9\u91cc\u7684\u8be6\u7ec6\u89e3\u91ca&#xff0c;\u53ef\u4ee5\u53c2\u8003&lt;&gt;\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u4ee3\u7801&#xff0c;\u5728\u5934\u6587\u4ef6\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token keyword\">private<\/span><span class=\"token operator\">:<\/span><br \/>\n    QWidget <span class=\"token operator\">*<\/span>centralWidget<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5728\u4e3b\u7a97\u4f53\u7684\u6784\u9020\u51fd\u6570\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0 Central Widget<\/span><br \/>\ncentralWidget<span class=\"token operator\">&#061;<\/span><span class=\"token keyword\">new<\/span> <span class=\"token function\">QWidget<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\ncentralWidget<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setObjectName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;centralWidget&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">this<\/span><span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setCentralWidget<\/span><span class=\"token punctuation\">(<\/span>centralWidget<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h2>3. \u8bbe\u7f6e\u5e03\u5c40&#xff08;\u8bbe\u7f6e Central Widget \u7684 Layout&#xff09;<\/h2>\n<p>\u5982\u524d\u6240\u8ff0&#xff0c;\u6211\u4eec\u60f3\u8981\u7684\u7a97\u4f53\u4e2d\u5fc3\u90e8\u5206\u7684\u5e03\u5c40\u5fc5\u987b\u201c\u6302\u9760\u201d\u5230 Central Widget \u4e0a\u7684&#xff0c;\u6240\u4ee5\u6211\u4eec\u521b\u5efa\u51fa\u9700\u8981\u7684 Layout \u540e set \u7ed9 centralWidget \u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e86\u3002\u5728\u5934\u6587\u4ef6\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token keyword\">private<\/span><span class=\"token operator\">:<\/span><br \/>\n    QVBoxLayout <span class=\"token operator\">*<\/span>verticalLayout<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5728\u4e3b\u7a97\u4f53\u7684\u6784\u9020\u51fd\u6570\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u8bbe\u7f6e\u5e03\u5c40<\/span><br \/>\nverticalLayout <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token function\">QVBoxLayout<\/span><span class=\"token punctuation\">(<\/span>centralWidget<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6307\u5b9a\u4e86 parent \u5c31\u7b49\u540c\u4e8e parent.setLayout<\/span><br \/>\nverticalLayout<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setObjectName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;verticalLayout&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/ \u4e0b\u9762\u8fd9\u884c\u4ee3\u7801\u662f\u53ef\u4ee5\u79fb\u9664\u7684&#xff0c;\u56e0\u4e3a&#xff1a;<\/span><br \/>\n<span class=\"token comment\">\/\/ \u5728 new QVBoxLayout(centralWidget) \u65f6\u6307\u5b9a\u4e86 parent&#xff0c;\u4e14 parent \u8fd8\u6ca1\u6709 Layout \u7684\u60c5\u51b5\u4e0b&#xff0c;<\/span><br \/>\n<span class=\"token comment\">\/\/ new \u51fa\u6765\u7684 layout \u4f1a\u81ea\u52a8\u88ab parent \u8bbe\u7f6e\u4e3a layout!!<\/span><br \/>\ncentralWidget<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setLayout<\/span><span class=\"token punctuation\">(<\/span>verticalLayout<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h2>4. \u6dfb\u52a0\u4e00\u4e2a\u4e3b\u63a7\u4ef6<\/h2>\n<p>\u5728\u5934\u6587\u4ef6\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token keyword\">private<\/span><span class=\"token operator\">:<\/span><br \/>\n    QTextEdit <span class=\"token operator\">*<\/span>textEdit<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5728\u4e3b\u7a97\u4f53\u7684\u6784\u9020\u51fd\u6570\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u4e00\u4e2a\u4e3b\u63a7\u4ef6<\/span><br \/>\ntextEdit <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token function\">QTextEdit<\/span><span class=\"token punctuation\">(<\/span>centralWidget<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6ce8\u610f&#xff1a;\u5b50\u63a7\u4ef6\u548c\u7236\u63a7\u4ef6\u7684\u201c\u7ed1\u5b9a\u201d\u662f\u901a\u8fc7\u8bbe\u7f6e\u5b50\u63a7\u4ef6\u7684 parent \u5b8c\u6210\u7684<\/span><br \/>\ntextEdit<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setObjectName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;textEdit&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nverticalLayout<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">addWidget<\/span><span class=\"token punctuation\">(<\/span>textEdit<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6ce8\u610f&#xff1a;\u5e03\u5c40\u548c\u5b50\u63a7\u4ef6\u7684\u201c\u7ed1\u5b9a\u201d\u662f\u901a\u8fc7\u5e03\u5c40\u7684 addWidget() \u5b8c\u6210\u7684<\/span><\/p>\n<h2>5. \u6dfb\u52a0\u83dc\u5355<\/h2>\n<p>\u6dfb\u52a0\u4e00\u4e2a\u5177\u5907\u70b9\u51fb\u4e8b\u4ef6\u54cd\u5e94\u80fd\u529b\u7684\u83dc\u5355\u9879\u9700\u8981\u4f9d\u6b21\u5b8c\u6210&#xff1a;\u6dfb\u52a0\u83dc\u5355\u680f &#x1f81a; \u6dfb\u52a0\u83dc\u5355 &#x1f81a; \u6dfb\u52a0\u83dc\u5355\u9879 &#x1f81a; \u5173\u8054\u4e8b\u4ef6\u54cd\u5e94\u51fd\u6570 \u5171\u56db\u7ea7\u8054\u52a8\u64cd\u4f5c&#xff0c;\u7531\u4e8e\u5173\u7cfb\u7d27\u5bc6&#xff0c;\u6211\u4eec\u5c31\u653e\u5728\u4e00\u8d77\u4ecb\u7ecd\u3002\u5728\u83dc\u5355\u7684\u6dfb\u52a0\u548c\u914d\u7f6e\u8fc7\u7a0b\u4e2d\u8981\u7279\u522b\u6ce8\u610f\u201c\u5bf9\u8c61\u6811\u201d\u548c\u201c\u754c\u9762\u7ed3\u6784\u6811\u201d\u4e24\u4e2a\u6982\u5ff5&#xff0c;\u8981\u80fd\u6e05\u6670\u5730\u77e5\u9053&#xff1a;\u5728\u5b50\u63a7\u4ef6\u4e2d\u8bbe\u7f6e parent \u548c\u5728\u7236\u63a7\u4ef6\u4e2d add \u5b50\u63a7\u4ef6\u7684\u533a\u522b&#xff0c;\u7531\u4e8e\u8fd9\u4e2a\u8bdd\u9898\u6709\u4e00\u4e9b\u590d\u6742&#xff0c;\u6211\u4eec\u5728\u300a\u89e3\u8bfb Qt \u5bf9\u8c61\u6811\u548c\u754c\u9762\u7ed3\u6784\u6811\u7684\u5e95\u5c42\u903b\u8f91\u300b\u4e00\u6587\u4e2d\u8fdb\u884c\u4e86\u4e13\u9898\u4ecb\u7ecd&#xff0c;\u672c\u6587\u5c31\u4e0d\u518d\u590d\u8ff0&#xff0c;\u76f4\u63a5\u770b\u5b9e\u73b0\u4ee3\u7801\u3002<\/p>\n<h3>5a. \u5c55\u5f00\u5f0f\u7f16\u5199<\/h3>\n<p>\u5c55\u5f00\u5f0f\u7f16\u5199\u662f\u6307\u6309&#xff1a;\u201c\u65b0\u5efa &#x1f81a; \u8bbe\u7f6e\u5c5e\u6027 &#x1f81a; \u5173\u8054\u5230\u7236\u63a7\u4ef6\u201d\u7684\u987a\u5e8f\u9010\u884c\u7f16\u5199\u4ee3\u7801&#xff0c;\u4f7f\u7528 Qt Designer \u8bbe\u8ba1\u7a97\u4f53\u65f6&#xff0c;\u7ecf MOC \u7f16\u8bd1\u751f\u6210\u7684 UI \u7c7b\u901a\u5e38\u662f\u8fd9\u79cd\u5c55\u5f00\u98ce\u683c\u3002<\/p>\n<p>\u5728\u5934\u6587\u4ef6\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token keyword\">private<\/span><span class=\"token operator\">:<\/span><br \/>\n    QMenuBar <span class=\"token operator\">*<\/span>menuBar<span class=\"token punctuation\">;<\/span><br \/>\n    QMenu <span class=\"token operator\">*<\/span>menuFile<span class=\"token punctuation\">;<\/span><br \/>\n    QAction <span class=\"token operator\">*<\/span>actionOpen<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5728\u4e3b\u7a97\u4f53\u7684\u6784\u9020\u51fd\u6570\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u83dc\u5355\u680f\u201d<\/span><br \/>\nmenuBar <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token function\">QMenuBar<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6ce8\u610f&#xff1a;\u8bbe\u7f6e parent&#xff0c;\u52a0\u5165\u201c\u5bf9\u8c61\u6811\u201d&#xff0c;\u4f46\u5e76\u4e0d\u610f\u5473\u7740\u5df2\u7ecf\u6210\u4e3a\u4e3b\u7a97\u4f53\u7684\u83dc\u5355\u680f&#xff0c;setMenuBar \u624d\u662f\u5173\u952e<\/span><br \/>\nmenuBar<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setObjectName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;menuBar&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">setMenuBar<\/span><span class=\"token punctuation\">(<\/span>menuBar<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5173\u952e\u52a8\u4f5c&#xff0c;\u52a0\u5165\u201c\u754c\u9762\u7ed3\u6784\u6811\u201d&#xff0c;\u5426\u5219\u4e0d\u4f1a\u663e\u793a\u83dc\u5355\u680f<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u83dc\u5355\u201d<\/span><br \/>\nmenuFile <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token function\">QMenu<\/span><span class=\"token punctuation\">(<\/span>menuBar<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6ce8\u610f&#xff1a;\u8bbe\u7f6e parent&#xff0c;\u52a0\u5165\u201c\u5bf9\u8c61\u6811\u201d&#xff0c;\u4f46\u5e76\u4e0d\u610f\u5473\u7740\u5df2\u7ecf\u6210\u4e3a\u83dc\u5355\u680f\u4e2d\u7684\u83dc\u5355&#xff0c;addMenu \u624d\u662f\u5173\u952e<\/span><br \/>\nmenuFile<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setObjectName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;menuFile&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nmenuFile<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setTitle<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">tr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&amp;File&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nmenuBar<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">addMenu<\/span><span class=\"token punctuation\">(<\/span>menuFile<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5173\u952e\u52a8\u4f5c&#xff0c;\u52a0\u5165\u201c\u754c\u9762\u7ed3\u6784\u6811\u201d&#xff0c;\u5426\u5219\u4e0d\u4f1a\u663e\u793a\u83dc\u5355<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u83dc\u5355\u9879\u201d (QAction)<\/span><br \/>\nactionOpen <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token function\">QAction<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6ce8\u610f&#xff1a;QAction \u7684 parent \u901a\u5e38\u4e0d\u4f1a\u8bbe\u4e3a\u83dc\u5355\u9879\u6216\u5de5\u5177\u680f\u6309\u94ae&#xff01;<\/span><br \/>\nactionOpen<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setObjectName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;actionOpen&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nactionOpen<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setText<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">tr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&amp;Open&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nmenuFile<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">addAction<\/span><span class=\"token punctuation\">(<\/span>actionOpen<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5173\u952e\u52a8\u4f5c&#xff0c;\u52a0\u5165\u201c\u754c\u9762\u7ed3\u6784\u6811\u201d&#xff0c;\u5426\u5219\u4e0d\u4f1a\u663e\u793a\u83dc\u5355\u9879<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u8bbe\u7f6e\u83dc\u5355\u9879\u70b9\u51fb\u52a8\u4f5c\u7684\u201c\u54cd\u5e94\u51fd\u6570\u201d&#xff08;\u5173\u8054\u4fe1\u53f7\u548c\u69fd&#xff09;<\/span><br \/>\n<span class=\"token function\">connect<\/span><span class=\"token punctuation\">(<\/span>actionOpen<span class=\"token punctuation\">,<\/span><span class=\"token operator\">&amp;<\/span>QAction<span class=\"token double-colon punctuation\">::<\/span>triggered<span class=\"token punctuation\">,<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&amp;<\/span>MainWindow<span class=\"token double-colon punctuation\">::<\/span>open<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/ \u5907\u6ce8&#xff1a;QAction \u81ea\u8eab\u6ca1\u6709\u201c\u8bbe\u7f6e slot \u51fd\u6570\u201d\u7684\u65b9\u6cd5&#xff0c;\u53ea\u80fd\u901a\u8fc7 connect \u65b9\u6cd5\u5b9e\u73b0<\/span><\/p>\n<h3>5b. \u5185\u8054\u5f0f\u7f16\u5199<\/h3>\n<p>\u5c55\u5f00\u5f0f\u7f16\u5199\u867d\u7136\u6e05\u6670\u660e\u4e86&#xff0c;\u4f46\u4ee3\u7801\u884c\u6570\u591a&#xff0c;\u5199\u8d77\u6765\u5f88\u62d6\u6c93&#xff0c;\u624b\u5199\u4ee3\u7801\u65f6\u4e00\u822c\u4e0d\u4f7f\u7528\u8fd9\u79cd\u98ce\u683c&#xff0c;\u800c\u662f\u4f7f\u7528\u5185\u8054\u98ce\u683c\u7f16\u5199\u3002\u4ee5\u4e0b\u662f\u793a\u4f8b\u4ee3\u7801&#xff1a;<\/p>\n<p>\u5728\u5934\u6587\u4ef6\u4e2d\u6dfb\u52a0&#xff08;\u4e0d\u518d\u6709 menuBar)&#xff1a;<\/p>\n<p><span class=\"token keyword\">private<\/span><span class=\"token operator\">:<\/span><br \/>\n    QMenu <span class=\"token operator\">*<\/span>menuFile<span class=\"token punctuation\">;<\/span><br \/>\n    QAction <span class=\"token operator\">*<\/span>actionOpen<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5728\u4e3b\u7a97\u4f53\u7684\u6784\u9020\u51fd\u6570\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u83dc\u5355\u680f\u201d<\/span><br \/>\n<span class=\"token comment\">\/\/ \u65e0\u9700\u663e\u5f0f\u521b\u5efa\u548c\u8bbe\u7f6e\u201c\u83dc\u5355\u680f\u201d&#xff0c;\u5728\u4f7f\u7528 menuBar() \u65f6\u4f1a\u81ea\u52a8\u521b\u5efa\u548c\u8bbe\u7f6e<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u83dc\u5355\u201d<\/span><br \/>\n<span class=\"token comment\">\/\/ \u4e00\u6b65\u5b9e\u73b0 menu \u7684\u521b\u5efa\u3001\u52a0\u5165\u5bf9\u8c61\u6811\u3001\u52a0\u5165\u754c\u9762\u7ed3\u6784\u6811<\/span><br \/>\nmenuFile <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">menuBar<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">-&gt;<\/span><span class=\"token function\">addMenu<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">tr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&amp;File&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u83dc\u5355\u9879\u201d (QAction)<\/span><br \/>\n<span class=\"token comment\">\/\/ \u4e00\u6b65\u5b9e\u73b0 action \u7684\u521b\u5efa\u3001\u52a0\u5165\u5bf9\u8c61\u6811\u3001\u52a0\u5165\u754c\u9762\u7ed3\u6784\u6811<\/span><br \/>\nactionOpen <span class=\"token operator\">&#061;<\/span> menuFile<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">addAction<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">tr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&amp;Open&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&amp;<\/span>MainWindow<span class=\"token double-colon punctuation\">::<\/span>open<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5728\u4e00\u7248\u4e2d&#xff0c;\u6211\u4eec\u53ea\u4f7f\u7528\u4e00\u884c\u4ee3\u7801\u5c31\u5b9e\u73b0\u4e86\u63a7\u4ef6\u7684\u521b\u5efa\u3001\u52a0\u5165\u5bf9\u8c61\u6811\u3001\u52a0\u5165\u754c\u9762\u7ed3\u6784\u6811\u3002\u4f46\u662f\u8fd9\u6709\u4e00\u4e2a\u5c0f\u7ec6\u8282\u8981\u63d0\u4e00\u4e0b&#xff1a;actionOpen \u7684 parent \u4f1a\u88ab\u81ea\u52a8\u8bbe\u7f6e\u4e3a menuFile&#xff0c;\u8fd9\u5e76\u4e0d\u89c4\u8303&#xff0c;\u5728\u4e0a\u4e00\u8282\u7684\u5c55\u5f00\u5f0f\u7f16\u5199\u65f6&#xff0c;\u6211\u4eec\u662f\u628a\u5b83\u8bbe\u7ed9\u4e3b\u7a97\u4f53\u7684&#xff0c;\u4f46\u8fd9\u91cc\u7684 addAction \u63a5\u53e3\u6ca1\u6709\u63d0\u4f9b\u4e00\u4e2a\u53c2\u6570\u7ed9 action \u6307\u5b9a parent\u3002\u8fd9\u662f Qt \u82e5\u5e72\u8bbe\u8ba1\u201c\u6bdb\u523a\u201d\u4e2d\u7684\u4e00\u4e2a\u5c0f\u4f8b\u5b50\u3002<\/p>\n<h2>6. \u6dfb\u52a0\u5de5\u5177\u680f<\/h2>\n<p>\u5de5\u5177\u680f\u7684\u521b\u5efa\u548c\u6dfb\u52a0\u548c\u83dc\u5355\u680f\u6709\u5f88\u591a\u76f8\u4f3c\u4e4b\u5904&#xff0c;\u4e5f\u6709\u5c55\u5f00\u548c\u5185\u8054\u4e24\u79cd\u7f16\u5199\u98ce\u683c&#xff0c;\u6211\u4eec\u540e\u6587\u5c06\u5168\u90e8\u4f7f\u7528\u5185\u8054\u98ce\u683c\u3002\u4ee5\u4e0b\u662f\u793a\u4f8b\u4ee3\u7801&#xff1a;<\/p>\n<p>\u5728\u5934\u6587\u4ef6\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token keyword\">private<\/span><span class=\"token operator\">:<\/span><br \/>\n    QToolBar <span class=\"token operator\">*<\/span>toolBar<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5728\u4e3b\u7a97\u4f53\u7684\u6784\u9020\u51fd\u6570\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u5de5\u5177\u680f\u201d<\/span><br \/>\ntoolBar <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token function\">QToolBar<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6ce8\u610f&#xff1a;\u8bbe\u7f6e parent&#xff0c;\u52a0\u5165\u201c\u5bf9\u8c61\u6811\u201d&#xff0c;\u4f46\u5e76\u4e0d\u610f\u5473\u7740\u5df2\u7ecf\u6210\u4e3a\u5de5\u5177\u680f&#xff0c;addToolBar \u624d\u662f\u5173\u952e<\/span><br \/>\ntoolBar<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">setObjectName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;toolBar&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token function\">addToolBar<\/span><span class=\"token punctuation\">(<\/span>Qt<span class=\"token double-colon punctuation\">::<\/span>ToolBarArea<span class=\"token double-colon punctuation\">::<\/span>TopToolBarArea<span class=\"token punctuation\">,<\/span> toolBar<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u5173\u952e\u52a8\u4f5c&#xff0c;\u52a0\u5165\u201c\u754c\u9762\u7ed3\u6784\u6811\u201d&#xff0c;\u5426\u5219\u4e0d\u4f1a\u663e\u793a\u5de5\u5177\u680f<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u5de5\u5177\u6309\u94ae\u201d<\/span><br \/>\n<span class=\"token comment\">\/\/ \u4e00\u6b65\u5b9e\u73b0 action \u7684\u521b\u5efa\u3001\u52a0\u5165\u5bf9\u8c61\u6811\u3001\u52a0\u5165\u754c\u9762\u7ed3\u6784\u6811<\/span><br \/>\ntoolBar<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">addAction<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">tr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&amp;Open&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&amp;<\/span>MainWindow<span class=\"token double-colon punctuation\">::<\/span>open<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5173\u4e8e toolBar \u9700\u8981\u89e3\u91ca\u4e00\u4e0b&#xff1a;Qt \u4e2d\u6ca1\u6709\u7c7b\u4f3c menuBar() \u7684 toolBar()&#xff0c;\u56e0\u4e3a Qt \u5141\u8bb8\u4e00\u4e2a\u7a97\u53e3\u6709\u591a\u4e2a toolBar&#xff0c;\u4f46\u662f QToolBar* toolBar &#061; addToolBar(&#034;My Toolbar&#034;); \u6709\u63a5\u8fd1\u4e8e menuBar() \u7684\u6548\u679c&#xff0c;\u4f46\u8fd9\u6837\u83b7\u5f97\u7684 toolBar \u8fd8\u662f\u8981\u8bbe\u7f6e\u4e00\u4e9b\u5c5e\u6027&#xff0c;\u6240\u4ee5\u6211\u4eec\u4f7f\u7528\u4e86\u5c55\u5f00\u5f0f\u98ce\u683c\u7684\u5199\u6cd5\u3002<\/p>\n<h2>7. \u6dfb\u52a0\u72b6\u6001\u680f<\/h2>\n<p>\u72b6\u6001\u680f\u7684\u6dfb\u52a0\u548c\u83dc\u5355\u680f\u6781\u4e3a\u76f8\u4f3c&#xff0c;\u4f7f\u7528 statusBar() \u8fd9\u4e2a getter \u5373\u53ef\u521b\u5efa\u6216\u83b7\u5f97\u7a97\u4f53\u7684\u72b6\u6001\u680f\u3002\u5728\u4e3b\u7a97\u4f53\u7684\u6784\u9020\u51fd\u6570\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u6dfb\u52a0\u201c\u72b6\u6001\u680f\u201d<\/span><br \/>\n<span class=\"token comment\">\/\/ \u65e0\u9700\u663e\u5f0f\u521b\u5efa\u548c\u8bbe\u7f6e\u201c\u72b6\u6001\u680f\u201d&#xff0c;\u5728\u4f7f\u7528 statusBar() \u65f6\u4f1a\u81ea\u52a8\u521b\u5efa\u548c\u8bbe\u7f6e<\/span><br \/>\n<span class=\"token function\">statusBar<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">-&gt;<\/span><span class=\"token function\">showMessage<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">tr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;This application is ready!&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u81f3\u6b64&#xff0c;\u4e00\u4e2a\u7a97\u4f53\u5e94\u7528\u7684\u57fa\u672c\u6846\u67b6\u5c31\u642d\u5efa\u5b8c\u4e86&#xff0c;\u5b8c\u6210\u7684\u7a97\u4f53\u5e94\u7528\u5982\u4e0b&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260305003326-69a8cf5685262.png\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u7b80\u5355\u8bb0\u5f55\u4e00\u4e0b\u5728\u4e0d\u4f7f\u7528 Qt Designer \u751f\u6210 .ui \u6587\u4ef6\u7684\u60c5\u51b5\u4e0b&#xff0c;\u624b\u5199\u4e00\u4e2a\u4e3b\u7a97\u4f53\u7684\u57fa\u672c\u6d41\u7a0b&#xff0c;\u5305\u62ec&#xff1a;\u521b\u5efa\u9879\u76ee &#x1f81a; \u6dfb\u52a0 Central Widget &#x1f81a; \u8bbe\u7f6e\u5e03\u5c40 &#x1f81a; \u6dfb\u52a0\u4e3b\u4f5c\u4e1a\u533a\u63a7\u4ef6 &#x1f81a; \u6dfb\u52a0\u83dc\u5355 &#x1f81a; \u6dfb\u52a0\u5de5\u5177\u84dd &#x1f81a; \u6dfb\u52a0\u72b6\u6001\u680f\u3002 \u8fd9\u4e2a\u8fc7\u7a0b\u5bf9\u521d\u5b66\u8005\u5e2e\u52a9\u5f88\u5927&#xff0c;\u662f\u5b66\u4e60\u548c\u4f7f\u7528 Qt \u7684\u4e00\u4e2a\u6781\u597d\u5165\u95e8\u5f62\u5f0f\u3002\u9996\u5148\u4ecb\u7ecd\u4e00\u4e0b\u6211\u4eec\u8981<\/p>\n","protected":false},"author":2,"featured_media":80480,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9041,9043,9044,9042,218,6205,683],"topic":[],"class_list":["post-80483","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-9041","tag-9043","tag-9044","tag-9042","tag-qt","tag-6205","tag-683"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/80483.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u7b80\u5355\u8bb0\u5f55\u4e00\u4e0b\u5728\u4e0d\u4f7f\u7528 Qt Designer \u751f\u6210 .ui \u6587\u4ef6\u7684\u60c5\u51b5\u4e0b&#xff0c;\u624b\u5199\u4e00\u4e2a\u4e3b\u7a97\u4f53\u7684\u57fa\u672c\u6d41\u7a0b&#xff0c;\u5305\u62ec&#xff1a;\u521b\u5efa\u9879\u76ee &#x1f81a; \u6dfb\u52a0 Central Widget &#x1f81a; \u8bbe\u7f6e\u5e03\u5c40 &#x1f81a; \u6dfb\u52a0\u4e3b\u4f5c\u4e1a\u533a\u63a7\u4ef6 &#x1f81a; \u6dfb\u52a0\u83dc\u5355 &#x1f81a; \u6dfb\u52a0\u5de5\u5177\u84dd &#x1f81a; \u6dfb\u52a0\u72b6\u6001\u680f\u3002 \u8fd9\u4e2a\u8fc7\u7a0b\u5bf9\u521d\u5b66\u8005\u5e2e\u52a9\u5f88\u5927&#xff0c;\u662f\u5b66\u4e60\u548c\u4f7f\u7528 Qt \u7684\u4e00\u4e2a\u6781\u597d\u5165\u95e8\u5f62\u5f0f\u3002\u9996\u5148\u4ecb\u7ecd\u4e00\u4e0b\u6211\u4eec\u8981\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/80483.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-05T00:33:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260305003325-69a8cf55abec9.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/80483.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/80483.html\",\"name\":\"\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-03-05T00:33:27+00:00\",\"dateModified\":\"2026-03-05T00:33:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/80483.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/80483.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/80483.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/80483.html","og_locale":"zh_CN","og_type":"article","og_title":"\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u672c\u6587\u7b80\u5355\u8bb0\u5f55\u4e00\u4e0b\u5728\u4e0d\u4f7f\u7528 Qt Designer \u751f\u6210 .ui \u6587\u4ef6\u7684\u60c5\u51b5\u4e0b&#xff0c;\u624b\u5199\u4e00\u4e2a\u4e3b\u7a97\u4f53\u7684\u57fa\u672c\u6d41\u7a0b&#xff0c;\u5305\u62ec&#xff1a;\u521b\u5efa\u9879\u76ee &#x1f81a; \u6dfb\u52a0 Central Widget &#x1f81a; \u8bbe\u7f6e\u5e03\u5c40 &#x1f81a; \u6dfb\u52a0\u4e3b\u4f5c\u4e1a\u533a\u63a7\u4ef6 &#x1f81a; \u6dfb\u52a0\u83dc\u5355 &#x1f81a; \u6dfb\u52a0\u5de5\u5177\u84dd &#x1f81a; \u6dfb\u52a0\u72b6\u6001\u680f\u3002 \u8fd9\u4e2a\u8fc7\u7a0b\u5bf9\u521d\u5b66\u8005\u5e2e\u52a9\u5f88\u5927&#xff0c;\u662f\u5b66\u4e60\u548c\u4f7f\u7528 Qt \u7684\u4e00\u4e2a\u6781\u597d\u5165\u95e8\u5f62\u5f0f\u3002\u9996\u5148\u4ecb\u7ecd\u4e00\u4e0b\u6211\u4eec\u8981","og_url":"https:\/\/www.wsisp.com\/helps\/80483.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-03-05T00:33:27+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260305003325-69a8cf55abec9.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/80483.html","url":"https:\/\/www.wsisp.com\/helps\/80483.html","name":"\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-03-05T00:33:27+00:00","dateModified":"2026-03-05T00:33:27+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/80483.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/80483.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/80483.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u624b\u628a\u624b\u5e26\u4f60\u7f16\u5199 Qt \u5e94\u7528\u4e3b\u7a97\u4f53"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/80483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=80483"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/80483\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/80480"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=80483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=80483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=80483"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=80483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}