C++ 入門指南 4.01
練習 28.10 參考程式 - 練習 QML 的 ToolSeparator
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
ApplicationWindow {
width: 300
height: 200
visible: true
title: qsTr("工具列分隔線測試")
header: ToolBar {
RowLayout {
anchors.fill: parent
ToolButton {
text: qsTr("Red")
onClicked: rect.color = "red"
}
ToolSeparator {}
ToolButton {
text: qsTr("Blue")
onClicked: rect.color = "blue"
}
ToolSeparator {}
ToolButton {
text: qsTr("Green")
onClicked: rect.color = "green"
}
}
}
Rectangle {
id: rect
anchors.fill: parent
}
}
/* 《程式語言教學誌》的範例程式
http://kaiching.org/
檔名:main.qml
功能:示範 ToolSeparator 型態
作者:張凱慶 */
回到練習題目