FluentUI/example/qml-Qt6/page/T_Dialog.qml

233 lines
6.4 KiB
QML
Raw Normal View History

2023-08-24 15:50:37 +08:00
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import FluentUI
2024-01-25 17:26:50 +08:00
import "../component"
2023-08-24 15:50:37 +08:00
FluScrollablePage{
title:"Dialog"
FluArea{
Layout.fillWidth: true
height: 68
paddings: 10
Layout.topMargin: 20
FluButton{
anchors.verticalCenter: parent.verticalCenter
text:"Show Double Button Dialog"
onClicked: {
double_btn_dialog.open()
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'FluContentDialog{
id:dialog
title:"友情提示"
message:"确定要退出程序么?"
negativeText:"取消"
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
onNegativeClicked:{
showSuccess("点击取消按钮")
}
positiveText:"确定"
onPositiveClicked:{
showSuccess("点击确定按钮")
2024-02-25 14:37:26 +08:00
}
2023-08-24 15:50:37 +08:00
}
dialog.open()'
}
FluContentDialog{
id:double_btn_dialog
title:"友情提示"
message:"确定要退出程序么?"
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
negativeText:"取消"
onNegativeClicked:{
showSuccess("点击取消按钮")
}
positiveText:"确定"
onPositiveClicked:{
showSuccess("点击确定按钮")
}
}
FluArea{
Layout.fillWidth: true
height: 68
paddings: 10
Layout.topMargin: 20
FluButton{
anchors.verticalCenter: parent.verticalCenter
text:"Show Triple Button Dialog"
onClicked: {
triple_btn_dialog.open()
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'FluContentDialog{
id:dialog
title:"友情提示"
message:"确定要退出程序么?"
negativeText:"取消"
buttonFlags: FluContentDialogType.NeutralButton | FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
negativeText:"取消"
onNegativeClicked:{
showSuccess("点击取消按钮")
}
positiveText:"确定"
onPositiveClicked:{
showSuccess("点击确定按钮")
}
neutralText:"最小化"
onNeutralClicked:{
showSuccess("点击最小化按钮")
}
}
dialog.open()'
}
FluContentDialog{
id:triple_btn_dialog
title:"友情提示"
message:"确定要退出程序么?"
buttonFlags: FluContentDialogType.NeutralButton | FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
negativeText:"取消"
onNegativeClicked:{
showSuccess("点击取消按钮")
}
positiveText:"确定"
onPositiveClicked:{
showSuccess("点击确定按钮")
}
neutralText:"最小化"
onNeutralClicked:{
showSuccess("点击最小化按钮")
}
}
2023-12-04 17:35:05 +08:00
FluArea{
Layout.fillWidth: true
2024-01-31 11:13:37 +08:00
height: 100
2023-12-04 17:35:05 +08:00
paddings: 10
Layout.topMargin: 20
FluButton{
2024-01-31 11:13:37 +08:00
anchors.top: parent.top
anchors.topMargin: 5
2023-12-04 17:35:05 +08:00
text:"Custom Content Dialog"
onClicked: {
custom_btn_dialog.open()
}
}
2024-01-31 11:13:37 +08:00
FluButton{
anchors.top: parent.top
anchors.topMargin: 48
text:"Custom Content Dialog2"
onClicked: {
custom_btn_dialog2.open()
}
}
2023-12-04 17:35:05 +08:00
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'FluContentDialog{
id:dialog
title:"友情提示"
message:"数据正在加载中,请稍等..."
negativeText:"取消加载"
contentDelegate: Component{
Item{
width: parent.width
height: 80
FluProgressRing{
anchors.centerIn: parent
}
}
}
onNegativeClicked:{
showSuccess("点击取消按钮")
}
positiveText:"确定"
onPositiveClicked:{
showSuccess("点击确定按钮")
2024-02-25 14:37:26 +08:00
}
2023-12-04 17:35:05 +08:00
}
dialog.open()'
}
FluContentDialog{
id:custom_btn_dialog
title:"友情提示"
message:"数据正在加载中,请稍等..."
negativeText:"取消加载"
contentDelegate: Component{
Item{
2024-01-31 11:13:37 +08:00
implicitWidth: parent.width
implicitHeight: 80
2023-12-04 17:35:05 +08:00
FluProgressRing{
anchors.centerIn: parent
}
}
}
onNegativeClicked:{
showSuccess("点击取消按钮")
}
positiveText:"确定"
onPositiveClicked:{
showSuccess("点击确定按钮")
}
}
2024-01-31 11:13:37 +08:00
FluContentDialog{
id:custom_btn_dialog2
title:"折线图"
contentDelegate: Component{
Item{
implicitWidth: parent.width
implicitHeight: 300
FluChart{
anchors.fill: parent
chartType: 'line'
chartData: { return {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'My First Dataset',
data: [65, 59, 80, 81, 56, 55, 40],
fill: false,
borderColor: 'rgb(75, 192, 192)',
tension: 0.1
}]
}
}
chartOptions: { return {
maintainAspectRatio: false,
title: {
display: true,
text: 'Chart.js Line Chart - Stacked'
},
tooltips: {
mode: 'index',
intersect: false
}
}
}
}
}
}
buttonFlags: FluContentDialogType.PositiveButton
positiveText:"确定"
onPositiveClicked:{
showSuccess("点击确定按钮")
}
}
2023-08-24 15:50:37 +08:00
}