C++ 入門指南 4.01
練習 29.9 參考程式 - 練習設計匯率換算工具外觀
import QtQuick import QtQuick.Controls ApplicationWindow { width: 400 height: 120 visible: true title: qsTr("匯率換算") Column { Row { width: 320 height: 40 ComboBox { editable: true model: ListModel { ListElement { text: "CNY" } ListElement { text: "EUR" } ListElement { text: "JPY" } ListElement { text: "TWD" } ListElement { text: "USD" } } } Text { width: 30 horizontalAlignment: Text.AlignHCenter text: "匯率" } TextField { width: 50 placeholderText: qsTr("") } Text { width: 30 horizontalAlignment: Text.AlignHCenter text: "金額" } TextField { width: 50 placeholderText: qsTr("") } ComboBox { editable: true model: ListModel { ListElement { text: "CNY" } ListElement { text: "EUR" } ListElement { text: "JPY" } ListElement { text: "TWD" } ListElement { text: "USD" } } } Button { width: 50 text: "換算" } } Row { width: 320 height: 60 Text { width: 320 horizontalAlignment: Text.AlignRight text: "0" font { pixelSize: 54 } } } } } /* 《程式語言教學誌》的範例程式 http://kaiching.org/ 檔名:main.qml 功能:示範匯率換算工具的 GUI 外觀 作者:張凱慶 */