2023-08-24 15:50:37 +08:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Window
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Controls.Basic
|
|
|
|
import FluentUI
|
2024-01-25 17:26:50 +08:00
|
|
|
import "../component"
|
2023-08-24 15:50:37 +08:00
|
|
|
|
|
|
|
FluScrollablePage{
|
|
|
|
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Buttons")
|
2023-08-24 15:50:37 +08:00
|
|
|
|
|
|
|
FluText{
|
|
|
|
Layout.topMargin: 20
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Support the Tab key to switch focus, and the Space key to perform click events")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 68
|
|
|
|
paddings: 10
|
|
|
|
Layout.topMargin: 20
|
|
|
|
|
|
|
|
FluTextButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
disabled: text_button_switch.checked
|
|
|
|
text: qsTr("Text Button")
|
2023-08-24 15:50:37 +08:00
|
|
|
onClicked: {
|
|
|
|
showInfo("点击Text Button")
|
|
|
|
}
|
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: text_button_switch
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Disabled")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluTextButton{
|
|
|
|
text:"Text Button"
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 68
|
|
|
|
paddings: 10
|
|
|
|
Layout.topMargin: 20
|
|
|
|
|
|
|
|
FluButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
disabled: button_switch.checked
|
|
|
|
text: qsTr("Standard Button")
|
2023-08-24 15:50:37 +08:00
|
|
|
onClicked: {
|
2024-03-09 15:35:48 +08:00
|
|
|
showInfo(qsTr("Click StandardButton"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: button_switch
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Disabled")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluButton{
|
|
|
|
text:"Standard Button"
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 68
|
|
|
|
Layout.topMargin: 20
|
|
|
|
paddings: 10
|
|
|
|
|
|
|
|
FluFilledButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
disabled: filled_button_switch.checked
|
|
|
|
text: qsTr("Filled Button")
|
2023-08-24 15:50:37 +08:00
|
|
|
onClicked: {
|
2024-03-09 15:35:48 +08:00
|
|
|
showWarning(qsTr("Click FilledButton"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: filled_button_switch
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Disabled")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluFilledButton{
|
|
|
|
text:"Filled Button"
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 68
|
|
|
|
Layout.topMargin: 20
|
|
|
|
paddings: 10
|
|
|
|
|
|
|
|
FluToggleButton{
|
|
|
|
disabled:toggle_button_switch.checked
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Toggle Button")
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: toggle_button_switch
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Disabled")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluToggleButton{
|
|
|
|
text:"Toggle Button"
|
|
|
|
onClicked: {
|
|
|
|
checked = !checked
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
2023-09-05 16:48:04 +08:00
|
|
|
Timer{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: timer_progress
|
2023-09-05 16:48:04 +08:00
|
|
|
interval: 200
|
|
|
|
onTriggered: {
|
|
|
|
btn_progress.progress = (btn_progress.progress + 0.1).toFixed(1)
|
|
|
|
if(btn_progress.progress==1){
|
|
|
|
timer_progress.stop()
|
|
|
|
}else{
|
|
|
|
timer_progress.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 68
|
|
|
|
Layout.topMargin: 20
|
|
|
|
paddings: 10
|
|
|
|
|
|
|
|
FluProgressButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: btn_progress
|
|
|
|
disabled: progress_button_switch.checked
|
|
|
|
text: qsTr("Progress Button")
|
2023-09-05 16:48:04 +08:00
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
btn_progress.progress = 0
|
|
|
|
timer_progress.restart()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: progress_button_switch
|
2023-09-05 16:48:04 +08:00
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Disabled")
|
2023-09-05 16:48:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluProgressButton{
|
|
|
|
text:"Progress Button"
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
2023-09-11 18:10:50 +08:00
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 68
|
|
|
|
Layout.topMargin: 20
|
|
|
|
paddings: 10
|
|
|
|
|
|
|
|
FluLoadingButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: btn_loading
|
|
|
|
loading: loading_button_switch.checked
|
|
|
|
text: qsTr("Loading Button")
|
2023-09-11 18:10:50 +08:00
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: loading_button_switch
|
2023-09-11 18:10:50 +08:00
|
|
|
checked: true
|
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Loading")
|
2023-09-11 18:10:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluLoadingButton{
|
|
|
|
text:"Loading Button"
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
2023-08-24 15:50:37 +08:00
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: layout_icon_button.height + 30
|
|
|
|
paddings: 10
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Flow{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: layout_icon_button
|
2023-08-24 15:50:37 +08:00
|
|
|
spacing: 10
|
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
right: icon_button_switch.left
|
|
|
|
}
|
|
|
|
FluIconButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
disabled: icon_button_switch.checked
|
2023-08-24 15:50:37 +08:00
|
|
|
iconDelegate: Image{ sourceSize: Qt.size(40,40) ; width: 20; height: 20; source: "qrc:/example/res/image/ic_home_github.png" }
|
|
|
|
onClicked:{
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("Click IconButton"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FluIconButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
iconSource: FluentIcons.ChromeCloseContrast
|
|
|
|
disabled: icon_button_switch.checked
|
2023-08-24 15:50:37 +08:00
|
|
|
iconSize: 15
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("IconOnly")
|
2023-08-24 15:50:37 +08:00
|
|
|
display: Button.IconOnly
|
|
|
|
onClicked:{
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("Button.IconOnly"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FluIconButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
iconSource: FluentIcons.ChromeCloseContrast
|
|
|
|
disabled: icon_button_switch.checked
|
2023-08-24 15:50:37 +08:00
|
|
|
iconSize: 15
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("TextOnly")
|
2023-08-24 15:50:37 +08:00
|
|
|
display: Button.TextOnly
|
|
|
|
onClicked:{
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("Button.TextOnly"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FluIconButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
iconSource: FluentIcons.ChromeCloseContrast
|
|
|
|
disabled: icon_button_switch.checked
|
2023-08-24 15:50:37 +08:00
|
|
|
iconSize: 15
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("TextBesideIcon")
|
2023-08-24 15:50:37 +08:00
|
|
|
display: Button.TextBesideIcon
|
|
|
|
onClicked:{
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("Button.TextBesideIcon"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FluIconButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
iconSource: FluentIcons.ChromeCloseContrast
|
|
|
|
disabled: icon_button_switch.checked
|
2023-08-24 15:50:37 +08:00
|
|
|
iconSize: 15
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("TextUnderIcon")
|
2023-08-24 15:50:37 +08:00
|
|
|
display: Button.TextUnderIcon
|
|
|
|
onClicked:{
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("Button.TextUnderIcon"))
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: icon_button_switch
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Disabled")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluIconButton{
|
|
|
|
iconSource:FluentIcons.ChromeCloseContrast
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 68
|
|
|
|
paddings: 10
|
|
|
|
Layout.topMargin: 20
|
|
|
|
FluDropDownButton{
|
2024-03-09 15:35:48 +08:00
|
|
|
disabled: drop_down_button_switch.checked
|
|
|
|
text: qsTr("DropDownButton")
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
FluMenuItem{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Menu_1")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
FluMenuItem{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Menu_2")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
FluMenuItem{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Menu_3")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
FluMenuItem{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Menu_4")
|
2023-08-24 15:50:37 +08:00
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: drop_down_button_switch
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Disabled")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluDropDownButton{
|
|
|
|
text:"DropDownButton"
|
|
|
|
FluMenuItem{
|
|
|
|
text:"Menu_1"
|
|
|
|
},
|
|
|
|
FluMenuItem{
|
|
|
|
text:"Menu_2"
|
|
|
|
},
|
|
|
|
FluMenuItem{
|
|
|
|
text:"Menu_3"
|
|
|
|
},
|
|
|
|
FluMenuItem{
|
|
|
|
text:"Menu_4"
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
|
|
|
FluArea{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 100
|
|
|
|
paddings: 10
|
|
|
|
Layout.topMargin: 20
|
|
|
|
FluRadioButtons{
|
|
|
|
spacing: 8
|
|
|
|
anchors{
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
FluRadioButton{
|
|
|
|
disabled:radio_button_switch.checked
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Radio Button_1")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
FluRadioButton{
|
|
|
|
disabled:radio_button_switch.checked
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Radio Button_2")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
FluRadioButton{
|
|
|
|
disabled:radio_button_switch.checked
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Radio Button_3")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: radio_button_switch
|
2023-08-24 15:50:37 +08:00
|
|
|
anchors{
|
|
|
|
right: parent.right
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Disabled")
|
2023-08-24 15:50:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -1
|
|
|
|
code:'FluRadioButton{
|
|
|
|
checked:true
|
|
|
|
text:"Text Button"
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|