{"id":80117,"date":"2026-03-04T11:41:28","date_gmt":"2026-03-04T03:41:28","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/80117.html"},"modified":"2026-03-04T11:41:28","modified_gmt":"2026-03-04T03:41:28","slug":"qt-%e4%b8%ba%e4%bb%80%e4%b9%88%e4%b8%8d%e5%85%81%e8%ae%b8%e4%b8%bb%e7%aa%97%e4%bd%93%e7%9b%b4%e6%8e%a5%e8%ae%be%e7%bd%ae%e5%b8%83%e5%b1%80","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/80117.html","title":{"rendered":"Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40?"},"content":{"rendered":"<p>\u521d\u6b21\u63a5\u89e6 Qt \u65f6&#xff0c;\u53ef\u80fd\u4f1a\u5bf9\u4e00\u6bb5\u5e38\u89c1\u7684\u4ee3\u7801\u611f\u5230\u8d39\u89e3&#xff1a;<\/p>\n<p><span class=\"token class-name\">MainWindow<\/span><span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">MainWindow<\/span><span class=\"token punctuation\">(<\/span>QWidget <span class=\"token operator\">*<\/span>parent<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token function\">QMainWindow<\/span><span class=\"token punctuation\">(<\/span>parent<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ set central widget<\/span><br \/>\n    centralWidget <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 \/>\n    centralWidget<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<p>    <span class=\"token comment\">\/\/ set layout of central widget<\/span><br \/>\n    verticalLayout <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><br \/>\n    verticalLayout<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    verticalLayout<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">addWidget<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u76f4\u89c9\u4e0a&#xff0c;\u6211\u4eec\u4f1a\u89c9\u5f97\u76f4\u63a5\u628a verticalLayout \u8bbe\u4e3a MainWindow \u7684 centralWidget \u4f1a\u66f4\u7b80\u6d01\u76f4\u89c2&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u9519\u8bef\u4ee3\u7801\u793a\u8303<\/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>verticalLayout<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u56e0\u4e3a new \u4e00\u4e2a\u65b0\u7684 QWidget \u5374\u53ea\u4e3a\u8ba9\u5b83\u53bb\u201c\u5305\u88f9\u201d\u4e00\u4e2a\u201c\u5e03\u5c40\u201d<sup class=\"footnote-ref\">1<\/sup>\u770b\u4e0a\u53bb\u662f\u6709\u4e9b\u201c\u7ed5\u201d\u7684&#xff0c;\u4f46\u5728 Qt \u91cc&#xff0c;\u8fd9\u662f\u5fc5\u987b\u7684\u3002\u8fd9\u6d89\u53ca\u5230 Qt \u4e2d\u7684 Widget \u7c7b\u578b\u548c\u5b83\u4eec\u4e0e Layout \u4e4b\u95f4\u7684\u5173\u7cfb\u3002<\/p>\n<p>\u4ece\u5e03\u5c40\u7684\u89d2\u5ea6\u770b&#xff0c;Qt \u6709\u4e24\u79cd\u7c7b\u578b\u7684 widget&#xff1a;\u4e00\u7c7b\u662f\u666e\u901a\u7684 widget&#xff0c;\u5b83\u4eec\u53ef\u4ee5\u8bbe\u7f6e layout&#xff1b;\u53e6\u4e00\u7c7b\u5219\u662f\u201c\u6846\u67b6\u578b\u201d\u5bb9\u5668&#xff0c;\u5b83\u4eec\u7684\u5e03\u5c40\u662f\u9884\u8bbe\u597d\u4e14\u4e0d\u53ef\u4fee\u6539\u7684&#xff0c;\u5178\u578b\u7684\u4f8b\u5b50\u5c31\u662f QMainWindow&#xff0c;\u5b83\u7684\u5e03\u5c40\u56fa\u5b9a\u6846\u67b6\u7ed3\u6784\u662f&#xff1a;<\/p>\n<ul>\n<li>QMainWindow\n<ul>\n<li>menu bar<\/li>\n<li>tool bar<\/li>\n<li>dock widget<\/li>\n<li>status bar<\/li>\n<li>central widget<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u6240\u4ee5\u6211\u4eec\u662f\u4e0d\u80fd\u76f4\u63a5\u7ed9\u5b83 setLayout \u7684\u3002\u4e0b\u8868\u8be6\u7ec6\u5730\u5bf9\u6bd4\u4e86\u4e24\u7c7b widget:<\/p>\n<table>\n<tr>\u7c7b\u578b\u7279\u70b9\u5178\u578b\u4ee3\u8868<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">\u666e\u901a\u5bb9\u5668&#xff08;\u81ea\u7531\u5bb9\u5668&#xff09;<\/td>\n<td align=\"left\">\u53ef\u4ee5\u8bbe\u7f6e layout<\/td>\n<td align=\"left\">QWidget\u3001QFrame\u3001QDialog<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u6846\u67b6\u5bb9\u5668&#xff08;\u7ed3\u6784\u578b\u5bb9\u5668&#xff09;<\/td>\n<td align=\"left\">\u5e03\u5c40\u662f\u9884\u8bbe\u597d\u7684\u56fa\u5b9a\u7ed3\u6784&#xff0c;\u4e0d\u53ef\u4ee5\u8bbe\u7f6e layout<\/td>\n<td align=\"left\">QMainWindow\u3001QScrollArea<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6b64\u5916&#xff0c;\u8fd8\u9700\u8981\u660e\u786e\u7684\u4e00\u70b9\u662f&#xff1a;Layout \u5e76\u4e0d\u662f\u4e00\u79cd\u5bb9\u5668\u578b\u7684 Widget&#xff0c;QLayout \u548c QWidget \u662f\u4e24\u4e2a\u72ec\u7acb\u6f14\u5316\u7684\u7c7b\u65cf&#xff0c;\u5f7c\u6b64\u4e4b\u95f4\u4e0d\u5b58\u5728\u4efb\u4f55\u7ee7\u627f\u5173\u7cfb&#xff0c;Layout \u7684\u672c\u8d28\u662f\u201c\u7ba1\u7406\u51e0\u4f55\u5173\u7cfb\u7684\u7b97\u6cd5\u201d\u3002<\/p>\n<p>\u6700\u540e&#xff0c;Layout \u662f\u901a\u8fc7\u201c\u6302\u9760\u201d\u5230&#xff08;\u201c\u4f9d\u9644\u201d\u4e8e&#xff09;\u4e00\u4e2a QWidget \u800c\u5b58\u5728\u548c\u53d1\u6325\u4f5c\u7528\u7684&#xff0c;\u4e0d\u5b58\u5728\u4e00\u4e2a\u5305\u542b\u4e86\u82e5\u5e72\u5b50\u63a7\u4ef6\u4f46\u5374\u4e0d\u96b6\u5c5e\u4e8e\u4efb\u4f55 Widget \u7684 Layout\u3002<\/p>\n<p>\u57fa\u4e8e\u4ee5\u4e0a\u4e09\u70b9\u89e3\u91ca&#xff0c;\u6211\u4eec\u91cd\u65b0\u56de\u770b\u4e00\u4e0b\u4e0a\u9762\u7684\u95ee\u9898&#xff1a;<\/p>\n<ul>\n<li>\u65e2\u7136 QMainWindow \u7684 setCentralWidget \u65b9\u6cd5\u9700\u8981\u7684\u53c2\u6570\u7c7b\u578b\u662f QWidget* widget&#xff0c;\u5219\u8bbe\u7f6e\u4e00\u4e2a Layout \u663e\u7136\u662f\u4e0d\u5408\u6cd5\u7684<\/li>\n<li>\u7406\u8bba\u4e0a QMainWindow \u4e5f\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a setCentralLayout \u65b9\u6cd5&#xff0c;\u4f46\u8fd9\u4e2a API \u5f88\u50cf\u662f\u4e00\u4e2a\u201c\u6bdb\u523a\u201d&#xff0c;\u4e0e\u6574\u4f53\u7684 API \u8bbe\u8ba1\u663e\u5f97\u6781\u4e0d\u534f\u8c03&#xff0c;\u56e0\u4e3a&#xff1a;\n<ul>\n<li>\u6240\u6709 QWidget \u90fd\u662f\u901a\u8fc7 setLayout \u8bbe\u7f6e\u5e03\u5c40\u7684&#xff0c;\u8fd9\u4e2a API \u52bf\u5fc5\u201c\u5e72\u9884\u201d\u5230\u4e86\u57fa\u5b50\u63a7\u4ef6\u7684\u5185\u90e8\u5b9e\u73b0&#xff0c;\u7834\u574f\u4e86\u5b50\u63a7\u4ef6\u7684\u201c\u5c01\u88c5\u201d<\/li>\n<li>\u627f\u63a5\u4e0a\u4e00\u70b9&#xff0c;\u65e2\u7136 Layout \u5fc5\u987b\u201c\u6302\u9760\u201d\u5230\u4e00\u4e2a QWidget&#xff0c;\u53ef\u4ee5\u60f3\u8c61&#xff0c;setCentralLayout \u65b9\u6cd5\u7684\u5b9e\u73b0\u4e5f\u8fd8\u662f\u5f97\u5148 new \u4e00\u4e2a widget \u51fa\u6765\u518d setLayout&#xff0c;\u5982\u679c\u5c01\u88c5\u8d77\u6765&#xff0c;\u7528\u6237\u5c31\u6ca1\u6709\u673a\u4f1a\u63a7\u5236\u6216\u9009\u62e9 new \u4e00\u4e2a\u4ec0\u4e48 widget \u51fa\u6765\u4e86\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u603b\u4e4b&#xff0c;\u5728\u8fd9\u4e2a\u95ee\u9898\u4e0a&#xff0c;\u53ef\u4ee5\u770b\u51fa Qt \u7684\u8bbe\u8ba1\u7406\u5ff5\u662f&#xff1a;<\/p>\n<p>\u4e00\u4e2a widget \u8981\u4e48\u53ef\u4ee5\u8bbe\u7f6e\u81ea\u5df1&#xff08;\u6574\u4f53\u4e14\u552f\u4e00&#xff09;\u7684\u5e03\u5c40&#xff0c;\u7136\u540e\u5728\u5e03\u5c40\u91cc\u518d\u53bb\u5d4c\u5957\u5176\u4ed6\u7684\u5b50 widget \u548c\u5b50 layout&#xff0c;\u8981\u4e48\u5c31\u662f\u5185\u90e8\u7ed3\u6784\u56fa\u5b9a&#xff0c;\u4e0d\u53ef\u8bbe\u7f6e\u5e03\u5c40&#xff0c;\u4e5f\u4e0d\u53ef\u201c\u5e72\u9884\u201d\u5176\u201c\u7ec4\u6210\u90e8\u5206\u201d\u7684\u5e03\u5c40&#xff0c;\u201c\u7ec4\u6210\u90e8\u5206\u201d\u7684\u5e03\u5c40\u5e94\u7559\u7ed9\u5f00\u53d1\u8005\u8bbe\u7f6e&#xff0c;\u4f46\u5e03\u5c40\u53c8\u4e0d\u53ef\u4ee5\u72ec\u7acb\u5b58\u5728&#xff0c;\u5b83\u5fc5\u987b\u4f9d\u9644\u4e8e\u4e00\u4e2a Widget&#xff0c;\u6545\u800c\u624d\u51fa\u73b0\u4e86\u201cnew \u4e00\u4e2a\u65b0\u7684 QWidget \u5374\u53ea\u4e3a\u8ba9\u5b83\u53bb\u5305\u88f9\u4e00\u4e2a\u5e03\u5c40<sup class=\"footnote-ref\">1<\/sup>\u201d\u7684\u60c5\u51b5&#xff0c;\u5e94\u8be5\u8bf4\u8fd9\u79cd\u60c5\u5f62\u662f\u5728 Qt \u5de5\u6574\u800c\u4e25\u8c28\u7684 API \u8bbe\u8ba1\u4e0b\u884d\u751f\u51fa\u7684\u4e00\u79cd\u6b63\u5e38\u8868\u73b0&#xff0c;\u4e60\u60ef\u4e86\u4e5f\u5c31\u4e0d\u4f1a\u89c9\u5f97\u602a\u5f02\u4e86\u3002<\/p>\n<hr class=\"footnotes-sep\" \/>\n<li id=\"fn1\" class=\"footnote-item\">\n<p>\u8fd9\u4e2a QWidget \u4e5f\u5e76\u975e\u771f\u5f97\u201c\u4e00\u65e0\u662f\u5904\u201d&#xff0c;\u5728\u5e03\u5c40\u4e4b\u4e0b\u6dfb\u52a0 widget \u65f6&#xff0c;parent \u90fd\u662f\u5b83&#xff0c;\u4f46\u8fd9\u662f\u540e\u8bdd\u4e86 \u21a9\ufe0e \u21a9\ufe0e<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u521d\u6b21\u63a5\u89e6 Qt \u65f6&#xff0c;\u53ef\u80fd\u4f1a\u5bf9\u4e00\u6bb5\u5e38\u89c1\u7684\u4ee3\u7801\u611f\u5230\u8d39\u89e3&#xff1a;<br \/>\nMainWindow::MainWindow(QWidget *parent): QMainWindow(parent) {\/\/ set central widgetcentralWidget  new QWidget(this);centralWidget-&gt;setObjectName(\\&#8221;centralWidget\\&#8221;);this-&gt;setCentralWidget(centralWidget<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8705,8981,8982,218],"topic":[],"class_list":["post-80117","post","type-post","status-publish","format-standard","hentry","category-server","tag-layout","tag-qmainwindow","tag-8982","tag-qt"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40? - \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\/80117.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40? - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u521d\u6b21\u63a5\u89e6 Qt \u65f6&#xff0c;\u53ef\u80fd\u4f1a\u5bf9\u4e00\u6bb5\u5e38\u89c1\u7684\u4ee3\u7801\u611f\u5230\u8d39\u89e3&#xff1a; MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) {\/\/ set central widgetcentralWidget new QWidget(this);centralWidget-&gt;setObjectName(&quot;centralWidget&quot;);this-&gt;setCentralWidget(centralWidget\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/80117.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-04T03:41:28+00:00\" \/>\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=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/80117.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/80117.html\",\"name\":\"Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40? - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-03-04T03:41:28+00:00\",\"dateModified\":\"2026-03-04T03:41:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/80117.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/80117.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/80117.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40?\"}]},{\"@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":"Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40? - \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\/80117.html","og_locale":"zh_CN","og_type":"article","og_title":"Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40? - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u521d\u6b21\u63a5\u89e6 Qt \u65f6&#xff0c;\u53ef\u80fd\u4f1a\u5bf9\u4e00\u6bb5\u5e38\u89c1\u7684\u4ee3\u7801\u611f\u5230\u8d39\u89e3&#xff1a; MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) {\/\/ set central widgetcentralWidget new QWidget(this);centralWidget-&gt;setObjectName(\"centralWidget\");this-&gt;setCentralWidget(centralWidget","og_url":"https:\/\/www.wsisp.com\/helps\/80117.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-03-04T03:41:28+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/80117.html","url":"https:\/\/www.wsisp.com\/helps\/80117.html","name":"Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40? - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-03-04T03:41:28+00:00","dateModified":"2026-03-04T03:41:28+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/80117.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/80117.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/80117.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Qt \u4e3a\u4ec0\u4e48\u4e0d\u5141\u8bb8\u4e3b\u7a97\u4f53\u76f4\u63a5\u8bbe\u7f6e\u5e03\u5c40?"}]},{"@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\/80117","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=80117"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/80117\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=80117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=80117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=80117"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=80117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}