From b5295ffe4c58e33687e6af1d9f672b8954fa662f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Dezeiraud?= Date: Sat, 16 Nov 2024 19:47:03 +0100 Subject: [PATCH 1/5] Fix FluComboBox click issue with AppBar Fixed bug with Popup topMargin because click is consumed by FluAppBar --- src/Qt5/imports/FluentUI/Controls/FluComboBox.qml | 2 +- src/Qt6/imports/FluentUI/Controls/FluComboBox.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml b/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml index 279fb0f3..3000cc7c 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml @@ -107,7 +107,7 @@ T.ComboBox { y: control.height width: control.width height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin) - topMargin: 6 + topMargin: 32 bottomMargin: 6 modal: true contentItem: ListView { diff --git a/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml b/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml index 70e01e81..6dc161b1 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluComboBox.qml @@ -107,7 +107,7 @@ T.ComboBox { y: control.height width: control.width height: Math.min(contentItem.implicitHeight, control.Window.height - topMargin - bottomMargin) - topMargin: 6 + topMargin: 32 bottomMargin: 6 modal: true contentItem: ListView { From 8f5fbb4053f29db97cbf1006d821b12f59c04223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Dezeiraud?= Date: Sat, 16 Nov 2024 19:51:52 +0100 Subject: [PATCH 2/5] Update FluChart.qml In some cases, not sure why but animateToNewData is called and jsChart is undefined so it generate an error. Adding a "?" operator avoid the issue if jsChart is not ready, no error and can be called later. --- src/Qt5/imports/FluentUI/Controls/FluChart.qml | 2 +- src/Qt6/imports/FluentUI/Controls/FluChart.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluChart.qml b/src/Qt5/imports/FluentUI/Controls/FluChart.qml index 4b1f77ab..f47bd20d 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluChart.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluChart.qml @@ -15,7 +15,7 @@ Canvas { function animateToNewData() { chartAnimationProgress = 0.1; - d.jsChart.update(); + d.jsChart?.update(); chartAnimator.restart(); } QtObject{ diff --git a/src/Qt6/imports/FluentUI/Controls/FluChart.qml b/src/Qt6/imports/FluentUI/Controls/FluChart.qml index ebc70b15..30af5ab3 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluChart.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluChart.qml @@ -14,7 +14,7 @@ Canvas { function animateToNewData() { chartAnimationProgress = 0.1; - d.jsChart.update(); + d.jsChart?.update(); chartAnimator.restart(); } QtObject{ From e0892fdb666671bae3a5cb16f77ffe07ca7a3991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Dezeiraud?= Date: Sat, 16 Nov 2024 19:58:55 +0100 Subject: [PATCH 3/5] Convert WrapAnywhere toWordWrap Maybe you have a valid reason to use Wrap Anywhere, but for english and french text, it is very unpleasant to read. If this is a problem for Chinese, maybe a global variable to define the behavior? --- src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml | 4 ++-- src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml | 4 ++-- src/Qt5/imports/FluentUI/Controls/FluMultilineTextBox.qml | 2 +- src/Qt5/imports/FluentUI/Controls/FluTimeline.qml | 4 ++-- src/Qt5/imports/FluentUI/Controls/FluTour.qml | 2 +- src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml | 4 ++-- src/Qt6/imports/FluentUI/Controls/FluInfoBar.qml | 4 ++-- src/Qt6/imports/FluentUI/Controls/FluMultilineTextBox.qml | 2 +- src/Qt6/imports/FluentUI/Controls/FluTimeline.qml | 4 ++-- src/Qt6/imports/FluentUI/Controls/FluTour.qml | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml b/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml index b02592f7..48473191 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluContentDialog.qml @@ -41,7 +41,7 @@ FluPopup { FluText{ id:text_message font: FluTextStyle.Body - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap text:message width: parent.width topPadding: 4 @@ -67,7 +67,7 @@ FluPopup { topPadding: 20 leftPadding: 20 rightPadding: 20 - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap } FluLoader{ sourceComponent: com_message diff --git a/src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml b/src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml index 3177a8aa..3e3751a3 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml @@ -190,13 +190,13 @@ FluObject { spacing: 5 FluText{ text:_super.text - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap width: Math.min(implicitWidth,mcontrol.maxWidth) } FluText{ text: _super.moremsg visible: _super.moremsg - wrapMode : Text.WrapAnywhere + wrapMode : Text.WordWrap textColor: FluColors.Grey120 width: Math.min(implicitWidth,mcontrol.maxWidth) } diff --git a/src/Qt5/imports/FluentUI/Controls/FluMultilineTextBox.qml b/src/Qt5/imports/FluentUI/Controls/FluMultilineTextBox.qml index 14b0d136..e2b461c1 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluMultilineTextBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluMultilineTextBox.qml @@ -20,7 +20,7 @@ TextArea{ return normalColor } font:FluTextStyle.Body - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap padding: 8 leftPadding: padding+4 renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering diff --git a/src/Qt5/imports/FluentUI/Controls/FluTimeline.qml b/src/Qt5/imports/FluentUI/Controls/FluTimeline.qml index e94d1b1a..eddf0305 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTimeline.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTimeline.qml @@ -98,7 +98,7 @@ Item{ Component{ id:com_lable FluText{ - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft text: { if(modelData.lable){ @@ -113,7 +113,7 @@ Item{ Component{ id:com_text FluText{ - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft text: modelData.text textFormat: Text.RichText diff --git a/src/Qt5/imports/FluentUI/Controls/FluTour.qml b/src/Qt5/imports/FluentUI/Controls/FluTour.qml index a0b3e072..d8ff7027 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTour.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTour.qml @@ -175,7 +175,7 @@ Popup{ FluText{ id: text_desc font: FluTextStyle.Body - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap maximumLineCount: 4 elide: Text.ElideRight text: { diff --git a/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml b/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml index 6c4ae127..f9a80328 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluContentDialog.qml @@ -41,7 +41,7 @@ FluPopup { FluText{ id:text_message font: FluTextStyle.Body - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap text:message width: parent.width topPadding: 4 @@ -67,7 +67,7 @@ FluPopup { topPadding: 20 leftPadding: 20 rightPadding: 20 - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap } FluLoader{ sourceComponent: com_message diff --git a/src/Qt6/imports/FluentUI/Controls/FluInfoBar.qml b/src/Qt6/imports/FluentUI/Controls/FluInfoBar.qml index 6fac2e08..e081ee1d 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluInfoBar.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluInfoBar.qml @@ -190,13 +190,13 @@ FluObject { spacing: 5 FluText{ text:_super.text - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap width: Math.min(implicitWidth,mcontrol.maxWidth) } FluText{ text: _super.moremsg visible: _super.moremsg - wrapMode : Text.WrapAnywhere + wrapMode : Text.WordWrap textColor: FluColors.Grey120 width: Math.min(implicitWidth,mcontrol.maxWidth) } diff --git a/src/Qt6/imports/FluentUI/Controls/FluMultilineTextBox.qml b/src/Qt6/imports/FluentUI/Controls/FluMultilineTextBox.qml index 104f0230..21ebf678 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluMultilineTextBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluMultilineTextBox.qml @@ -21,7 +21,7 @@ TextArea{ return normalColor } font:FluTextStyle.Body - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap padding: 8 leftPadding: padding+4 renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering diff --git a/src/Qt6/imports/FluentUI/Controls/FluTimeline.qml b/src/Qt6/imports/FluentUI/Controls/FluTimeline.qml index 4477e00e..757459ee 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTimeline.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTimeline.qml @@ -98,7 +98,7 @@ Item{ Component{ id:com_lable FluText{ - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft text: { if(modelData.lable){ @@ -113,7 +113,7 @@ Item{ Component{ id:com_text FluText{ - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft text: modelData.text textFormat: Text.RichText diff --git a/src/Qt6/imports/FluentUI/Controls/FluTour.qml b/src/Qt6/imports/FluentUI/Controls/FluTour.qml index 46c3bbb7..fea6368b 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTour.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTour.qml @@ -175,7 +175,7 @@ Popup{ FluText{ id: text_desc font: FluTextStyle.Body - wrapMode: Text.WrapAnywhere + wrapMode: Text.WordWrap maximumLineCount: 4 elide: Text.ElideRight text: { From 3eaaa228d8f1abaa29b9388802486fe82403bd31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Dezeiraud?= Date: Sat, 16 Nov 2024 20:27:48 +0100 Subject: [PATCH 4/5] Add property autoResetScroll to FluScrollablePage I use it in my app, I think it can be useful to integrate the featurein the main project. This property autoResetScroll if true reset the scroll at the top when the StackView.onActivated is called. So the first time a page is view but also when the user go back in the stack. --- .../imports/FluentUI/Controls/FluScrollablePage.qml | 13 +++++++++++++ .../imports/FluentUI/Controls/FluScrollablePage.qml | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/Qt5/imports/FluentUI/Controls/FluScrollablePage.qml b/src/Qt5/imports/FluentUI/Controls/FluScrollablePage.qml index 5e1eb09f..573df65d 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluScrollablePage.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluScrollablePage.qml @@ -5,8 +5,11 @@ import QtQuick.Controls 2.15 import FluentUI 1.0 FluPage { + property bool autoResetScroll: false default property alias content: container.data + Flickable{ + id: flickable clip: true anchors.fill: parent ScrollBar.vertical: FluScrollBar {} @@ -17,4 +20,14 @@ FluPage { width: parent.width } } + + function resetScroll() { + flickable.contentY = 0; + } + + StackView.onActivated: { + if (autoResetScroll) { + resetScroll(); // Call this function to reset the scroll position to the top + } + } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluScrollablePage.qml b/src/Qt6/imports/FluentUI/Controls/FluScrollablePage.qml index ca710e5f..51e7ade6 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluScrollablePage.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluScrollablePage.qml @@ -5,8 +5,11 @@ import QtQuick.Controls import FluentUI FluPage { + property bool autoResetScroll: false default property alias content: container.data + Flickable{ + id: flickable clip: true anchors.fill: parent ScrollBar.vertical: FluScrollBar {} @@ -17,4 +20,14 @@ FluPage { width: parent.width } } + + function resetScroll() { + flickable.contentY = 0; + } + + StackView.onActivated: { + if (autoResetScroll) { + resetScroll(); // Call this function to reset the scroll position to the top + } + } } From 0171c3609a898de7c1bd4c9be133792128880de5 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Fri, 22 Nov 2024 15:58:45 +0800 Subject: [PATCH 5/5] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 8eb1427c..e8da0187 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +# ATTENTION! THIS REPO HAS BEEN DEPRECATED! +# PLEASE USE THE BRAND NEW [FluentUI2](https://github.com/zhuzichu520/FluentUI2) INSTEAD! +# THIS REPO IS NO LONGER MAINTAINED.