diff --git a/example/qml-Qt6/page/T_Dialog.qml b/example/qml-Qt6/page/T_Dialog.qml index 05787e7b..3b444b96 100644 --- a/example/qml-Qt6/page/T_Dialog.qml +++ b/example/qml-Qt6/page/T_Dialog.qml @@ -16,7 +16,6 @@ FluScrollablePage{ Layout.topMargin: 20 FluButton{ anchors.verticalCenter: parent.verticalCenter - Layout.topMargin: 20 text:"Show Double Button Dialog" onClicked: { double_btn_dialog.open() @@ -65,7 +64,6 @@ FluScrollablePage{ Layout.topMargin: 20 FluButton{ anchors.verticalCenter: parent.verticalCenter - Layout.topMargin: 20 text:"Show Triple Button Dialog" onClicked: { triple_btn_dialog.open() @@ -118,17 +116,25 @@ FluScrollablePage{ FluArea{ Layout.fillWidth: true - height: 68 + height: 100 paddings: 10 Layout.topMargin: 20 FluButton{ - anchors.verticalCenter: parent.verticalCenter - Layout.topMargin: 20 + anchors.top: parent.top + anchors.topMargin: 5 text:"Custom Content Dialog" onClicked: { custom_btn_dialog.open() } } + FluButton{ + anchors.top: parent.top + anchors.topMargin: 48 + text:"Custom Content Dialog2" + onClicked: { + custom_btn_dialog2.open() + } + } } CodeExpander{ Layout.fillWidth: true @@ -164,8 +170,8 @@ FluScrollablePage{ negativeText:"取消加载" contentDelegate: Component{ Item{ - width: parent.width - height: 80 + implicitWidth: parent.width + implicitHeight: 80 FluProgressRing{ anchors.centerIn: parent } @@ -179,4 +185,47 @@ FluScrollablePage{ showSuccess("点击确定按钮") } } + + 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("点击确定按钮") + } + } } diff --git a/example/qml/page/T_Dialog.qml b/example/qml/page/T_Dialog.qml index a262b751..3a6ab202 100644 --- a/example/qml/page/T_Dialog.qml +++ b/example/qml/page/T_Dialog.qml @@ -16,7 +16,6 @@ FluScrollablePage{ Layout.topMargin: 20 FluButton{ anchors.verticalCenter: parent.verticalCenter - Layout.topMargin: 20 text:"Show Double Button Dialog" onClicked: { double_btn_dialog.open() @@ -65,7 +64,6 @@ FluScrollablePage{ Layout.topMargin: 20 FluButton{ anchors.verticalCenter: parent.verticalCenter - Layout.topMargin: 20 text:"Show Triple Button Dialog" onClicked: { triple_btn_dialog.open() @@ -118,17 +116,25 @@ FluScrollablePage{ FluArea{ Layout.fillWidth: true - height: 68 + height: 100 paddings: 10 Layout.topMargin: 20 FluButton{ - anchors.verticalCenter: parent.verticalCenter - Layout.topMargin: 20 + anchors.top: parent.top + anchors.topMargin: 5 text:"Custom Content Dialog" onClicked: { custom_btn_dialog.open() } } + FluButton{ + anchors.top: parent.top + anchors.topMargin: 48 + text:"Custom Content Dialog2" + onClicked: { + custom_btn_dialog2.open() + } + } } CodeExpander{ Layout.fillWidth: true @@ -164,8 +170,8 @@ FluScrollablePage{ negativeText:"取消加载" contentDelegate: Component{ Item{ - width: parent.width - height: 80 + implicitWidth: parent.width + implicitHeight: 80 FluProgressRing{ anchors.centerIn: parent } @@ -179,4 +185,47 @@ FluScrollablePage{ showSuccess("点击确定按钮") } } + + 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("点击确定按钮") + } + } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml b/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml index 9bff2d03..681f30df 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml @@ -8,9 +8,9 @@ FluPopup { id: control property string title: "" property string message: "" - property string neutralText: "Neutral" - property string negativeText: "Negative" - property string positiveText: "Positive" + property string neutralText: "Close" + property string negativeText: "Cancel" + property string positiveText: "OK" property int messageTextFormart: Text.AutoText property int delayTime: 100 property int buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton @@ -75,9 +75,15 @@ FluPopup { Layout.preferredHeight: status===Loader.Ready ? item.height : 0 } FluLoader{ - sourceComponent: control.contentDelegate + sourceComponent:control.visible ? control.contentDelegate : undefined Layout.fillWidth: true - Layout.preferredHeight: status===Loader.Ready ? item.height : 0 + onStatusChanged: { + if(status===Loader.Ready){ + Layout.preferredHeight = item.implicitHeight + }else{ + Layout.preferredHeight = 0 + } + } } Rectangle{ id:layout_actions diff --git a/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml b/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml index 1a0d84ec..58e3adc8 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml @@ -8,9 +8,9 @@ FluPopup { id: control property string title: "" property string message: "" - property string neutralText: "Neutral" - property string negativeText: "Negative" - property string positiveText: "Positive" + property string neutralText: "Close" + property string negativeText: "Cancel" + property string positiveText: "OK" property int messageTextFormart: Text.AutoText property int delayTime: 100 property int buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton @@ -75,9 +75,15 @@ FluPopup { Layout.preferredHeight: status===Loader.Ready ? item.height : 0 } FluLoader{ - sourceComponent: control.contentDelegate + sourceComponent:control.visible ? control.contentDelegate : undefined Layout.fillWidth: true - Layout.preferredHeight: status===Loader.Ready ? item.height : 0 + onStatusChanged: { + if(status===Loader.Ready){ + Layout.preferredHeight = item.implicitHeight + }else{ + Layout.preferredHeight = 0 + } + } } Rectangle{ id:layout_actions