FluentUI/example/T_Buttons.qml

193 lines
4.4 KiB
QML
Raw Normal View History

2023-02-28 18:29:00 +08:00
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
2023-03-06 18:08:01 +08:00
import QtQuick.Controls 2.15
2023-02-28 18:29:00 +08:00
import FluentUI 1.0
2023-03-10 18:08:32 +08:00
FluScrollablePage{
title:"Buttons"
spacing: 20
2023-03-12 14:26:03 +08:00
FluText{
2023-03-12 21:49:11 +08:00
Layout.topMargin: 20
text:"支持Tab键切换焦点空格键执行点击事件"
2023-03-12 14:26:03 +08:00
}
2023-03-10 18:08:32 +08:00
FluArea{
width: parent.width
height: 68
paddings: 10
FluButton{
disabled:button_switch.checked
2023-03-12 21:49:11 +08:00
text:"Standard Button"
2023-03-10 18:08:32 +08:00
onClicked: {
showInfo("点击StandardButton")
}
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
FluToggleSwitch{
id:button_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
2023-03-06 18:08:01 +08:00
}
2023-03-10 18:08:32 +08:00
FluArea{
2023-02-28 18:29:00 +08:00
width: parent.width
2023-03-10 18:08:32 +08:00
height: 68
paddings: 10
FluFilledButton{
disabled:filled_button_switch.checked
2023-03-12 21:49:11 +08:00
text:"Filled Button"
2023-03-10 18:08:32 +08:00
onClicked: {
2023-03-12 21:49:11 +08:00
showWarning("点击FilledButton")
2023-03-10 18:08:32 +08:00
}
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
2023-02-28 18:29:00 +08:00
}
2023-03-10 18:08:32 +08:00
Row{
2023-03-06 18:08:01 +08:00
spacing: 5
2023-03-10 18:08:32 +08:00
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
2023-02-28 18:29:00 +08:00
}
2023-03-10 18:08:32 +08:00
FluToggleSwitch{
id:filled_button_switch
Layout.alignment: Qt.AlignRight
2023-02-28 18:29:00 +08:00
}
2023-03-10 18:08:32 +08:00
FluText{
text:"Disabled"
2023-02-28 18:29:00 +08:00
}
2023-03-10 18:08:32 +08:00
}
}
FluArea{
width: parent.width
height: 68
paddings: 10
FluIconButton{
2023-03-12 21:49:11 +08:00
iconSource:FluentIcons.ChromeCloseContrast
2023-03-10 18:08:32 +08:00
disabled:icon_button_switch.checked
2023-03-11 00:29:06 +08:00
iconSize: 15
2023-03-10 18:08:32 +08:00
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
onClicked:{
showSuccess("点击IconButton")
2023-03-06 18:08:01 +08:00
}
2023-03-10 18:08:32 +08:00
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
FluToggleSwitch{
id:icon_button_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
}
FluArea{
width: parent.width
height: 100
paddings: 10
ColumnLayout{
spacing: 8
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
Repeater{
id:repeater
property int selecIndex : 0
model: 3
delegate: FluRadioButton{
2023-03-12 21:49:11 +08:00
selected : repeater.selecIndex===index
2023-03-10 18:08:32 +08:00
disabled:radio_button_switch.checked
text:"Radio Button_"+index
2023-03-06 18:08:01 +08:00
onClicked:{
2023-03-10 18:08:32 +08:00
repeater.selecIndex = index
2023-03-06 18:08:01 +08:00
}
}
2023-02-28 18:29:00 +08:00
}
2023-03-10 18:08:32 +08:00
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
2023-02-28 18:29:00 +08:00
}
2023-03-10 18:08:32 +08:00
FluToggleSwitch{
id:radio_button_switch
Layout.alignment: Qt.AlignRight
2023-03-09 11:50:40 +08:00
}
2023-03-10 18:08:32 +08:00
FluText{
text:"Disabled"
}
}
}
FluArea{
width: parent.width
height: 68
paddings: 10
FluCheckBox{
disabled:icon_button_check.checked
2023-03-12 21:49:11 +08:00
text:"Check Box"
2023-03-10 18:08:32 +08:00
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
FluToggleSwitch{
id:icon_button_check
Layout.alignment: Qt.AlignRight
2023-03-09 11:50:40 +08:00
}
2023-03-10 18:08:32 +08:00
FluText{
text:"Disabled"
2023-03-09 11:50:40 +08:00
}
2023-02-28 18:29:00 +08:00
}
}
}