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-06 18:08:01 +08:00
|
|
|
|
2023-03-10 18:08:32 +08:00
|
|
|
FluScrollablePage{
|
2023-03-28 17:53:46 +08:00
|
|
|
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Dialog")
|
2023-04-06 17:32:21 +08:00
|
|
|
|
2024-03-29 16:56:09 +08:00
|
|
|
FluFrame{
|
2023-04-06 17:32:21 +08:00
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.preferredHeight: 68
|
|
|
|
padding: 10
|
2023-04-20 18:10:45 +08:00
|
|
|
FluButton{
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Show Double Button Dialog")
|
2023-04-20 18:10:45 +08:00
|
|
|
onClicked: {
|
|
|
|
double_btn_dialog.open()
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
2023-04-20 18:10:45 +08:00
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.topMargin: -6
|
2023-04-06 17:32:21 +08:00
|
|
|
code:'FluContentDialog{
|
|
|
|
id:dialog
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Friendly Reminder")
|
|
|
|
message: qsTr("Are you sure you want to opt out?")
|
|
|
|
negativeText: qsTr("Cancel")
|
2023-07-18 18:24:06 +08:00
|
|
|
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
|
2023-04-06 17:32:21 +08:00
|
|
|
onNegativeClicked:{
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("Click the Cancel Button"))
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
positiveText: qsTr("OK")
|
2023-04-06 17:32:21 +08:00
|
|
|
onPositiveClicked:{
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("Click the OK Button"))
|
2024-02-25 14:37:26 +08:00
|
|
|
}
|
2023-04-20 18:10:45 +08:00
|
|
|
}
|
|
|
|
dialog.open()'
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
2023-03-07 00:05:27 +08:00
|
|
|
|
|
|
|
FluContentDialog{
|
2023-04-20 18:10:45 +08:00
|
|
|
id:double_btn_dialog
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Friendly Reminder")
|
|
|
|
message: qsTr("Are you sure you want to opt out?")
|
2023-07-18 18:24:06 +08:00
|
|
|
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
|
2024-03-09 15:35:48 +08:00
|
|
|
negativeText: qsTr("Cancel")
|
|
|
|
onNegativeClicked: {
|
|
|
|
showSuccess(qsTr("Click the Cancel Button"))
|
2023-03-07 00:05:27 +08:00
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
positiveText: qsTr("OK")
|
2023-03-07 00:05:27 +08:00
|
|
|
onPositiveClicked:{
|
2024-03-09 15:35:48 +08:00
|
|
|
showSuccess(qsTr("Click the OK Button"))
|
2023-03-07 00:05:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-29 16:56:09 +08:00
|
|
|
FluFrame{
|
2023-04-20 18:10:45 +08:00
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.preferredHeight: 68
|
|
|
|
padding: 10
|
2023-04-20 18:10:45 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
FluButton{
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2024-03-09 18:40:32 +08:00
|
|
|
text: qsTr("Show Triple Button Dialog")
|
2023-04-20 18:10:45 +08:00
|
|
|
onClicked: {
|
|
|
|
triple_btn_dialog.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.topMargin: -6
|
2023-04-20 18:10:45 +08:00
|
|
|
code:'FluContentDialog{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: dialog
|
|
|
|
title: qsTr("Friendly Reminder")
|
|
|
|
message: qsTr("Are you sure you want to opt out?")
|
|
|
|
negativeText: qsTr("Cancel")
|
2023-07-18 18:24:06 +08:00
|
|
|
buttonFlags: FluContentDialogType.NeutralButton | FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
|
2024-03-09 15:35:48 +08:00
|
|
|
negativeText: qsTr("Cancel")
|
|
|
|
onNegativeClicked: {
|
|
|
|
showSuccess(qsTr("Click the Cancel Button"))
|
2023-04-20 20:22:56 +08:00
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
positiveText: qsTr("OK")
|
|
|
|
onPositiveClicked: {
|
|
|
|
showSuccess(qsTr("Click the OK Button"))
|
2023-04-20 20:22:56 +08:00
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
neutralText: qsTr("Minimize")
|
|
|
|
onNeutralClicked: {
|
|
|
|
showSuccess(qsTr("Click Minimize"))
|
2023-04-20 18:10:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
dialog.open()'
|
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
|
2023-04-20 18:10:45 +08:00
|
|
|
FluContentDialog{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: triple_btn_dialog
|
|
|
|
title: qsTr("Friendly Reminder")
|
|
|
|
message: qsTr("Are you sure you want to opt out?")
|
2023-07-18 18:24:06 +08:00
|
|
|
buttonFlags: FluContentDialogType.NeutralButton | FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
|
2024-03-09 15:35:48 +08:00
|
|
|
negativeText: qsTr("Cancel")
|
|
|
|
onNegativeClicked: {
|
|
|
|
showSuccess(qsTr("Click the Cancel Button"))
|
2023-04-20 18:10:45 +08:00
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
positiveText: qsTr("OK")
|
|
|
|
onPositiveClicked: {
|
|
|
|
showSuccess(qsTr("Click the OK Button"))
|
2023-04-20 18:10:45 +08:00
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
neutralText: qsTr("Minimize")
|
|
|
|
onNeutralClicked: {
|
|
|
|
showSuccess(qsTr("Click Minimize"))
|
2023-04-20 18:10:45 +08:00
|
|
|
}
|
|
|
|
}
|
2023-12-04 17:35:05 +08:00
|
|
|
|
2024-03-29 16:56:09 +08:00
|
|
|
FluFrame{
|
2023-12-04 17:35:05 +08:00
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.preferredHeight: 100
|
|
|
|
padding: 10
|
2023-12-04 17:35:05 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
FluButton{
|
2024-01-31 11:13:37 +08:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 5
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Custom Content Dialog")
|
2023-12-04 17:35:05 +08:00
|
|
|
onClicked: {
|
|
|
|
custom_btn_dialog.open()
|
|
|
|
}
|
|
|
|
}
|
2024-01-31 11:13:37 +08:00
|
|
|
FluButton{
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 48
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Custom Content Dialog2")
|
2024-01-31 11:13:37 +08:00
|
|
|
onClicked: {
|
|
|
|
custom_btn_dialog2.open()
|
|
|
|
}
|
|
|
|
}
|
2023-12-04 17:35:05 +08:00
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.topMargin: -6
|
2023-12-04 17:35:05 +08:00
|
|
|
code:'FluContentDialog{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: dialog
|
|
|
|
title: qsTr("Friendly Reminder")
|
|
|
|
message: qsTr("Data is loading, please wait...")
|
|
|
|
negativeText: qsTr("Unload")
|
2023-12-04 17:35:05 +08:00
|
|
|
contentDelegate: Component{
|
|
|
|
Item{
|
|
|
|
width: parent.width
|
|
|
|
height: 80
|
|
|
|
FluProgressRing{
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
onNegativeClicked: {
|
|
|
|
showSuccess(qsTr("Click the Cancel Button"))
|
2023-12-04 17:35:05 +08:00
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
positiveText :qsTr("OK")
|
|
|
|
onPositiveClicked: {
|
|
|
|
showSuccess(qsTr("Click the OK Button"))
|
2024-02-25 14:37:26 +08:00
|
|
|
}
|
2023-12-04 17:35:05 +08:00
|
|
|
}
|
|
|
|
dialog.open()'
|
|
|
|
}
|
|
|
|
|
|
|
|
FluContentDialog{
|
2024-03-09 15:35:48 +08:00
|
|
|
id: custom_btn_dialog
|
|
|
|
title: qsTr("Friendly Reminder")
|
|
|
|
message: qsTr("Data is loading, please wait...")
|
|
|
|
negativeText: qsTr("Unload")
|
2023-12-04 17:35:05 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
onNegativeClicked: {
|
|
|
|
showSuccess(qsTr("Click the Cancel Button"))
|
2023-12-04 17:35:05 +08:00
|
|
|
}
|
2024-03-09 15:35:48 +08:00
|
|
|
positiveText: qsTr("OK")
|
|
|
|
onPositiveClickListener: function(){
|
|
|
|
showError(qsTr("Test the InfoBar level on top of the Popup"))
|
2023-12-04 17:35:05 +08:00
|
|
|
}
|
|
|
|
}
|
2024-01-31 11:13:37 +08:00
|
|
|
|
|
|
|
FluContentDialog{
|
|
|
|
id:custom_btn_dialog2
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("Line Chart")
|
2024-01-31 11:13:37 +08:00
|
|
|
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
|
2024-03-09 15:35:48 +08:00
|
|
|
positiveText: qsTr("OK")
|
|
|
|
onPositiveClicked: {
|
|
|
|
showSuccess(qsTr("Click the OK Button"))
|
2024-01-31 11:13:37 +08:00
|
|
|
}
|
|
|
|
}
|
2023-03-06 18:08:01 +08:00
|
|
|
}
|