{"id":2225,"date":"2025-10-10T11:33:11","date_gmt":"2025-10-10T02:33:11","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=2225"},"modified":"2025-10-11T11:40:09","modified_gmt":"2025-10-11T02:40:09","slug":"qtexample2-qml2","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2025\/10\/10\/qtexample2-qml2\/","title":{"rendered":"[QT]example2-QML(2)"},"content":{"rendered":"\n<h6 class=\"wp-block-heading\"><strong>1.QML<\/strong><\/h6>\n\n\n\n<p>&#8212; \uc131\ub2a5\uc774 \uc911\uc694\ud55c \ubd80\ubd84\uc740 C++\ub85c \uad6c\ud604\ud558\uace0 \ub2e4\uc790\uc778\uc774\ub098 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ubb38\ubc95\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>Performance-critical parts are implemented in C++ and design or JavaScript syntax is used.<\/p>\n\n\n\n<p>&#8212; \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\ub97c QML\ub0b4\uc5d0\uc11c \uc2e4\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>You can run JavaScript within QML.<\/p>\n\n\n\n<p>&#8212; \ud130\uce58 \uae30\ubc18 \ubc0f \uc784\ubca0\ub514\ub4dc \uc7a5\uce58\uc758 UI\uc7a5\uce58 \uac1c\ubc1c\uc5d0 \uac15\ub825\ud55c \ub3c4\uad6c\ub85c \ud65c\uc6a9\ub429\ub2c8\ub2e4.<br>It is used as a powerful tool for developing UI devices for touch-based and embedded devices.<\/p>\n\n\n\n<p>&#8212; \uc8fc\uc694\uae30\ub2a5 \ubc0f \ud2b9\uc9d5\uc740 \uc544\ub798\uc640 \uac19\uc2b5\ub2c8\ub2e4.<br>Key features and characteristics are as follows:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\ubd84\ub958 \/ Classification<\/th><th>\uc124\uba85 \/ Description<\/th><\/tr><\/thead><tbody><tr><td><strong>\uc120\uc5b8\ud615 \ubb38\ubc95 \/ declarative syntax<\/strong><\/td><td>UI \uad6c\uc131\uc694\uc18c\ub97c \ud2b8\ub9ac\ud615 \uad6c\uc870\ub85c \u201c\uc120\uc5b8\u201d\ud568 (<code>Rectangle<\/code>, <code>Text<\/code>, <code>Button<\/code> \ub4f1)<br>\u201cDeclare\u201d UI components in a tree-like structure (Rectangle, Text, Button, etc.)<\/td><\/tr><tr><td><strong>JS \ud1b5\ud569<\/strong> \/ JS integration<\/td><td>JavaScript \ucf54\ub4dc\ub97c \uc790\uc5f0\uc2a4\ub7fd\uac8c \ud3ec\ud568 \uac00\ub2a5 (\uc774\ubca4\ud2b8 \ucc98\ub9ac, \uc218\uc2dd \uacc4\uc0b0, \uc870\uac74 \ub4f1)<br>Ability to naturally include JavaScript code (event handling, formula calculations, conditions, etc.)<\/td><\/tr><tr><td><strong>\uc18d\uc131 \ubc14\uc778\ub529 \/ Property Binding<\/strong><\/td><td>\uac12\uc774 \uc790\ub3d9\uc73c\ub85c \uc5f0\uacb0\ub418\uc5b4 \ub3d9\uc801\uc73c\ub85c \ubc18\uc751 (ex. <code>width: parent.width \/ 2<\/code>)<br>Values \u200b\u200bare automatically concatenated and react dynamically (e.g. width: parent.width \/ 2)<\/td><\/tr><tr><td><strong>\uc2dc\uadf8\ub110\/\uc2ac\ub86f<\/strong><br>(<strong> Signal &amp; Slot)<\/strong><\/td><td>Qt\uc758 \uc774\ubca4\ud2b8 \uc2dc\uc2a4\ud15c\uc744 QML\uc5d0\uc11c \uc0ac\uc6a9 (<code>onClicked<\/code>, <code>onTextChanged<\/code> \ub4f1)<br>Using Qt&#8217;s event system in QML (onClicked, onTextChanged, etc.)<\/td><\/tr><tr><td><strong>C++ \uc5f0\ub3d9 \uac00\ub2a5 <\/strong><br>(<strong>C++ interoperable<\/strong>)<\/td><td>QML\uc5d0\uc11c C++ \uac1d\uccb4\/\ud568\uc218\/\ubcc0\uc218\ub97c \ud638\ucd9c\ud558\uac70\ub098 \uc811\uadfc \uac00\ub2a5<br>Ability to call or access C++ objects\/functions\/variables from QML<\/td><\/tr><tr><td><strong>\uc560\ub2c8\uba54\uc774\uc158 \uc9c0\uc6d0 <\/strong><br><strong>(Animation support)<\/strong><\/td><td>Transition, Behavior, Animation \ub4f1\uc744 \ud1b5\ud574 \ubd80\ub4dc\ub7ec\uc6b4 \ud6a8\uacfc \uad6c\ud604 \uac00\ub2a5<br>Smooth effects can be achieved through Transition, Behavior, and Animation.<\/td><\/tr><tr><td><strong>\ucef4\ud3ec\ub10c\ud2b8 \uc7ac\uc0ac\uc6a9<\/strong><br><strong>(Component reuse)<\/strong><\/td><td>\uc0ac\uc6a9\uc790 \uc815\uc758 QML \ucef4\ud3ec\ub10c\ud2b8 \uc0dd\uc131 \uac00\ub2a5 (<code>MyButton.qml<\/code> \ub4f1)<br>Ability to create custom QML components (e.g. MyButton.qml)<\/td><\/tr><tr><td><strong>\uc0c1\ud0dc,\ud2b8\ub79c\uc9c0\uc158 \uc2dc\uc2a4\ud15c<\/strong><br><strong> (State and transition system<\/strong>)<\/td><td>State\uc640 Transition\uc73c\ub85c UI \uc0c1\ud0dc \ubcc0\ud654 \uc81c\uc5b4<br>Control UI state changes with State and Transition<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">QML\uc8fc\uc694 \uae30\ub2a5 \ubc0f \ud2b9\uc9d5 \/ QML Key Features and Features<\/figcaption><\/figure>\n\n\n\n<p>&#8212; QML\uc5d0\uc11c \uc644\uc804\ud788 \uc0ac\uc6a9 \uac00\ub2a5\ud55c JavaScript \uae30\ub2a5<br><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\ubc94\uc8fc \/ Category<\/th><th>\uc0ac\uc6a9 \uac00\ub2a5 \uc608\uc2dc \/ Available examples<\/th><\/tr><\/thead><tbody><tr><td><strong>\ubcc0\uc218\/\ud568\uc218\/\uac1d\uccb4<\/strong><br>(Variable\/Function\/Object)<\/td><td><code>var<\/code>, <code>let<\/code>, <code>const<\/code>, <code>function<\/code>, \uac1d\uccb4 \ub9ac\ud130\ub7f4 <code>{}<\/code><br>var,let,const,function,object literal{}<\/td><\/tr><tr><td><strong>\uc81c\uc5b4\ubb38<\/strong><br>(Control Statement)<\/td><td><code>if<\/code>, <code>for<\/code>, <code>while<\/code>, <code>switch<\/code> &#8230;<\/td><\/tr><tr><td><strong>\uc218\ud559 \uc5f0\uc0b0<\/strong><br>(math operations)<\/td><td><code>Math.pow()<\/code>, <code>Math.random()<\/code><\/td><\/tr><tr><td><strong>\ubb38\uc790\uc5f4 \ucc98\ub9ac<\/strong><br>(String processing)<\/td><td><code>String<\/code>, <code>.substring()<\/code>, <code>.split()<\/code> &#8230;<\/td><\/tr><tr><td><strong>\ub0a0\uc9dc \ucc98\ub9ac<\/strong><br>(Date processing)<\/td><td><code>Date()<\/code><\/td><\/tr><tr><td><strong>\ubc30\uc5f4 \uad00\ub828<\/strong><br>(Array related)<\/td><td><code>Array<\/code>, <code>.map()<\/code>, <code>.filter()<\/code>, <code>.reduce()<\/code><\/td><\/tr><tr><td><strong>\uc5d0\ub7ec \ucc98\ub9ac<\/strong><br>(Error handling)<\/td><td><code>try\/catch<\/code>, <code>throw<\/code><\/td><\/tr><tr><td><strong>\ud0c0\uc774\uba38<\/strong><br>(Timer)<\/td><td><code>Timer<\/code> QML \ud0c0\uc785 \ub610\ub294 JS <code>setTimeout()<\/code> (\uc77c\ubd80 \ud658\uacbd\ub9cc)<br>Timer QML type or JS setTimeout() (some environments only)<\/td><\/tr><tr><td><strong>\ud568\uc218\ud615 \ud328\ud134<\/strong><br>(Functional pattern)<\/td><td>\ucf5c\ubc31, \ud074\ub85c\uc800, \uc2a4\ucf54\ud504, \uc775\uba85 \ud568\uc218 \ub4f1<br>Callbacks, closures, scopes, anonymous functions, etc.<\/td><\/tr><tr><td><strong>\ubaa8\ub4c8\ud654<\/strong><br>(Modularization)<\/td><td><code>.js<\/code> \ud30c\uc77c\uc744 <code>import \"myutils.js\" as Utils<\/code> \ub85c \ubd88\ub7ec\uc624\uae30 \uac00\ub2a5<br>You can import .js files with import &#8220;myutils.js&#8221; as Utils<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">QML\uc5d0\uc11c \uc0ac\uc6a9\uac00\ub2a5\ud55c \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \uae30\ub2a5 \/ JavaScript features available in QML<\/figcaption><\/figure>\n\n\n\n<p>&#8212; QML\uc5d0\uc11c \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\uc758 \ubaa8\ub4e0 \uae30\ub2a5\uc744 \uc0ac\uc6a9 \ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.<br>You can&#8217;t use all the features of JavaScript in QML.<\/p>\n\n\n\n<p>&#8212; \uadf8\ub798\uc11c \ub098\uba38\uc9c0 \uae30\ub2a5\uc740 C++\ub85c \uad6c\ud604\ud574\uc57c \ud569\ub2c8\ub2e4.<br>So the rest of the functionality needs to be implemented in C++.<\/p>\n\n\n\n<p>&#8212; \uc544\ub798\ub294 C++\ub85c QML\uc758 \ubd80\uc871\ud55c \uae30\ub2a5\uc744 \ud574\uacb0\ud558\ub294 \ubc29\ubc95\uc785\ub2c8\ub2e4.<br>Below is how to work around QML&#8217;s shortcomings with C++.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\ubaa9\uc801 \/ Purpose<\/th><th>\ud574\uacb0\ucc45 \/ Solution<\/th><\/tr><\/thead><tbody><tr><td>\ud30c\uc77c \uc785\ucd9c\ub825<br>(file input\/output)<\/td><td>C++\uc5d0\uc11c <code>QFile<\/code>, <code>QIODevice<\/code> \uc0ac\uc6a9\ud558\uace0 QML\uc5d0 \ub178\ucd9c<\/td><\/tr><tr><td>HTTP \ud1b5\uc2e0<br>(HTTP communication)<\/td><td><code>Qt.labs.network<\/code> \ub610\ub294 C++ <code>QNetworkAccessManager<\/code><\/td><\/tr><tr><td>\ube44\ub3d9\uae30 \ucc98\ub9ac<br>(Asynchronous processing)<\/td><td>QML\uc758 <code>Timer<\/code>, C++ Signal\/Slot, WorkerScript<\/td><\/tr><tr><td>\ub370\uc774\ud130 \uc800\uc7a5<br>(Data storage)<\/td><td><code>Qt.labs.settings<\/code> \ub610\ub294 C++ SQLite<\/td><\/tr><tr><td>\ubcf5\uc7a1\ud55c \ub85c\uc9c1<br>(Complex logic)<\/td><td>C++\ub85c \uad6c\ud604 \ud6c4 QML\uc5d0 <code>setContextProperty()<\/code> \ub85c \uc804\ub2ec<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">QML\uc5d0\uc11c \ubd80\uc871\ud55c JS \uae30\ub2a5\uc744 \ubcf4\uc644\ud558\ub294 \ubc29\ubc95<\/figcaption><\/figure>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>2.\uc804\uccb4\ucf54\ub4dc \/ Full Code<\/strong><\/h6>\n\n\n\n<p>&#8212; \uc544\ub798\ub294 \uc774\uc804\uc5d0 example1\uc5d0\uc11c \ub2e4\ub918\ub358 \ud504\ub85c\uadf8\ub7a8\uc5d0 \uae30\ub2a5\uc744 \ucd94\uac00\ud55c QML\ucf54\ub4dc \uc785\ub2c8\ub2e4<br>Below is the QML code that adds functionality to the program previously covered in example1.<\/p>\n\n\n\n<p>&#8212; \ud50c\ub808\uc774\uc2a4\ud640\ub354 \uae30\ub2a5\uc774 \ucd94\uac00\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4.<br>Added placeholder functionality.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\n\/*\nThis is a UI file (.ui.qml) that is intended to be edited in Qt Design Studio only.\nIt is supposed to be strictly declarative and only uses a subset of QML. If you edit\nthis file manually, you might introduce QML code that is not supported by Qt Design Studio.\nCheck out https:\/\/doc.qt.io\/qtcreator\/creator-quick-ui-forms.html for details on .ui.qml files.\n*\/\nimport QtQuick\nimport QtQuick.Controls\n\n\nRectangle {\n    id: mainBackground \/\/ ID \ucd94\uac00 \/ Add ID\n\n    \/\/ \uc0c1\uc218 \uc9c1\uc811 \uc120\uc5b8 \/ Declare constants directly\n    property int widthConst: 1920\n    property int heightConst: 1080\n    property color backgroundColorConst: \"#EAEAEA\"\n\n    \/\/ === \ud50c\ub808\uc774\uc2a4\ud640\ub354 \uc0c9\uc0c1 \uc0c1\uc218 (#AAAAAA: \uc5f0\ud68c\uc0c9) ===\n    \/\/ === Placeholder color constant (#AAAAAA: light gray) ===\n    property color placeholderColor: \"#AAAAAA\"\n\n    \/\/ \uc2e4\uc81c \uc785\ub825 \ud14d\uc2a4\ud2b8 \uc0c9\uc0c1 \/ Actual input text color\n    property color inputTextColor: \"black\"\n\n    width: widthConst\n    height: heightConst\n    color: backgroundColorConst\n\n    \/\/ === \ubc30\uacbd \ud074\ub9ad \uc2dc \ud3ec\ucee4\uc2a4\ub97c \uac00\uc838\uc640 TextEdit\uc758 \ud3ec\ucee4\uc2a4 \uc0c1\uc2e4 \uc774\ubca4\ud2b8 (onActiveFocusChanged)\ub97c \ud2b8\ub9ac\uac70\ud569\ub2c8\ub2e4. ===\n    \/\/ === When clicking on the background, it brings focus and triggers the TextEdit's focus-lost event (onActiveFocusChanged). ===\n    focus: true\n    MouseArea {\n        anchors.fill: parent\n        onClicked: {\n            \/\/ \ubc30\uacbd\uc744 \ud074\ub9ad\ud558\uba74 TextEdit\uc5d0\uc11c \ud3ec\ucee4\uc2a4\ub97c \uba85\uc2dc\uc801\uc73c\ub85c \ud574\uc81c\n            \/\/ Clicking on the background explicitly releases focus from the TextEdit\n            mainBackground.forceActiveFocus();\n        }\n    }\n    \/\/ ==========================================================================================================\n\n    Column {\n        id: column\n        width: 200\n        anchors.centerIn: parent\n        spacing: 10\n\n        \/\/ \uc785\ub825 \ud544\ub4dc 1 \/ input field 1\n        Rectangle {\n            width: 180\n            height: 30\n            color: \"white\"\n            border.color: \"black\"\n\n            TextEdit {\n                id: textEdit\n\n                \/\/ === &#91;\ud575\uc2ec \uc218\uc815 1] \ud0ed\/\ud3ec\ucee4\uc2a4 \ud65c\uc131\ud654: \uccab \ubc88\uc9f8 \uc694\uc18c\uc5d0 \ud3ec\ucee4\uc2a4\ub97c \uc124\uc815\ud569\ub2c8\ub2e4. ===\n                \/\/ === &#91;Core Fix 1] Enable tab\/focus: Set focus to the first element. ===\n                focus: true\n\n                \/\/ \ub9c8\uc6b0\uc2a4\ub85c \uc120\ud0dd \uac00\ub2a5\ud558\uac8c \uc124\uc815\ud558\uc5ec \uc0ac\uc6a9\uc131 \uac1c\uc120\n                \/\/ Improve usability by enabling selection with the mouse\n                selectByMouse: true\n\n                \/\/ === &#91;\uae30\ub2a5] \ud14d\uc2a4\ud2b8 \ub0b4\uc6a9\uc5d0 \ub530\ub77c \uc0c9\uc0c1\uc744 \ub3d9\uc801\uc73c\ub85c \ubc14\uc778\ub529\ud569\ub2c8\ub2e4. ===\n                \/\/ === &#91;Function] Dynamically bind colors based on text content. ===\n                color: text === placeholderText ? mainBackground.placeholderColor : mainBackground.inputTextColor\n\n                \/\/ === &#91;\ud575\uc2ec \uc218\uc815] Tab \ud0a4 \uc785\ub825 \uc2dc \ub2e4\uc74c \ucef4\ud3ec\ub10c\ud2b8\ub97c \uba85\uc2dc\uc801\uc73c\ub85c \ud638\ucd9c\ud569\ub2c8\ub2e4. ===\n                \/\/ === &#91;Core fix] Explicitly call the following components when pressing the Tab key. ===\n                Keys.onPressed: {\n                    if (event.key === Qt.Key_Tab) {\n\n                        \/\/ \ud14d\uc2a4\ud2b8 \ud544\ub4dc\uc5d0\uc11c \ud0ed \ubb38\uc790 \uc785\ub825\uc744 \ub9c9\uc2b5\ub2c8\ub2e4.\n                        \/\/ Prevents tab character entry in text field.\n                        event.accepted = true;\n\n                        \/\/ \ub2e4\uc74c \uc785\ub825 \ud544\ub4dc\uc778 textEdit2\ub85c \ud3ec\ucee4\uc2a4\ub97c \uac15\uc81c \uc774\ub3d9\ud569\ub2c8\ub2e4.\n                        \/\/ Force focus to the next input field, textEdit2.\n                        textEdit2.forceActiveFocus();\n                    }\n                }\n\n                \/\/ === \ud45c\uc900 Placeholder \ub85c\uc9c1 ===\n                \/\/ === Standard Placeholder Logic ===\n                property string placeholderText: qsTr(\"\uc785\ub8251\/input1\")\n                text: placeholderText\n\n                onActiveFocusChanged: {\n                    \/\/ .trim()\uc744 \uc0ac\uc6a9\ud558\uc5ec \uacf5\ubc31 \ubb38\uc81c\ub97c \ubc29\uc9c0\ud558\uace0 \uc815\ud655\ud558\uac8c \ube44\uad50\n                    \/\/ Use .trim() to avoid whitespace issues and compare accurately\n                    if (activeFocus &amp;&amp; text.trim() === placeholderText.trim()) {\n                        text = \"\"\n                    } else if (!activeFocus &amp;&amp; text.trim() === \"\") {\n                        text = placeholderText\n                    }\n                }\n                \/\/ ===============================\n\n                anchors.fill: parent\n                font.pixelSize: 12\n            }\n        }\n\n        \/\/ \uc785\ub825 \ud544\ub4dc 2 \/ input field 2\n        Rectangle {\n            width: 180\n            height: 30\n            color: \"white\"\n            border.color: \"black\"\n\n            TextEdit {\n                id: textEdit2\n\n                \/\/ \ub9c8\uc6b0\uc2a4\ub85c \uc120\ud0dd \uac00\ub2a5\ud558\uac8c \uc124\uc815\ud558\uc5ec \uc0ac\uc6a9\uc131 \uac1c\uc120\n                \/\/ Improve usability by enabling selection with the mouse\n                selectByMouse: true\n\n                \/\/ === &#91;\uae30\ub2a5] \ud14d\uc2a4\ud2b8 \ub0b4\uc6a9\uc5d0 \ub530\ub77c \uc0c9\uc0c1\uc744 \ub3d9\uc801\uc73c\ub85c \ubc14\uc778\ub529\ud569\ub2c8\ub2e4. ===\n                \/\/ === &#91;Function] Dynamically bind colors based on text content. ===\n                color: text === placeholderText ? mainBackground.placeholderColor : mainBackground.inputTextColor\n\n                \/\/ === &#91;\ud575\uc2ec \uc218\uc815] Tab \ud0a4 \uc785\ub825 \uc2dc \ub2e4\uc74c \ucef4\ud3ec\ub10c\ud2b8\ub97c \uba85\uc2dc\uc801\uc73c\ub85c \ud638\ucd9c\ud569\ub2c8\ub2e4. ===\n                \/\/ === &#91;Core fix] Explicitly call the following components when pressing the Tab key. ===\n                Keys.onPressed: {\n                    if (event.key === Qt.Key_Tab) {\n                        \/\/ \ud14d\uc2a4\ud2b8 \ud544\ub4dc\uc5d0\uc11c \ud0ed \ubb38\uc790 \uc785\ub825\uc744 \ub9c9\uc2b5\ub2c8\ub2e4.\n                        \/\/ Prevents tab character entry in text field.\n                        event.accepted = true;\n\n                        \/\/ \ub2e4\uc74c \ucef4\ud3ec\ub10c\ud2b8\uc778 button\uc73c\ub85c \ud3ec\ucee4\uc2a4\ub97c \uac15\uc81c \uc774\ub3d9\ud569\ub2c8\ub2e4.\n                        \/\/ Force focus to the next component, button.\n                        button.forceActiveFocus();\n                    }\n                }\n\n                \/\/ === \ud45c\uc900 Placeholder \ub85c\uc9c1 ===\n                \/\/ === Standard Placeholder Logic ===\n                property string placeholderText: qsTr(\"\uc785\ub8252\/input2\")\n                text: placeholderText\n\n                onActiveFocusChanged: {\n                    if (activeFocus &amp;&amp; text.trim() === placeholderText.trim()) {\n                        text = \"\"\n                    } else if (!activeFocus &amp;&amp; text.trim() === \"\") {\n                        text = placeholderText\n                    }\n                }\n                \/\/ ===============================\n\n                anchors.fill: parent\n                font.pixelSize: 12\n            }\n        }\n\n        \/\/ \uac12 \ucd9c\ub825 \ud544\ub4dc \/ value output field\n        Text {\n            id: text1\n            text: qsTr(\"\uac12\ucd9c\ub825\/Print Value\")\n            font.pixelSize: 12\n        }\n\n        \/\/ \ubc84\ud2bc \ucef4\ud3ec\ub10c\ud2b8 \/ Button component\n        Button {\n            id: button\n            text: qsTr(\"\uac12 \ucd9c\ub825\/Print Value\")\n\n            onClicked: {\n                \/\/ \ubc84\ud2bc \ud074\ub9ad \uc2dc \ud50c\ub808\uc774\uc2a4\ud640\ub354 \ud14d\uc2a4\ud2b8\ub97c \uc81c\uc678\ud558\uace0 \uc2e4\uc81c \uc785\ub825\uac12\ub9cc \ucd9c\ub825\ud569\ub2c8\ub2e4.\n                \/\/ When the button is clicked, only the actual input value is output, excluding the placeholder text.\n                let input1 = textEdit.text.trim() === textEdit.placeholderText.trim() ? \"\" : textEdit.text;\n                let input2 = textEdit2.text.trim() === textEdit2.placeholderText.trim() ? \"\" : textEdit2.text;\n\n                text1.text = qsTr(\"\ucd9c\ub825\uac12\/output value: \") + input1 + input2\n            }\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>3.\uc2e4\ud589 \/ Run<\/strong><\/h6>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"684\" height=\"557\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/10\/example2-1.png\" alt=\"\" class=\"wp-image-2241\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/10\/example2-1.png 684w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/10\/example2-1-300x244.png 300w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>1.QML &#8212; \uc131\ub2a5\uc774 \uc911\uc694\ud55c \ubd80\ubd84\uc740 C++\ub85c \uad6c\ud604\ud558\uace0 \ub2e4\uc790\uc778\uc774\ub098 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ubb38\ubc95\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.Performance-critical parts are implemented in C++ and design or JavaScript syntax is used. &#8212; \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\ub97c QML\ub0b4\uc5d0\uc11c \uc2e4\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.You can run JavaScript within QML. &#8212; \ud130\uce58 \uae30\ubc18 \ubc0f \uc784\ubca0\ub514\ub4dc \uc7a5\uce58\uc758 UI\uc7a5\uce58 \uac1c\ubc1c\uc5d0 \uac15\ub825\ud55c \ub3c4\uad6c\ub85c \ud65c\uc6a9\ub429\ub2c8\ub2e4.It is used as a powerful tool for developing UI devices [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,1],"tags":[],"class_list":["post-2225","post","type-post","status-publish","format-standard","hentry","category-qt","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/2225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=2225"}],"version-history":[{"count":14,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/2225\/revisions"}],"predecessor-version":[{"id":2242,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/2225\/revisions\/2242"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=2225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=2225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=2225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}