From 475d29390663a4282a7ba293f5c54698e8f40978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 31 Dec 2023 11:20:48 +0800 Subject: [PATCH] update --- example/qml-Qt6/page/T_TableView.qml | 67 ++++++++++++++++++- example/qml/page/T_TableView.qml | 67 ++++++++++++++++++- .../FluentUI/Controls/FluContentDialog.qml | 2 +- .../FluentUI/Controls/FluContentDialog.qml | 2 +- 4 files changed, 134 insertions(+), 4 deletions(-) diff --git a/example/qml-Qt6/page/T_TableView.qml b/example/qml-Qt6/page/T_TableView.qml index 1a5288b0..21c26f17 100644 --- a/example/qml-Qt6/page/T_TableView.qml +++ b/example/qml-Qt6/page/T_TableView.qml @@ -29,6 +29,43 @@ FluContentPage{ } } + FluContentDialog{ + id:custom_update_dialog + signal showDialog(string text,var callback) + property var _textBox + property var onAccpetListener + title:"修改列名" + negativeText:"取消" + contentDelegate: Component{ + Item{ + width: parent.width + height: 60 + FluTextBox{ + id:textbox_text + anchors.centerIn: parent + } + Connections{ + target: custom_update_dialog + function onShowDialog(text,callback){ + custom_update_dialog._textBox = textbox_text + custom_update_dialog.onAccpetListener = callback + textbox_text.text = text + textbox_text.forceActiveFocus() + custom_update_dialog.open() + } + } + } + } + onNegativeClicked:{ + } + positiveText:"确定" + onPositiveClicked:{ + if(custom_update_dialog.onAccpetListener && custom_update_dialog._textBox){ + custom_update_dialog.onAccpetListener(custom_update_dialog._textBox.text) + } + } + } + Component{ id:com_checbox Item{ @@ -158,6 +195,34 @@ FluContentPage{ } } + Component{ + id:com_column_update_title + Item{ + FluText{ + id:text_title + text: { + if(options.title){ + return options.title + } + return "" + } + anchors.fill: parent + verticalAlignment: Qt.AlignVCenter + horizontalAlignment: Qt.AlignHCenter + elide: Text.ElideRight + } + MouseArea{ + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + custom_update_dialog.showDialog(options.title,function(text){ + itemModel.display = table_view.customItem(com_column_update_title,{"title":text}) + }) + } + } + } + } + Component{ id:com_column_sort_age Item{ @@ -236,7 +301,7 @@ FluContentPage{ maximumWidth:80, }, { - title: '头像', + title: table_view.customItem(com_column_update_title,{title:'头像'}), dataIndex: 'avatar', width:100, minimumWidth:100, diff --git a/example/qml/page/T_TableView.qml b/example/qml/page/T_TableView.qml index a5e80c32..47b8bf6e 100644 --- a/example/qml/page/T_TableView.qml +++ b/example/qml/page/T_TableView.qml @@ -30,6 +30,43 @@ FluContentPage{ } } + FluContentDialog{ + id:custom_update_dialog + signal showDialog(string text,var callback) + property var _textBox + property var onAccpetListener + title:"修改列名" + negativeText:"取消" + contentDelegate: Component{ + Item{ + width: parent.width + height: 60 + FluTextBox{ + id:textbox_text + anchors.centerIn: parent + } + Connections{ + target: custom_update_dialog + function onShowDialog(text,callback){ + custom_update_dialog._textBox = textbox_text + custom_update_dialog.onAccpetListener = callback + textbox_text.text = text + textbox_text.forceActiveFocus() + custom_update_dialog.open() + } + } + } + } + onNegativeClicked:{ + } + positiveText:"确定" + onPositiveClicked:{ + if(custom_update_dialog.onAccpetListener && custom_update_dialog._textBox){ + custom_update_dialog.onAccpetListener(custom_update_dialog._textBox.text) + } + } + } + Component{ id:com_checbox Item{ @@ -159,6 +196,34 @@ FluContentPage{ } } + Component{ + id:com_column_update_title + Item{ + FluText{ + id:text_title + text: { + if(options.title){ + return options.title + } + return "" + } + anchors.fill: parent + verticalAlignment: Qt.AlignVCenter + horizontalAlignment: Qt.AlignHCenter + elide: Text.ElideRight + } + MouseArea{ + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + custom_update_dialog.showDialog(options.title,function(text){ + itemModel.display = table_view.customItem(com_column_update_title,{"title":text}) + }) + } + } + } + } + Component{ id:com_column_sort_age Item{ @@ -237,7 +302,7 @@ FluContentPage{ maximumWidth:80, }, { - title: '头像', + title: table_view.customItem(com_column_update_title,{title:'头像'}), dataIndex: 'avatar', width:100, minimumWidth:100, diff --git a/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml b/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml index 5cf7cadb..9bff2d03 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml @@ -36,7 +36,7 @@ FluPopup { clip: true boundsBehavior:Flickable.StopAtBounds width: parent.width - height: Math.min(text_message.height,300) + height: message === "" ? 0 : Math.min(text_message.height,300) ScrollBar.vertical: FluScrollBar {} FluText{ id:text_message diff --git a/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml b/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml index 09418c49..1a0d84ec 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml @@ -36,7 +36,7 @@ FluPopup { clip: true boundsBehavior:Flickable.StopAtBounds width: parent.width - height: Math.min(text_message.height,300) + height: message === "" ? 0 : Math.min(text_message.height,300) ScrollBar.vertical: FluScrollBar {} FluText{ id:text_message