C++ 入門指南 4.01
練習 27.7 參考程式 - 練習 QML 的 Popup
import QtQuick import QtQuick.Controls ApplicationWindow { id: window width: 400 height: 400 color: "gray" visible: true title: qsTr("彈出視窗測試") Button { text: "開啟" onClicked: popup.open() } Rectangle { x: 100 y: 100 width: 200 height: 200 color: "gray" Popup { id: popup x: 0 y: 0 width: 200 height: 200 modal: true focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent Text { anchors.centerIn: parent text: qsTr("Free your mind.") } } } } /* 《程式語言教學誌》的範例程式 http://kaiching.org/ 檔名:main.qml 功能:示範 Popup 型態 作者:張凱慶 */