import QtQuick 2.15 import QtQuick.Window 2.15 Window { id: topLevelWindow width: 640 height: 480 visible: true title: qsTr("Hello World") visibility: Window.FullScreen Rectangle { id: rect anchors.fill: parent color: "lightBlue" focus: true Keys.onPressed: { if (event.key === Qt.Key_Escape) { rect.color = "lightGreen" topLevelWindow.visibility = Window.Maximized } } } }