{"id":2919,"date":"2025-11-28T11:17:26","date_gmt":"2025-11-28T02:17:26","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=2919"},"modified":"2025-11-28T17:13:15","modified_gmt":"2025-11-28T08:13:15","slug":"qt-qmlapplicationwindow-and-window","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2025\/11\/28\/qt-qmlapplicationwindow-and-window\/","title":{"rendered":"[QT QML]ApplicationWindow and Window"},"content":{"rendered":"\n<p>\ud83d\udc49\ud83c\udffb QT QML\uc5d0\uc11c \uc708\ub3c4\uc6b0 \uad6c\ud604\uc2dc \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158 \uc708\ub3c4\uc6b0 \ud0c0\uc785\uacfc \uc708\ub3c4\uc6b0 \ud0c0\uc785\uc5d0 \ub300\ud55c \uc124\uba85\uc785\ub2c8\ub2e4.<br>This is a description of application window types and window types when implementing windows in QT QML.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb Window : <\/p>\n\n\n\n<p>\u2714\ufe0f\uac00\uc7a5 \uae30\ubcf8\uc801\uc778 \uc708\ub3c4\uc6b0 \ucee8\ud14c\uc774\ub108. \ub2e8\uc21c \ucc3d\uc73c\ub85c, \uba54\ub274, \ud234\ubc14, \uc0c1\ud0dc\ubc14 \ub4f1 \uace0\uae09 UI \uad6c\uc131 \uc694\uc18c\ub294 \uc5c6\uc2b5\ub2c8\ub2e4.<br>The most basic window container. It&#8217;s a simple window, lacking advanced UI elements like menus, toolbars, or status bars.<\/p>\n\n\n\n<p>\u2714\ufe0f \uc708\ub3c4\uc6b0\ub294 \uac8c\uc784, \uc2dc\ubbac\ub808\uc774\uc158, \ub2e8\uc21c \ub3c4\uad6c UI, \ud31d\uc5c5\uc744 \uad6c\ud604\ud558\ub294 \uacbd\uc6b0 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>Windows is used for implementing games, simulations, simple tool UIs, and pop-ups.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb ApplicationWindow : <\/p>\n\n\n\n<p>\u2714\ufe0f Window\ub97c \uc0c1\uc18d\ubc1b\uc544 Qt Quick Controls 2\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 \uba54\ub274\ubc14, \ud234\ubc14, \uc0c1\ud0dc\ubc14 \ub4f1\uc744 \uc27d\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub3c4\ub85d \ud655\uc7a5\ub41c \uc708\ub3c4\uc6b0 \ud0c0\uc785\uc785\ub2c8\ub2e4.<br>This is an extended window type that inherits from Window and allows easy use of menu bars, toolbars, status bars, etc. provided by Qt Quick Controls 2.<\/p>\n\n\n\n<p>\u2714\ufe0f \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc708\ub3c4\uc6b0\ub294 \uc77c\ubc18 \ub370\uc2a4\ud06c\ud0d1 \uc571, \uba54\ub274\/\ud234\ubc14\/\uc0c1\ud0dc\ubc14 \ud544\uc218\ub85c \uc0ac\uc6a9\ud558\ub294 \uacbd\uc6b0\ub098 macOS \uc2dc\uc2a4\ud15c \uba54\ub274 \uc5f0\ub3d9 \ud544\uc694\ud55c \uacbd\uc6b0\uc5d0 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>Application windows are used when general desktop apps require menus\/toolbars\/status bars, or when macOS system menu integration is required.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb MacOS \uba54\ub274 \ud2b9\uc9d5 \/ MacOS Menu Features<\/p>\n\n\n\n<p>\u2714\ufe0fMacOS\uc5d0\uc11c\ub294 \uc544\ub798\uc758 \uc0ac\uc9c4\ucc98\ub7fc \ud504\ub85c\uadf8\ub7a8\uc758 \uba54\ub274\ub294 \uc708\ub3c4\uc6b0\uc5d0 \ubd99\uc5b4 \uc788\uc2b5\ub2c8\ub2e4.<br>On MacOS, the program&#8217;s menu is attached to the window, as shown in the picture below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"518\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/11\/brImage.png\" alt=\"\" class=\"wp-image-2923\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/11\/brImage.png 934w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/11\/brImage-300x166.png 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/11\/brImage-768x426.png 768w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/11\/brImage-400x222.png 400w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2025\/11\/brImage-800x444.png 800w\" sizes=\"auto, (max-width: 934px) 100vw, 934px\" \/><\/figure>\n\n\n\n<p>\u2714\ufe0f MacOS\uc758 \uc2dc\uc2a4\ud15c\uba54\ub274\uc640 \ucda9\ub3cc\ud558\ub294 \uacbd\uc6b0 \uba54\ub274\uac00 \ub098\ud0c0\ub098\uc9c0 \uc54a\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>If there is a conflict with the system menu of macOS, the menu may not appear.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uc708\ub3c4\uc6b0 \ud0c0\uc785\uacfc \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \ucc28\uc774\uc810<br>Differences between Windows types and applications<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\ud56d\ubaa9 \/ Item<\/th><th>Window<\/th><th>ApplicationWindow<\/th><\/tr><\/thead><tbody><tr><td><strong>menuBar <\/strong>\uc9c0\uc6d0<br>menuBar support<\/td><td>\uc5c6\uc74c \/ No<\/td><td>\uc788\uc74c (<code>menuBar<\/code> \uc18d\uc131)<br>Yes (menuBar property)<\/td><\/tr><tr><td><strong>toolBar<\/strong> \uc9c0\uc6d0<br>toolBar support<\/td><td>\uc5c6\uc74c \/ No<\/td><td>\uc788\uc74c (<code>toolBar<\/code> \uc18d\uc131)<br>Yes (toolBar property)<\/td><\/tr><tr><td><strong>statusBar <\/strong>\uc9c0\uc6d0<br>statusBar support<\/td><td>\uc5c6\uc74c \/ No<\/td><td>\uc788\uc74c (<code>statusBar<\/code> \uc18d\uc131)<br>Yes (statusBar property)<\/td><\/tr><tr><td>\ub808\uc774\uc544\uc6c3<br>Layout<\/td><td>\ub2e8\uc21c \/ Simple<\/td><td>\uba54\ub274\/\ud234\ubc14\/\uc0c1\ud0dc\ubc14\uac00 \ub808\uc774\uc544\uc6c3\uc5d0 \uc790\ub3d9 \ubc30\uce58\ub428<br>Menu\/ToolBar\/StatusBar automatically managed<\/td><\/tr><tr><td><strong>\uae30\ubcf8 \ucee8\ud2b8\ub864<\/strong><br>Built-in controls<\/td><td>\uc5c6\uc74c \/ No<\/td><td>Qt Quick Controls 2 \ucef4\ud3ec\ub10c\ud2b8\uc640 \ud638\ud658 \ucd5c\uc801\ud654<br>Optimized for Qt Quick Controls 2 components<\/td><\/tr><tr><td><strong>macOS \uba54\ub274\ubc14<\/strong><br>macOS system menu<\/td><td>\uc2dc\uc2a4\ud15c \uba54\ub274\ubc14\uc640 \uc5f0\ub3d9 \ubd88\uac00\ub2a5\ud568<br>Not supported<\/td><td>macOS \uc2dc\uc2a4\ud15c \uba54\ub274\ubc14\uc640 \uc790\ub3d9 \uc5f0\ub3d9<br>Automatically integrated with macOS system menu bar<\/td><\/tr><tr><td><strong>\uc708\ub3c4\uc6b0 \ub0b4\ubd80 \uba54\ub274<\/strong><br>Internal window menu<\/td><td>\uad6c\ud604 \ud544\uc694<br>Must be implemented manually<\/td><td>menuBar \uc18d\uc131 \uc0ac\uc6a9 \uac00\ub2a5<br>Available via menuBar property<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \ucf54\ub4dc \/ Code<\/p>\n\n\n\n<p>\u2714\ufe0f \uc544\ub798\ub294 \uc708\ub3c4\uc6b0 \ud0c0\uc785\uacfc \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158 \uc708\ub3c4\uc6b0 \ud0c0\uc785\uc5d0\uc11c \uba54\ub274\ub97c \uad6c\ud604\ud558\ub294 \ucf54\ub4dc\uc785\ub2c8\ub2e4.<br>Below is the code that implements the menu in the window type and application window type.<\/p>\n\n\n\n<p>\u2714\ufe0f\uc708\ub3c4\uc6b0 \ud0c0\uc785\uc5d0\uc11c\ub294 \uba54\ub274\ub97c \uad6c\ud604\ud574\uc57c\ud558\uba70 MacOS\uc640 \ud638\ud658\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<br>The Windows type requires the implementation of a menu and is not compatible with MacOS.<\/p>\n\n\n\n<p>\u2714\ufe0fMain.qml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import QtQuick\nimport QtQuick.Controls\n\nWindow {\n    width: 640\n    height: 480\n    visible: true\n    title: qsTr(\"Window\")\n\n\n    Column {\n        anchors.fill: parent\n\n        Rectangle {\n            color:\"lightblue\"\n            width:parent.width\n            height:30 \/\/ \ub192\uc774 \uc9c0\uc815\ud558\uc9c0 \uc54a\uc73c\uba74 Recangle\uc774 \uc548\ubcf4\uc784 \/ Recangle is not visible if height is not specified\n\n            Row{\n                anchors.left: parent.left \/\/ Row\uc758 \uc67c\ucabd\uc744 column\uc758 \uc67c\ucabd\uc5d0 \ub9de\ucd94\uae30 \/ Align the left side of the row to the left side of the column\n                anchors.leftMargin: 10 \/\/ \uc88c\uce21 \uac04\uaca9\n                anchors.verticalCenter: parent.verticalCenter \/\/ \uc218\uc9c1 \uc911\uc559 \uc815\ub82c \/ vertical center alignment\n\n                spacing : 20 \/\/ Row\uc548\uc5d0 \uc788\ub294 \uc544\uc774\ud15c\ub4e4\uc758 \uac04\uaca9 \/ Spacing between items in a row\n\n                Text {\n                    id:fileText\n                    text: \"File\"\n                    color: \"#333\"\n                    MouseArea {\n                        \n                        \/\/ \ub9c8\uc6b0\uc2a4 \ud074\ub9ad \uc601\uc5ed\uc744 Text\uc804\uccb4\ub85c \uc124\uc815\n                        \/\/ Set the mouse click area to the entire text\n                        \n                        anchors.fill: parent\n                        onClicked: fileMenu.open(fileText)\n                    }\n                }\n                Text {\n                    id:editText\n                    text: \"Edit\";\n                    color: \"#333\"\n\n                    MouseArea {\n                        anchors.fill : parent\n                        onClicked: editMenu.open(editText)\n                    }\n                }\n            }\n\n        }\n        Text{\n            text : \"Window\"\n            font.pixelSize: 25\n            anchors.centerIn: parent\n\n        }\n\n        \/\/ File \uba54\ub274 \/ File Menu\n        Menu {\n            id: fileMenu\n            title: \"File\"\n            MenuItem { text: \"New\" }\n            MenuItem { text: \"Open...\" }\n            MenuItem { text: \"Save\" }\n            MenuItem {\n                text: \"Open ApplicatioonWindow\"\n                onTriggered: {\n\n                    \/\/ \uc0c8\ucc3d \ub744\uc6b0\uae30,ApplicationWindow.qml \ubd88\ub7ec\uc624\uae30 \n                    \/\/ Open a new window, load ApplicationWindow.qml\n                    \n                    var component = Qt.createComponent(\"ApplicationWindow.qml\")\n                    if (component.status === Component.Ready) {\n                        var newWin = component.createObject(null)  \/\/ parent \uc5c6\uc774 \uc0c8 \ucc3d \/ New window without parent\n                        if (newWin) newWin.visible = true\n                    } else {\n                        console.log(\"Error loading component:\", component.errorString())\n                    }\n                }\n            }\n            MenuItem { text: \"Exit\" }\n        }\n\n        \/\/ Edit \uba54\ub274 \/ Edit Menu\n        Menu {\n            id: editMenu\n            title: \"Edit\"\n            MenuItem { text: \"Copy\" }\n            MenuItem { text: \"Paste\" }\n            MenuItem { text: \"Cut\" }\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb ApplicationWindow.qml<\/p>\n\n\n\n<p>\u2714\ufe0f \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158 \uc708\ub3c4\uc6b0 \ud0c0\uc785\uc5d0\uc11c\ub294 \uba54\ub274\ub4f1\uc744 \uad6c\ud604\ud558\uae30\uac00 \uc27d\uace0 MacOS\uc640 \uba54\ub274\ud638\ud658\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4.<br>In the application window type, it is easy to implement menus, etc., and menu compatibility with MacOS is possible.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import QtQuick\nimport QtQuick.Controls\n\nApplicationWindow {\n    width: 400\n    height: 300\n    visible: true\n\n    menuBar: MenuBar {\n        Menu {\n            title: \"File\"\n            MenuItem { text: \"Open\" }\n            MenuItem { text: \"Close window\"; onTriggered: Qt.quit() } \/\/real exit\n            MenuItem { text: \"Exit\" } \/\/ macOS\uc5d0\uc11c\ub294 \uc548\ub098\ud0c0\ub0a8 \/ It doesn't appear on macOS\n        }\n    }\n\n    Column{\n        anchors.fill: parent\n\n        Text{\n            text: \"Application Window\"\n            font.pixelSize: 25\n            anchors.centerIn: parent\n        }\n\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uc2a4\ud06c\ub9b0 \uc0f7 \/ ScreenShot <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/youtu.be\/oL-HIUkQLIo\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ud83c\udffb QT QML\uc5d0\uc11c \uc708\ub3c4\uc6b0 \uad6c\ud604\uc2dc \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158 \uc708\ub3c4\uc6b0 \ud0c0\uc785\uacfc \uc708\ub3c4\uc6b0 \ud0c0\uc785\uc5d0 \ub300\ud55c \uc124\uba85\uc785\ub2c8\ub2e4.This is a description of application window types and window types when implementing windows in QT QML. \ud83d\udc49\ud83c\udffb Window : \u2714\ufe0f\uac00\uc7a5 \uae30\ubcf8\uc801\uc778 \uc708\ub3c4\uc6b0 \ucee8\ud14c\uc774\ub108. \ub2e8\uc21c \ucc3d\uc73c\ub85c, \uba54\ub274, \ud234\ubc14, \uc0c1\ud0dc\ubc14 \ub4f1 \uace0\uae09 UI \uad6c\uc131 \uc694\uc18c\ub294 \uc5c6\uc2b5\ub2c8\ub2e4.The most basic window container. It&#8217;s a simple window, lacking [&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-2919","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\/2919","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=2919"}],"version-history":[{"count":25,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/2919\/revisions"}],"predecessor-version":[{"id":2947,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/2919\/revisions\/2947"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=2919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=2919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=2919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}