{"id":346,"date":"2021-06-21T09:42:33","date_gmt":"2021-06-21T09:42:33","guid":{"rendered":"http:\/\/gongyikun.cn\/?p=346"},"modified":"2021-06-22T00:13:55","modified_gmt":"2021-06-22T00:13:55","slug":"qt%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e6%97%b6%e9%97%b4","status":"publish","type":"post","link":"https:\/\/blog.gongyikun.cn\/?p=346","title":{"rendered":"QT\u83b7\u53d6\u5f53\u524d\u65f6\u95f4"},"content":{"rendered":"<h1>PS:\u8f6c\u8f7d\u81ea(<a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/c.biancheng.net\/view\/1847.html\" title=\"\u8bf7\u70b9\u51fb\u8df3\u8f6c\">\u8bf7\u70b9\u51fb\u8df3\u8f6c<\/a>)<\/h1>\n<blockquote><p>\n  \u65f6\u95f4\u65e5\u671f\u662f\u7ecf\u5e38\u9047\u5230\u7684\u6570\u636e\u7c7b\u578b\uff0cQt \u4e2d\u65f6\u95f4\u65e5\u671f\u7c7b\u578b\u7684\u7c7b\u5982\u4e0b\uff1a<br \/>\n  QTime\uff1a\u65f6\u95f4\u6570\u636e\u7c7b\u578b\uff0c\u4ec5\u8868\u793a\u65f6\u95f4\uff0c\u598215:23:13\u3002<br \/>\n  QDate\uff1a\u65e5\u671f\u6570\u636e\u7c7b\u578b\uff0c\u4ec5\u8868\u793a\u65e5\u671f\uff0c\u59822017-4-5\u3002<br \/>\n  QDateTime\uff1a\u65e5\u671f\u65f6\u95f4\u6570\u636e\u7c7b\u578b\uff0c\u8868\u793a\u65e5\u671f\u548c\u65f6\u95f4\uff0c\u59822017-03-23 08:12:43\u3002<br \/>\n  Qt \u4e2d\u6709\u4e13\u95e8\u7528\u4e8e\u65e5\u671f\u3001\u65f6\u95f4\u7f16\u8f91\u548c\u663e\u793a\u7684\u754c\u9762\u7ec4\u4ef6\uff0c\u4ecb\u7ecd\u5982\u4e0b\uff1a<br \/>\n  QTimeEdit\uff1a\u7f16\u8f91\u548c\u663e\u793a\u65f6\u95f4\u7684\u7ec4\u4ef6\u3002<br \/>\n  QDateEdit\uff1a\u7f16\u8f91\u548c\u663e\u793a\u65e5\u671f\u7684\u7ec4\u4ef6\u3002<br \/>\n  QDateTimeEdit\uff1a\u7f16\u8f91\u548c\u663e\u793a\u65e5\u671f\u65f6\u95f4\u7684\u7ec4\u4ef6\u3002<br \/>\n  QCalendarWidget\uff1a \u4e00\u4e2a\u7528\u65e5\u5386\u5f62\u5f0f\u9009\u62e9\u65e5\u671f\u7684\u7ec4\u4ef6\u3002<br \/>\n  \u5b9e\u4f8b\u7a0b\u5e8f samp4_5 \u6f14\u793a\u8fd9\u4e9b\u65f6\u95f4\u65e5\u671f\u76f8\u5173\u7c7b\u7684\u4f7f\u7528\uff0c\u5176\u8fd0\u884c\u65f6\u754c\u9762\u5982\u56fe 1 \u6240\u793a<br \/>\n  <a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/gongyikun.cn\/wp-content\/uploads\/2021\/06\/wp_editor_md_ab2fd232fe10ca1c94345051790fb74a.jpg\"><img src=\"http:\/\/gongyikun.cn\/wp-content\/uploads\/2021\/06\/wp_editor_md_ab2fd232fe10ca1c94345051790fb74a.jpg\" alt=\"\" \/><\/a>\n<\/p><\/blockquote>\n<h1>\u65e5\u671f\u65f6\u95f4\u6570\u636e\u4e0e\u5b57\u7b26\u4e32\u4e4b\u95f4\u7684\u8f6c\u6362<\/h1>\n<blockquote>\n<h4>-\u5728\u4e0a\u56fe\u7a97\u4f53\u5de6\u4e0a\u65b9\u7684\u201c\u65e5\u671f\u65f6\u95f4\u201dGroupbox \u4e2d\uff0c\u4f7f\u7528 QTimeEdit\u3001QDateEdit\u3001QDateTimeEdit \u7ec4\u4ef6\u4f5c\u4e3a\u65f6\u95f4\u3001\u65e5\u671f\u3001\u65e5\u671f\u65f6\u95f4\u7f16\u8f91\u5668\uff1b\u5728\u5176\u53f3\u4fa7\uff0c\u5404\u653e\u7f6e\u4e00\u4e2a QLineEdit \u7ec4\u4ef6\u7528\u4e8e\u5b57\u7b26\u4e32\u663e\u793a\u3002<\/h4>\n<h4>-QDateEdit \u548c QTimeEdit \u90fd\u4ece QDateTimeEdit \u7ee7\u627f\u800c\u6765\uff0c\u5b9e\u73b0\u9488\u5bf9\u65e5\u671f\u6216\u65f6\u95f4\u7684\u7279\u5b9a\u663e\u793a\u529f\u80fd\u3002\u5b9e\u9645\u4e0a\uff0cQDateEdit \u548c QTimeEdit \u7684\u663e\u793a\u529f\u80fd\u90fd\u53ef\u4ee5\u901a\u8fc7 QDateTimeEdit \u5b9e\u73b0\uff0c\u53ea\u9700\u8bbe\u7f6e\u597d\u5c5e\u6027\u5373\u53ef\u3002<\/h4>\n<\/blockquote>\n<h1>QDateTimeEdit \u7c7b\u7684\u4e3b\u8981\u5c5e\u6027\u7684\u4ecb\u7ecd\u5982\u4e0b\uff1a<\/h1>\n<blockquote>\n<h5>-datetime\uff1a\u65e5\u671f\u65f6\u95f4\u3002<\/h5>\n<h5>-date\uff1a\u65e5\u671f\uff0c\u8bbe\u7f6e datetime \u65f6\u4f1a\u81ea\u52a8\u6539\u53d8 date\uff0c\u540c\u6837\uff0c\u8bbe\u7f6e date \u65f6\uff0c\u4e5f\u4f1a\u81ea\u52a8\u6539\u53d8 datetime \u91cc\u7684\u65e5\u671f\u3002<\/h5>\n<h4>-time\uff1a\u65f6\u95f4\uff0c\u8bbe\u7f6e datetime \u65f6\u4f1a\u81ea\u52a8\u6539\u53d8 time\uff0c\u540c\u6837\uff0c\u8bbe\u7f6e time \u65f6\uff0c\u4e5f\u4f1a\u81ea\u52a8\u6539\u53d8 datetime \u91cc\u7684\u65f6\u95f4\u3002<\/h4>\n<h5>-maximumDateTime\u3001 minimumDateTime\uff1a\u6700\u5927\u3001\u6700\u5c0f\u65e5\u671f\u65f6\u95f4\u3002<\/h5>\n<h5>-maximumDate\u3001minimumDate\uff1a\u6700\u5927\u3001\u6700\u5c0f\u65e5\u671f\u3002<\/h5>\n<h5>-maximumTime\u3001minimumTime\uff1a\u6700\u5927\u3001\u6700\u5c0f\u65f6\u95f4\u3002<\/h5>\n<h5>-QDateTimeEdit::Section\u3002QDateTimeEdit \u663e\u793a\u65e5\u671f\u65f6\u95f4\u6570\u636e\u65f6\u5206\u4e3a\u591a\u4e2a\u6bb5\uff0c\u5355\u51fb\u7f16\u8f91\u6846\u53f3\u4fa7\u7684\u4e0a\u4e0b\u6309\u94ae\u53ef\u4fee\u6539\u5f53\u524d\u6bb5\u7684\u503c\u3002\u5982\u8f93\u5165\u5149\u6807\u5728YearSection\u6bb5\uff0c\u5c31\u4fee\u6539\u201c\u5e74\u201d\u7684\u503c\u3002<\/h5>\n<h5>-currentSectionIndex\uff1a\u7528\u5e8f\u53f7\u8868\u793a\u7684\u8f93\u5165\u5149\u6807\u6240\u5728\u7684\u6bb5\u3002<\/h5>\n<h5>-calendarPopup\uff1a\u662f\u5426\u5141\u8bb8\u5f39\u51fa\u4e00\u4e2a\u65e5\u5386\u9009\u62e9\u6846\u3002\u5f53\u53d6\u503c\u4e3a true \u65f6\uff0c\u53f3\u4fa7\u7684\u8f93\u5165\u6309\u94ae\u53d8\u6210\u4e0e QComboBox \u7c7b\u4f3c\u7684\u4e0b\u62c9\u6309\u94ae\uff0c\u5355\u51fb\u6309\u94ae\u65f6\u51fa\u73b0\u4e00\u4e2a\u65e5\u5386\u9009\u62e9\u6846\uff0c\u7528\u4e8e\u5728\u65e5\u5386\u4e0a\u9009\u62e9\u65e5\u671f\u3002\u5bf9\u4e8e QTimeEdit\uff0c\u6b64\u5c5e\u6027\u65e0\u6548\u3002<\/h5>\n<h5>-displayFormat\uff1a\u663e\u793a\u683c\u5f0f\uff0c\u65e5\u671f\u65f6\u95f4\u6570\u636e\u7684\u663e\u793a\u683c\u5f0f\uff0c\u4f8b\u5982\u8bbe\u7f6e\u4e3a\u201cyyyy-MM-dd HH:mm:ss\u201d\uff0c\u4e00\u4e2a\u65e5\u671f\u65f6\u95f4\u6570\u636e\u5c31\u663e\u793a\u4e3a\u201c2016-11-02 08:23:46\u201d\u3002<\/h5>\n<\/blockquote>\n<h1>\u65e5\u671f\u65f6\u95f4\u6570\u636e\u7684\u83b7\u53d6\u4e0e\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32<\/h1>\n<h3>-\u201c\u8bfb\u53d6\u5f53\u524d\u65e5\u671f\u65f6\u95f4\u201d\u6309\u94ae\u7684 clicked() \u4fe1\u53f7\u7684\u69fd\u51fd\u6570\u4ee3\u7801\u5982\u4e0b\uff1a<\/h3>\n<pre><code class=\"language-cpp line-numbers\">void Dialog::on_btnGetTime_clicked()\n{\n    \/\/\u83b7\u53d6\u5f53\u524d\u65e5\u671f\u65f6\u95f4\uff0c\u4e3a\u4e09\u4e2a\u4e13\u7528\u7f16\u8f91\u5668\u8bbe\u7f6e\u65e5\u671f\u65f6\u95f4\u6570\u636e\uff0c\u5e76\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\n    QDateTime curDateTime=QDateTime::currentDateTime();\n    ui-&gt;timeEdit-&gt;setTime(curDateTime.time());\n    ui-&gt;editTime-&gt;setText (curDateTime.toString (\"hh:mm: ss11));\n    ui-&gt;dateEdit-&gt;setDate(curDateTime.date());\n    ui-&gt;editDate-&gt;setText(curDateTime.toString(\"yyyy-MM-dd\"));\n    ui-&gt;dateTimeEdit-&gt;setDateTime(curDateTime);\n    ui-&gt;editDateTime-&gt;setText(curDateTime.toString(\"yyyy-MM-dd hh:mm:ss\"));\n}\n<\/code><\/pre>\n<blockquote>\n<h4>1.\u9996\u5148\u7528 QDateTime \u7c7b\u7684\u9759\u6001\u51fd\u6570 currentDateTime() \u83b7\u53d6\u5f53\u524d\u65e5\u671f\u65f6\u95f4\uff0c\u5e76\u8d4b\u503c\u7ed9\u53d8\u91cf curDate Time\u3002<\/h4>\n<h4>2.\u7136\u540e\u7528 curDateTime \u53d8\u91cf\u8bbe\u7f6e\u754c\u9762\u4e0a 3 \u4e2a\u65e5\u671f\u3001\u65f6\u95f4\u7f16\u8f91\u5668\u7684\u65f6\u95f4\u6216\u65e5\u671f\u503c\uff0c\u5229\u7528\u4e86 QDateTime \u7684 time() \u548c date() \u5206\u522b\u63d0\u53d6\u65f6\u95f4\u548c\u65e5\u671f\u3002<\/h4>\n<\/blockquote>\n<h3>-\u5c06 curDateTime \u8868\u793a\u7684\u65e5\u671f\u65f6\u95f4\u6570\u636e\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u5728 LineEdit \u7f16\u8f91\u6846\u4e0a\u663e\u793a\u3002\u65f6\u95f4\u65e5\u671f\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u4f7f\u7528\u4e86 QDateTime \u7684 toString() \u51fd\u6570\uff0c\u5206\u522b\u7528\u4e0d\u540c\u7684\u683c\u5f0f\u663e\u793a\u65f6\u95f4\u3001\u65e5\u671f\u3001\u65e5\u671f\u65f6\u95f4\uff1a<\/h3>\n<pre><code class=\"language-cpp line-numbers\">ui-&gt;editTime-&gt;setText(curDateTime.toString(Mhh:mm:ss\"));\nui-&gt;editDate-&gt;setText(curDateTime.toString(\"yyyy-MM-dd\"));\nui-&gt;editDateTime-&gt;setText(curDateTime.toString(\"yyyy-MM-dd hh:mm:ss\"));\n<\/code><\/pre>\n<h4>QDateTime::toString() \u51fd\u6570\u7684\u51fd\u6570\u539f\u578b\u662f\uff1a<\/h4>\n<pre><code class=\"language-cpp line-numbers\">QString QDateTime::toString(const QString fiformat) const\n<\/code><\/pre>\n<h4>\u5b83\u5c06\u65e5\u671f\u65f6\u95f4\u6570\u636e\u6309\u7167 format \u6307\u5b9a\u7684\u683c\u5f0f\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u3002format \u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u5305\u542b\u4e00\u4e9b\u7279\u5b9a\u7684\u5b57\u7b26\uff0c\u8868\u793a\u65e5\u671f\u6216\u65f6\u95f4\u7684\u5404\u4e2a\u90e8\u5206.\u4e0b\u8868\u662f\u7528\u4e8e\u65e5\u671f\u65f6\u95f4\u663e\u793a\u7684\u5e38\u7528\u683c\u5f0f\u7b26\uff1a<\/h4>\n<table>\n<thead>\n<tr>\n<th>\u5b57\u7b26<\/th>\n<th>\u610f\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>d<\/td>\n<td>\u5929\uff0c\u4e0d\u8865\u96f6\u663e\u793a\uff0c1-31<\/td>\n<\/tr>\n<tr>\n<td>dd<\/td>\n<td>\u5929\uff0c\u8865\u96f6\u663e\u793a\uff0c01-31<\/td>\n<\/tr>\n<tr>\n<td>M<\/td>\n<td>\u6708\uff0c\u4e0d\u8865\u96f6\u663e\u793a\uff0c1-12<\/td>\n<\/tr>\n<tr>\n<td>MM<\/td>\n<td>\u6708\uff0c\u8865\u96f6\u663e\u793a\uff0c01-12<\/td>\n<\/tr>\n<tr>\n<td>yy<\/td>\n<td>\u5e74\uff0c\u4e24\u4f4d\u663e\u793a\uff0c00-99<\/td>\n<\/tr>\n<tr>\n<td>yyyy<\/td>\n<td>\u5e74\uff0c4\u4f4d\u6570\u5b57\u663e\u793a\uff0c\u5982 2016<\/td>\n<\/tr>\n<tr>\n<td>h<\/td>\n<td>\u5c0f\u65f6\uff0c\u4e0d\u8865\u96f6\uff0c0-23 \u6216 1-12 (\u5982\u679c\u663e\u793a AM\/PM)<\/td>\n<\/tr>\n<tr>\n<td>hhhh<\/td>\n<td>\u5c0f\u65f6\uff0c\u8865\u96f62\u4f4d\u663e\u793a\uff0c00-23 \u6216 01-12 (\u5982\u679c\u663e\u793a AM\/PM)<\/td>\n<\/tr>\n<tr>\n<td>H<\/td>\n<td>\u5c0f\u65f6\uff0c\u4e0d\u8865\u96f6\uff0c0-23 (\u5373\u4f7f\u663e\u793a AM\/PM)<\/td>\n<\/tr>\n<tr>\n<td>HH<\/td>\n<td>\u5c0f\u65f6\uff0c\u8865\u96f6\u663e\u793a\uff0c00-23 (\u5373\u4f7f\u663e\u793a AM\/PM)<\/td>\n<\/tr>\n<tr>\n<td>m<\/td>\n<td>\u5206\u949f\uff0c\u4e0d\u8865\u96f6\uff0c0-59<\/td>\n<\/tr>\n<tr>\n<td>mm<\/td>\n<td>\u5206\u949f\uff0c\u8865\u96f6\u663e\u793a\uff0c00-59<\/td>\n<\/tr>\n<tr>\n<td>z<\/td>\n<td>\u6beb\u79d2\uff0c\u4e0d\u8865\u96f6\uff0c0-999<\/td>\n<\/tr>\n<tr>\n<td>zzz<\/td>\n<td>\u6beb\u79d2\uff0c\u8865\u96f6 3 \u4f4d\u663e\u793a\uff0c000-999<\/td>\n<\/tr>\n<tr>\n<td>AP\u6216A<\/td>\n<td>\u4f7f\u7528 AM\/pm \u663e\u793a<\/td>\n<\/tr>\n<tr>\n<td>ap\u6216a<\/td>\n<td>\u4f7f\u7528 am\/pm \u663e\u793a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u5728\u8bbe\u7f6e\u65e5\u671f\u65f6\u95f4\u663e\u793a\u5b57\u7b26\u4e32\u683c\u5f0f\u65f6\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u586b\u5b57\u7b26\uff0c\u751a\u81f3\u4f7f\u7528\u6c49\u5b57\u3002\u4f8b\u5982\uff0c\u65e5\u671f\u663e\u793a\u683c\u5f0f\u53ef\u4ee5\u8bbe\u7f6e\u4e3a\uff1a<\/h4>\n<pre><code class=\"language-cpp line-numbers\">curDateTime.toString (\"yyyy \u5e74 MM \u6708 dd \u65e5\");\n<\/code><\/pre>\n<h4>\u8fd9\u6837\u5f97\u5230\u7684\u5b57\u7b26\u4e32\u662f\u201c2016\u5e7411\u670821\u65e5\u201d\u3002<\/h4>\n<h4>\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u65e5\u671f\u65f6\u95f4<\/h4>\n<h4>\u540c\u6837\u7684\uff0c\u4e5f\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a QTime\u3001QDate \u6216 QDateTime \u7c7b\u578b\uff0c\u4f7f\u7528\u9759\u6001\u51fd\u6570 QDateTime::fromString()\uff0c\u5176\u51fd\u6570\u539f\u578b\u4e3a\uff1a<\/h4>\n<pre><code class=\"language-cpp line-numbers\">QDateTime QDateTime::fromString(const QString &amp;string, const QString &amp;format)\n<\/code><\/pre>\n<h4>\u5176\u4e2d\uff0c\u7b2c 1 \u4e2a\u53c2\u6570 string \u662f\u65e5\u671f\u65f6\u95f4\u5b57\u7b26\u4e32\u5f62\u5f0f\uff0c\u7b2c 2 \u4e2a\u53c2\u6570 format \u662f\u5b57\u7b26\u4e32\u8868\u793a\u7684\u683c\u5f0f\uff0c\u6309\u7167\u8868 2 \u7684\u683c\u5f0f\u5b57\u7b26\u5b9a\u4e49\u3002<\/h4>\n<h3>\u5728\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u624b\u5de5\u4fee\u6539\u201c\u65e5\u671f\u65f6\u95f4\u201d\u540e\u9762\u6587\u672c\u6846\u91cc\u7684\u65e5\u671f\u65f6\u95f4\u5b57\u7b26\u4e32\uff0c\u5355\u51fb\u201c\u8bbe\u7f6e\u65e5\u671f\u65f6\u95f4\u201d\u6309\u94ae\uff0c\u53ef\u4ee5\u5c06\u6587\u672c\u6846\u91cc\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a QDateTime \u53d8\u91cf\uff0c\u5e76\u8bbe\u7f6e\u4e3a\u5de6\u4fa7 DateTimeEdit \u7ec4\u4ef6\u7684\u65e5\u671f\u65f6\u95f4\u6570\u636e\uff0c\u4ee3\u7801\u5982\u4e0b<\/h3>\n<pre><code class=\"language-cpp line-numbers\">void Dialog::on_btnSetDateTime_clicked()\n{\n    \/\/\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3aQDateTime\n    QString str=ui-&gt;editDateTime-&gt;text();\n    str=str.trimmed();\n    if (!str.isEmpty())\n    {\n        QDateTime datetime=QDateTime::fromString(str,\"yyyy-MM-dd hh:mm:ss\");\n        ui-&gt;dateTimeEdit-&gt;setDateTime(datetime);\n    }\n}\n<\/code><\/pre>\n<h4>\u9759\u6001\u51fd\u6570 QDateTime::fromString() \u5c06\u4e00\u4e2a\u5b57\u7b26\u4e32\u6309\u7167\u683c\u5f0f\u8f6c\u6362\u4e3a\u65e5\u671f\u65f6\u95f4\u7c7b\u578b\u3002\u7a0b\u5e8f\u4e2d\u7684\u4ee3\u7801\u662f\uff1a<\/h4>\n<pre><code class=\"language-cpp line-numbers\">datetime=QDateTime::fromString(str,\"yyyy-MM-dd hh:mm:ss\");\n<\/code><\/pre>\n<h4>\u8fd9\u91cc\u5c06\u5b57\u7b26\u4e32 str \u6309\u7167\u683c\u5f0f yyyy-MM-dd hh:mm:ss \u8f6c\u6362\u4e3a\u65e5\u671f\u65f6\u95f4\u53d8\u91cf\uff0c\u683c\u5f0f\u662f\u6307\u5b57\u7b26\u4e32 str \u6240\u8868\u793a\u7684\u65e5\u671f\u65f6\u95f4\u7684\u683c\u5f0f\u3002<\/h4>\n<h1>QCalendarWidget \u65e5\u5386\u7ec4\u4ef6<\/h1>\n<h4>\u56fe 1 \u7a97\u4f53\u53f3\u4fa7\u662f\u4e00\u4e2a QCalendarWidget \u7ec4\u4ef6\uff0c\u5b83\u4ee5\u65e5\u5386\u7684\u5f62\u5f0f\u663e\u793a\u65e5\u671f\uff0c\u53ef\u4ee5\u7528\u4e8e\u65e5\u671f\u9009\u62e9\u3002QCalendarWidget \u6709\u4e00\u4e2a\u4fe1\u53f7 selectionChanged()\uff0c\u5728\u65e5\u5386\u4e0a\u9009\u62e9\u7684\u65e5\u671f\u53d8\u5316\u540e\u4f1a\u53d1\u5c04\u6b64\u4fe1\u53f7\uff0c\u4e3a\u6b64\u4fe1\u53f7\u521b\u5efa\u69fd\u51fd\u6570\uff0c\u7f16\u5199\u4ee3\u7801\u5982\u4e0b\uff1a<\/h4>\n<pre><code class=\"language-cpp line-numbers\">void Dialog::on_calendarWidget_selectionChanged()\n{\n    \/\/\u5728\u65e5\u5386\u4e0a\u9009\u62e9\u65e5\u671f\n    QDate dt=ui-&gt;calendarWidget-&gt;selectedDate();\n    QString str=dt.toString(\"yyyy\u5e74 M \u6708 d \u65e5\");\n    ui-&gt;editCalendar-&gt;setText(str);\n\n}\n<\/code><\/pre>\n<div class=\"clearfix\"><\/div>","protected":false},"excerpt":{"rendered":"<p>PS:\u8f6c\u8f7d\u81ea(\u8bf7\u70b9\u51fb\u8df3\u8f6c) \u65f6\u95f4\u65e5\u671f\u662f\u7ecf\u5e38\u9047\u5230\u7684\u6570\u636e\u7c7b\u578b\uff0cQt \u4e2d\u65f6\u95f4\u65e5\u671f\u7c7b\u578b\u7684\u7c7b\u5982\u4e0b\uff1a QTime\uff1a\u65f6\u95f4\u6570\u636e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=\/wp\/v2\/posts\/346"}],"collection":[{"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346"}],"version-history":[{"count":7,"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions"}],"predecessor-version":[{"id":353,"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions\/353"}],"wp:attachment":[{"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gongyikun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}