FluentUI/example/qml/page/T_CheckBox.qml

114 lines
2.7 KiB
QML
Raw Permalink Normal View History

2023-08-24 15:50:37 +08:00
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
2023-08-26 17:20:30 +08:00
import "../component"
2023-03-29 18:10:34 +08:00
FluScrollablePage{
2024-03-09 15:35:48 +08:00
title: qsTr("CheckBox")
2023-03-29 18:10:34 +08:00
2024-03-29 16:56:09 +08:00
FluFrame{
2023-04-05 21:42:12 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 72
padding: 10
2023-10-01 16:18:37 +08:00
FluText{
2024-03-09 15:35:48 +08:00
text: qsTr("A 2-state CheckBox")
2023-10-01 16:18:37 +08:00
}
2023-04-05 21:42:12 +08:00
Row{
spacing: 30
2023-10-01 16:18:37 +08:00
anchors{
top: parent.top
topMargin: 30
}
2023-04-05 21:42:12 +08:00
FluCheckBox{
2023-10-01 16:18:37 +08:00
disabled: check_box_switch_two.checked
2023-04-05 21:42:12 +08:00
}
FluCheckBox{
2023-10-01 16:18:37 +08:00
disabled: check_box_switch_two.checked
2024-03-09 15:35:48 +08:00
text: qsTr("Right")
2023-06-20 18:02:15 +08:00
}
FluCheckBox{
2023-10-01 16:18:37 +08:00
disabled: check_box_switch_two.checked
2024-03-09 15:35:48 +08:00
text: qsTr("Left")
2023-06-20 18:02:15 +08:00
textRight: false
2023-04-05 21:42:12 +08:00
}
}
2023-05-26 13:49:32 +08:00
FluToggleSwitch{
2023-10-01 16:18:37 +08:00
id:check_box_switch_two
anchors{
right: parent.right
verticalCenter: parent.verticalCenter
}
2024-03-09 15:35:48 +08:00
text: qsTr("Disabled")
2023-10-01 16:18:37 +08:00
}
}
CodeExpander{
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.topMargin: -6
2023-10-01 16:18:37 +08:00
code:'FluCheckBox{
text:"Text"
}'
}
2024-03-29 16:56:09 +08:00
FluFrame{
2023-10-01 16:18:37 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 72
padding: 10
2023-10-01 16:18:37 +08:00
Layout.topMargin: 20
FluText{
2024-03-09 15:35:48 +08:00
text: qsTr("A 3-state CheckBox")
2023-10-01 16:18:37 +08:00
}
Row{
spacing: 30
anchors{
top: parent.top
topMargin: 30
}
FluCheckBox{
property int count: 1
2024-03-09 15:35:48 +08:00
text: qsTr("Three State")
2023-10-01 16:18:37 +08:00
disabled: check_box_switch_three.checked
clickListener: function(){
var flag = count%3
if(flag === 0){
checked = false
indeterminate = false
}
if(flag === 1){
checked = true
indeterminate = false
}
if(flag === 2){
checked = true
indeterminate = true
}
count++
}
}
}
FluToggleSwitch{
2024-03-09 15:35:48 +08:00
id: check_box_switch_three
2023-05-26 13:49:32 +08:00
anchors{
right: parent.right
verticalCenter: parent.verticalCenter
}
2024-03-09 15:35:48 +08:00
text: qsTr("Disabled")
2023-05-26 13:49:32 +08:00
}
2023-03-29 18:10:34 +08:00
}
2023-04-05 21:42:12 +08:00
CodeExpander{
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.topMargin: -6
2023-04-05 21:42:12 +08:00
code:'FluCheckBox{
2023-04-06 17:32:21 +08:00
text:"Text"
2023-10-01 16:18:37 +08:00
indeterminate:true
2023-04-05 21:42:12 +08:00
}'
2023-03-29 21:43:01 +08:00
}
2023-03-29 18:10:34 +08:00
}