{"id":2769,"date":"2011-03-25T16:22:44","date_gmt":"2011-03-25T08:22:44","guid":{"rendered":"http:\/\/edsionte.com\/techblog\/?p=2769"},"modified":"2011-03-27T17:35:54","modified_gmt":"2011-03-27T09:35:54","slug":"%e5%9f%ba%e4%ba%8eqt%e7%9a%84%e5%a4%9a%e7%aa%97%e4%bd%93%e8%ae%be%e8%ae%a1-%e7%b1%bb%e7%9a%84%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/edsionte.com\/techblog\/archives\/2769","title":{"rendered":"\u57fa\u4e8eQt\u7684\u591a\u7a97\u53e3\u7f16\u7a0b-\u754c\u9762\u7684\u8bbe\u8ba1"},"content":{"rendered":"<p>\u5bf9\u4e8e\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u591a\u7a97\u4f53\u5207\u6362\uff0c\u6211\u4eec\u5df2\u7ecf\u4e60\u4ee5\u4e3a\u5e38\u3002\u901a\u5e38\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u4e0d\u540c\u7684\u7a97\u53e3\u4ee3\u8868\u4e0d\u540c\u529f\u80fd\u7684\u5de5\u4f5c\u533a\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u63cf\u8ff0\u57fa\u4e8eQt\u7684\u591a\u7a97\u4f53\u7a0b\u5e8f\u7684\u8bbe\u8ba1\u65b9\u6cd5\u3002<em><strong>\u5728\u9605\u8bfb\u672c\u6587\u4e4b\u524d\uff0c\u4f60\u6700\u597d\u4e86\u89e3\u9762\u5411\u5bf9\u8c61\u7684\u57fa\u672c\u601d\u60f3\u4ee5\u53caQt\u7684\u57fa\u672c\u4f7f\u7528\u65b9\u6cd5\u3002<\/strong><\/em><\/p>\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u4ee5\u7f16\u5199\u4e00\u4e2a\u5ba2\u6237\u7aef\u4e3a\u4f8b\u6765\u5177\u4f53\u8bf4\u660e\u591a\u7a97\u4f53\u7a0b\u5e8f\u7684\u7f16\u7a0b\u65b9\u6cd5\u3002\u8be5\u5ba2\u6237\u7aef\u5305\u62ec\u591a\u4e2a\u5b50\u7cfb\u7edf\uff0c\u6bcf\u4e2a\u5b50\u7cfb\u7edf\u5bf9\u5e94\u4e00\u4e2a\u7a97\u53e3\uff1b\u5728\u5ba2\u6237\u7aef\u7684\u4e3b\u754c\u9762\uff0c\u901a\u8fc7\u70b9\u51fb\u76f8\u5e94\u7684\u6309\u94ae\u5b9e\u73b0\u591a\u4e2a\u7a97\u4f53\u4e4b\u95f4\u7684\u5207\u6362\u3002\u4e3b\u754c\u9762\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><a rel=\"attachment wp-att-2791\" href=\"http:\/\/edsionte.com\/techblog\/archives\/2769\/screenshot-slinuxclient-3\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-2791\" title=\"Screenshot-SLinuxClient-3\" src=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient-3-300x213.png\" alt=\"\" width=\"300\" height=\"213\" srcset=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient-3-300x213.png 300w, http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient-3.png 773w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u5982\u56fe\u6240\u793a\uff0c\u8be5\u5ba2\u6237\u7aef\u4e3b\u754c\u9762\u5305\u542b\u9876\u90e8\u7684\u6807\u7b7e\u3001\u53f3\u65b9\u7684\u6309\u94ae\u533a\u3001\u4e2d\u95f4\u7684\u4e3b\u7a97\u53e3\u533a\u4ee5\u53ca\u5e95\u90e8\u7684\u72b6\u6001\u680f\u3002\u901a\u8fc7\u70b9\u51fb\u4e0d\u540c\u7684\u6309\u94ae\u5219\u8fdb\u5165\u4e0d\u540c\u7684\u5b50\u7cfb\u7edf\u3002\u914d\u7f6e\u4fe1\u606f\u5b50\u7cfb\u7edf\u548c\u65e5\u5fd7\u4fe1\u606f\u7ba1\u7406\u5b50\u7cfb\u7edf\u754c\u9762\u8bbe\u8ba1\u5982\u4e0b\uff1a<\/p>\n<p><a rel=\"attachment wp-att-2786\" href=\"http:\/\/edsionte.com\/techblog\/archives\/2769\/screenshot-slinuxclient-1\"><\/a><a rel=\"attachment wp-att-2785\" href=\"http:\/\/edsionte.com\/techblog\/archives\/2769\/screenshot-slinuxclient\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-2785\" title=\"Screenshot-SLinuxClient\" src=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient-300x213.png\" alt=\"\" width=\"300\" height=\"213\" srcset=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient-300x213.png 300w, http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient.png 773w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a rel=\"attachment wp-att-2786\" href=\"http:\/\/edsionte.com\/techblog\/archives\/2769\/screenshot-slinuxclient-1\"><\/a><a rel=\"attachment wp-att-2785\" href=\"http:\/\/edsionte.com\/techblog\/archives\/2769\/screenshot-slinuxclient\"><\/a><a rel=\"attachment wp-att-2786\" href=\"http:\/\/edsionte.com\/techblog\/archives\/2769\/screenshot-slinuxclient-1\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-2786\" title=\"Screenshot-SLinuxClient-1\" src=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient-1-300x213.png\" alt=\"\" width=\"300\" height=\"213\" srcset=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient-1-300x213.png 300w, http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/Screenshot-SLinuxClient-1.png 773w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3><strong>\u5e03\u5c40\u7ba1\u7406<\/strong><\/h3>\n<p>\u4e0a\u8ff0\u4e09\u4e2a\u754c\u9762\u90fd\u53ef\u4ee5\u901a\u8fc7Qt Designer\u8f7b\u677e\u8bbe\u8ba1\u5b8c\u6210\uff0c\u8fd9\u91cc\u53ea\u5bf9\u7a97\u4f53\u90e8\u4ef6\u7684\u5e03\u5c40\u7ba1\u7406\u4f5c\u8bf4\u660e\u3002\u901a\u5e38\u6211\u4eec\u53ef\u4ee5\u663e\u793a\u6307\u5b9a\u7a97\u4f53\u4e2d\u5404\u4e2a\u90e8\u4ef6\u7684\u5927\u5c0f\u4ee5\u53ca\u4f4d\u7f6e\uff0c\u4f46\u662f\u8fd9\u6837\u9ebb\u70e6\u800c\u4e14\u7f3a\u5c11\u7075\u6d3b\u6027\u3002\u56e0\u6b64\u5728\u5b9e\u9645\u7684\u5e94\u7528\u4e2d\uff0c\u4f7f\u7528\u5e03\u5c40\u7ba1\u7406\u5668\u5bf9\u7a97\u4f53\u4e2d\u7684\u5404\u4e2a\u5b50\u90e8\u4ef6\u8fdb\u884c\u5e03\u5c40\u7ba1\u7406\u3002\u5e03\u5c40\u7ba1\u7406\u5668\u4f1a\u4e3a\u6bcf\u4e2a\u7a97\u4f53\u90e8\u4ef6\u63d0\u4f9b\u5408\u7406\u7684\u9ed8\u8ba4\u503c\uff0c\u5e76\u968f\u7740\u4e2a\u522b\u90e8\u4ef6\u5927\u5c0f\u7684\u53d8\u5316\u800c\u8c03\u6574\u6574\u4f53\u7684\u7a97\u4f53\u5e03\u5c40\u3002<\/p>\n<p>\u5e38\u7528\u7684\u5e03\u5c40\u7ba1\u7406\u5668\u6709QHBoxLayout\u3001QVBoxLayout\u548cQGridLayout\uff0c\u5373\u4f9d\u6b21\u4e3a\u6c34\u5e73\u5e03\u5c40\u7ba1\u7406\u3001\u5782\u76f4\u5e03\u5c40\u7ba1\u7406\u5668\u548c\u7f51\u683c\u5e03\u5c40\u7ba1\u7406\u5668\u3002\u7ed3\u5408\u4e0a\u9762\u7684\u4e3b\u754c\u9762\u56fe\u793a\uff0c\u5176\u5bf9\u5e94\u7684\u5e03\u5c40\u7ba1\u7406\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><a rel=\"attachment wp-att-2784\" href=\"http:\/\/edsionte.com\/techblog\/archives\/2769\/layout\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-2784\" title=\"layout\" src=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/layout-300x140.jpg\" alt=\"\" width=\"300\" height=\"140\" srcset=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/layout-300x140.jpg 300w, http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2011\/03\/layout.jpeg 773w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u4f7f\u7528\u5e03\u5c40\u7ba1\u7406\u5668\u7684\u4e00\u822c\u65b9\u6cd5\u4e3a\uff1a\u5148\u521b\u5efa\u76f8\u5e94\u5e03\u5c40\u7ba1\u7406\u5668\u7684\u5bf9\u8c61\uff1b\u518d\u5c06\u8981\u8fdb\u884c\u5e03\u5c40\u7ba1\u7406\u7a97\u4f53\u90e8\u4ef6\u52a0\u5165\u5230\u5e03\u5c40\u7ba1\u7406\u5668\u5bf9\u8c61\u4e2d\uff1b\u4e3a\u5f53\u524d\u7a97\u4f53\u8bbe\u7f6e\u8be5\u5e03\u5c40\u7ba1\u7406\u5668\u3002\u9664\u4e86\u53ef\u4ee5\u5c06\u7a97\u4f53\u90e8\u4ef6\u52a0\u5165\u5230\u5f53\u524d\u7684\u5e03\u5c40\u7ba1\u7406\u5668\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u5c06\u53e6\u5916\u4e00\u4e2a\u5e03\u5c40\u7ba1\u7406\u5668\u5bf9\u8c61\u52a0\u5165\u5230\u5f53\u524d\u7684\u5e03\u5c40\u7ba1\u7406\u5668\u4e2d\uff1b\u6b64\u5916\uff0c\u8bbe\u7f6e\u5e03\u5c40\u7ba1\u7406\u5668\u53ea\u9700\u5728\u6240\u6709\u5e03\u5c40\u7ba1\u7406\u5668\u90fd\u6dfb\u52a0\u597d\u4e4b\u540e\u8fdb\u884c\u4e00\u6b21\u7684\u8bbe\u7f6e\u5373\u53ef\u3002\u5177\u4f53\u4f7f\u7528\u65b9\u6cd5\u53ef\u53c2\u8003\u968f\u540e\u7ed9\u51fa\u7684\u793a\u4f8b\u4ee3\u7801\u3002<\/p>\n<p>\u5728topLayout\u8fd9\u4e2a\u9876\u90e8\u7684\u5e03\u5c40\u7ba1\u7406\u5668\u4e2d\uff0c\u6211\u4eec\u4ec5\u52a0\u5165\u4e00\u4e2a\u6807\u7b7e\u3002\u6b63\u5982\u4e0a\u9762\u6240\u8ff0\uff0c\u6211\u4eec\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u6c34\u5e73\u5e03\u5c40\u7ba1\u7406\u5668\u5bf9\u8c61\uff0c\u518d\u5c06\u8fd9\u4e2amainlabel\u6807\u7b7e\u52a0\u5165\u5176\u5185\u3002<\/p>\n<pre class=\"brush:c\">    QHBoxLayout *topLayout = new QHBoxLayout;\r\n    topLayout-&gt;addWidget(ui-&gt;mainLabel);<\/pre>\n<p>\u53f3\u8fb9\u7684\u6309\u94ae\u533a\u7684\u5e03\u5c40\u7ba1\u7406rightBtnLayout\u548c\u4e0a\u8ff0\u7c7b\u4f3c\uff0c\u53ea\u4e0d\u8fc7\u6211\u4eec\u6b64\u65f6\u4f7f\u7528\u7684\u662f\u5782\u76f4\u7ba1\u7406\u5668\u3002\u63a5\u4e0b\u6765\u91cd\u70b9\u8bf4\u4e00\u4e0b\u4e3b\u7a97\u53e3\u533a\u5e03\u5c40\u7ba1\u7406\u5668widgetLayout\u7684\u8bbe\u7f6e\u3002\u4e24\u4e2a\u5b50\u7cfb\u7edf\u548c\u4e3b\u754c\u9762\u7684\u529f\u80fd\u4e0d\u540c\uff0c\u56e0\u6b64\u5c06\u4ed6\u4eec\u5206\u522b\u5c01\u88c5\u6210\u7c7bconfigUI\u3001logUI\u548cfrontPage\uff0c\u6211\u4eec\u4f9d\u6b21\u521b\u5efa\u4e09\u4e2a\u7c7b\u7684\u5bf9\u8c61\u3002\u63a5\u4e0b\u6765\u5c06\u8fd9\u4e09\u4e2a\u90e8\u4ef6\u52a0\u5165\u5230widgetLayout\u4e2d\u3002\u7531\u4e8e\u5ba2\u6237\u7aef\u521d\u59cb\u663e\u793a\u4e3b\u754c\u9762\uff0c\u5219\u6211\u4eec\u5c06\u5176\u4ed6\u4e24\u4e2a\u7a97\u4f53\u6682\u65f6\u9690\u85cf\u3002<\/p>\n<pre class=\"brush:c\">    QVBoxLayout *widgetLayout = new QVBoxLayout;\r\n    configWidget = new configUI(this);\r\n    logWidget = new logUI(this);\r\n    mainMenu = new frontPage(this);\r\n    widgetLayout-&gt;addWidget(ui-&gt;introTextBrowser);\r\n    widgetLayout-&gt;addWidget(configWidget);\r\n    widgetLayout-&gt;addWidget(logWidget);\r\n    configWidget-&gt;hide();\r\n    logWidget-&gt;hide();<\/pre>\n<p>\u6211\u4eec\u73b0\u5728\u5df2\u7ecf\u8bbe\u7f6e\u597d\u4e86rightBtnLayout\u548cwidgetLayout\uff0c\u63a5\u4e0b\u6765\u5c06\u8fd9\u4e24\u4e2a\u5e03\u5c40\u7ba1\u7406\u5668\u52a0\u5165\u5230mainWindowLayout\u4e2d\u3002<\/p>\n<pre class=\"brush:c\">    QHBoxLayout *mainWindowLayout = new QHBoxLayout;\r\n    mainWindowLayout-&gt;addLayout(widgetLayout);\r\n    mainWindowLayout-&gt;addLayout(rightBtnLayout);<\/pre>\n<p>\u8fd9\u6837mainWindowLayout\u5e03\u5c40\u7ba1\u7406\u5668\u5c31\u8bbe\u7f6e\u597d\u4e86\u3002\u6700\u540e\u6211\u4eec\u8fd8\u9700\u8981\u8bbe\u7f6ebottomLayout\u5e03\u5c40\u7ba1\u7406\u5668\uff0c\u53ea\u662f\u7b80\u5355\u7684\u6dfb\u52a0\u4e00\u4e2a\u6807\u7b7e\u548c\u4e00\u4e2a\u6c34\u5e73\u5206\u5272\u7ebf\u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u6211\u4eec\u62e5\u6709\u4e09\u4e2a\u4e8c\u7ea7\u5e03\u5c40\u7ba1\u7406\u5668\uff1atopLayout\u3001mainWindowLayout\u548cbottomLayout\uff0c\u6211\u4eec\u5c06\u8fd9\u4e09\u4e2a\u5e03\u5c40\u7ba1\u7406\u5668\u5168\u90e8\u6dfb\u52a0\u5230\u9876\u7ea7\u5e03\u5c40\u7ba1\u7406\u5668mainLayout\u4e2d\uff1a<\/p>\n<pre class=\"brush:c\">   QVBoxLayout *mainLayout = new QVBoxLayout;\r\n    mainLayout-&gt;addLayout(topLayout);\r\n    mainLayout-&gt;addLayout(mainWindowLayout);\r\n    mainLayout-&gt;addLayout(bottomLayout);\r\n    this-&gt;adjustSize();\r\n\r\n    setLayout(mainLayout);<\/pre>\n<p>\u6b64\u65f6\uff0c\u6211\u4eec\u5c31\u8bbe\u7f6e\u597d\u4e86\u4e3b\u754c\u9762\u7684\u5e03\u5c40\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5bf9\u4e8e\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u591a\u7a97\u4f53\u5207\u6362\uff0c\u6211\u4eec\u5df2\u7ecf\u4e60\u4ee5\u4e3a\u5e38\u3002\u901a\u5e38\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u4e0d\u540c\u7684\u7a97\u53e3\u4ee3\u8868\u4e0d\u540c\u529f\u80fd\u7684\u5de5\u4f5c\u533a\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u63cf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[199],"tags":[201,202,200,210,211],"class_list":["post-2769","post","type-post","status-publish","format-standard","hentry","category-gui","tag-c","tag-gui","tag-qt","tag-210","tag-211"],"views":26719,"_links":{"self":[{"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/posts\/2769","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/comments?post=2769"}],"version-history":[{"count":0,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/posts\/2769\/revisions"}],"wp:attachment":[{"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/media?parent=2769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/categories?post=2769"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/tags?post=2769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}