From d9e10efe9cf7b696fc5c1af79ac5c603ffce2825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Mon, 26 Feb 2024 18:22:30 +0800 Subject: [PATCH] update --- .../imports/FluentUI/Controls/FluTimeline.qml | 2 ++ src/Qt5/imports/FluentUI/Controls/FluTour.qml | 20 ++++----------- .../imports/FluentUI/Controls/FluTimeline.qml | 2 ++ src/Qt6/imports/FluentUI/Controls/FluTour.qml | 25 ++++++++++++------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluTimeline.qml b/src/Qt5/imports/FluentUI/Controls/FluTimeline.qml index 297473d0..cd19b9a6 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTimeline.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTimeline.qml @@ -41,6 +41,7 @@ Item{ color: control.lineColor height: parent.height width: 2 + visible: repeater.count!==0 state: d.stateName states: [ State { @@ -110,6 +111,7 @@ Item{ id:layout_column spacing: 30 width: control.width + height: repeater.count === 0 ? 1 : childrenRect.height Repeater{ id:repeater Item{ diff --git a/src/Qt5/imports/FluentUI/Controls/FluTour.qml b/src/Qt5/imports/FluentUI/Controls/FluTour.qml index 09b54ec6..abfc5036 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTour.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTour.qml @@ -12,9 +12,9 @@ Popup{ property int index : 0 id:control padding: 0 - anchors.centerIn: Overlay.overlay - width: d.windowWidth - height: d.windowHeight + parent: Overlay.overlay + width: parent.width + height: parent.height background: Item{} contentItem: Item{} onVisibleChanged: { @@ -50,16 +50,6 @@ Popup{ Item{ id:d property var window: Window.window - property int windowWidth: { - if(d.window) - return d.window.width - return 0 - } - property int windowHeight: { - if(d.window) - return d.window.height - return 0 - } property point pos: Qt.point(0,0) property var step : steps[index] property var target : step.target() @@ -125,10 +115,10 @@ Popup{ return 1 return 0 } - x: Math.min(Math.max(0,d.pos.x+d.target.width/2-width/2),d.windowWidth-width) + x: Math.min(Math.max(0,d.pos.x+d.target.width/2-width/2),control.width-width) y:{ var ty=d.pos.y+d.target.height+control.targetMargins + 15 - if((ty+height)>d.windowHeight) + if((ty+height)>control.height) return d.pos.y-height-control.targetMargins - 15 return ty } diff --git a/src/Qt6/imports/FluentUI/Controls/FluTimeline.qml b/src/Qt6/imports/FluentUI/Controls/FluTimeline.qml index 167736e2..88e1d84b 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTimeline.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTimeline.qml @@ -41,6 +41,7 @@ Item{ color: control.lineColor height: parent.height width: 2 + visible: repeater.count!==0 state: d.stateName states: [ State { @@ -110,6 +111,7 @@ Item{ id:layout_column spacing: 30 width: control.width + height: repeater.count === 0 ? 1 : childrenRect.height Repeater{ id:repeater Item{ diff --git a/src/Qt6/imports/FluentUI/Controls/FluTour.qml b/src/Qt6/imports/FluentUI/Controls/FluTour.qml index d411ec8a..4e44b871 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTour.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTour.qml @@ -12,9 +12,9 @@ Popup{ property int index : 0 id:control padding: 0 - anchors.centerIn: Overlay.overlay - width: d.window?.width - height: d.window?.height + parent: Overlay.overlay + width: parent.width + height: parent.height background: Item{} contentItem: Item{} onVisibleChanged: { @@ -50,7 +50,7 @@ Popup{ Item{ id:d property var window: Window.window - property var pos:Qt.point(0,0) + property point pos: Qt.point(0,0) property var step : steps[index] property var target : step.target() } @@ -85,7 +85,8 @@ Popup{ ctx.fillRect(0, 0, canvasSize.width, canvasSize.height) ctx.globalCompositeOperation = 'destination-out' ctx.fillStyle = 'black' - drawRoundedRect(Qt.rect(d.pos.x-control.targetMargins,d.pos.y-control.targetMargins, d.target.width+control.targetMargins*2, d.target.height+control.targetMargins*2),2,ctx) + var rect = Qt.rect(d.pos.x-control.targetMargins,d.pos.y-control.targetMargins, d.target.width+control.targetMargins*2, d.target.height+control.targetMargins*2) + drawRoundedRect(rect,2,ctx) ctx.restore() } function drawRoundedRect(rect, r, ctx) { @@ -109,11 +110,17 @@ Popup{ width: 500 height: 88 + text_desc.height color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) - property int dir : (yd.window?.height)?(d.pos.y-height-control.targetMargins - 15):ty + if((ty+height)>control.height) + return d.pos.y-height-control.targetMargins - 15 + return ty } border.width: 0 FluShadow{