Compare commits

..

No commits in common. "4ca097888292b6123052bd9aa322860bc8bd0f7f" and "e27f1591b03631a0e6f69959b486c5c3b31a2d1b" have entirely different histories.

10 changed files with 162 additions and 537 deletions

View File

@ -70,17 +70,17 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/CrashWindow.qml" line="53"/> <location filename="qml/window/CrashWindow.qml" line="50"/>
<source>We apologize for the inconvenience caused by an unexpected error</source> <source>We apologize for the inconvenience caused by an unexpected error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/CrashWindow.qml" line="65"/> <location filename="qml/window/CrashWindow.qml" line="62"/>
<source>Report Logs</source> <source>Report Logs</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/CrashWindow.qml" line="75"/> <location filename="qml/window/CrashWindow.qml" line="72"/>
<source>Restart Program</source> <source>Restart Program</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -2737,60 +2737,49 @@ Some contents...</source>
<name>T_Tour</name> <name>T_Tour</name>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="15"/> <location filename="qml/page/T_Tour.qml" line="15"/>
<location filename="qml/page/T_Tour.qml" line="23"/>
<source>Upload File</source> <source>Upload File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="15"/> <location filename="qml/page/T_Tour.qml" line="15"/>
<location filename="qml/page/T_Tour.qml" line="23"/>
<source>Put your files here.</source> <source>Put your files here.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="16"/> <location filename="qml/page/T_Tour.qml" line="16"/>
<location filename="qml/page/T_Tour.qml" line="24"/> <location filename="qml/page/T_Tour.qml" line="52"/>
<location filename="qml/page/T_Tour.qml" line="74"/> <location filename="qml/page/T_Tour.qml" line="54"/>
<location filename="qml/page/T_Tour.qml" line="76"/>
<source>Save</source> <source>Save</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="16"/> <location filename="qml/page/T_Tour.qml" line="16"/>
<location filename="qml/page/T_Tour.qml" line="24"/>
<source>Save your changes.</source> <source>Save your changes.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="17"/> <location filename="qml/page/T_Tour.qml" line="17"/>
<location filename="qml/page/T_Tour.qml" line="25"/>
<source>Other Actions</source> <source>Other Actions</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="17"/> <location filename="qml/page/T_Tour.qml" line="17"/>
<location filename="qml/page/T_Tour.qml" line="25"/>
<source>Click to see other actions.</source> <source>Click to see other actions.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="46"/> <location filename="qml/page/T_Tour.qml" line="31"/>
<source>Begin Tour</source> <source>Begin Tour</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="52"/> <location filename="qml/page/T_Tour.qml" line="45"/>
<source>Begin Tour with custom indicator</source> <location filename="qml/page/T_Tour.qml" line="47"/>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Tour.qml" line="67"/>
<location filename="qml/page/T_Tour.qml" line="69"/>
<source>Upload</source> <source>Upload</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="83"/> <location filename="qml/page/T_Tour.qml" line="61"/>
<source>More</source> <source>More</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -70,17 +70,17 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/CrashWindow.qml" line="53"/> <location filename="qml/window/CrashWindow.qml" line="50"/>
<source>We apologize for the inconvenience caused by an unexpected error</source> <source>We apologize for the inconvenience caused by an unexpected error</source>
<translation type="unfinished">便</translation> <translation type="unfinished">便</translation>
</message> </message>
<message> <message>
<location filename="qml/window/CrashWindow.qml" line="65"/> <location filename="qml/window/CrashWindow.qml" line="62"/>
<source>Report Logs</source> <source>Report Logs</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/CrashWindow.qml" line="75"/> <location filename="qml/window/CrashWindow.qml" line="72"/>
<source>Restart Program</source> <source>Restart Program</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -552,7 +552,7 @@
<message> <message>
<location filename="qml/global/ItemsOriginal.qml" line="448"/> <location filename="qml/global/ItemsOriginal.qml" line="448"/>
<source>Tour</source> <source>Tour</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/global/ItemsOriginal.qml" line="454"/> <location filename="qml/global/ItemsOriginal.qml" line="454"/>
@ -2938,67 +2938,56 @@ Some contents...</source>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="15"/> <location filename="qml/page/T_Tour.qml" line="15"/>
<location filename="qml/page/T_Tour.qml" line="23"/>
<source>Upload File</source> <source>Upload File</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="15"/> <location filename="qml/page/T_Tour.qml" line="15"/>
<location filename="qml/page/T_Tour.qml" line="23"/>
<source>Put your files here.</source> <source>Put your files here.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="16"/> <location filename="qml/page/T_Tour.qml" line="16"/>
<location filename="qml/page/T_Tour.qml" line="24"/> <location filename="qml/page/T_Tour.qml" line="52"/>
<location filename="qml/page/T_Tour.qml" line="74"/> <location filename="qml/page/T_Tour.qml" line="54"/>
<location filename="qml/page/T_Tour.qml" line="76"/>
<source>Save</source> <source>Save</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="16"/> <location filename="qml/page/T_Tour.qml" line="16"/>
<location filename="qml/page/T_Tour.qml" line="24"/>
<source>Save your changes.</source> <source>Save your changes.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="17"/> <location filename="qml/page/T_Tour.qml" line="17"/>
<location filename="qml/page/T_Tour.qml" line="25"/>
<source>Other Actions</source> <source>Other Actions</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="17"/> <location filename="qml/page/T_Tour.qml" line="17"/>
<location filename="qml/page/T_Tour.qml" line="25"/>
<source>Click to see other actions.</source> <source>Click to see other actions.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="46"/> <location filename="qml/page/T_Tour.qml" line="31"/>
<source>Begin Tour</source> <source>Begin Tour</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="52"/> <location filename="qml/page/T_Tour.qml" line="45"/>
<source>Begin Tour with custom indicator</source> <location filename="qml/page/T_Tour.qml" line="47"/>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Tour.qml" line="67"/>
<location filename="qml/page/T_Tour.qml" line="69"/>
<source>Upload</source> <source>Upload</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="83"/> <location filename="qml/page/T_Tour.qml" line="61"/>
<source>More</source> <source>More</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/page/T_Tour.qml" line="10"/> <location filename="qml/page/T_Tour.qml" line="10"/>
<source>Tour</source> <source>Tour</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -11,71 +11,69 @@ FluScrollablePage{
FluFrame{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 80
padding: 10 padding: 10
Flow{ Column{
width: parent.width
spacing: 15 spacing: 15
FluRectangle{ anchors{
width: 50 left: parent.left
height: 50 verticalCenter: parent.verticalCenter
color:"#0078d4"
radius:[0,0,0,0]
} }
FluRectangle{ RowLayout{
width: 50 Layout.topMargin: 20
height: 50 FluRectangle{
color:"#744da9" width: 50
radius:[15,15,15,15] height: 50
} color:"#0078d4"
FluRectangle{ radius:[0,0,0,0]
width: 50 }
height: 50 FluRectangle{
color:"#ffeb3b" width: 50
radius:[15,0,0,0] height: 50
} color:"#744da9"
FluRectangle{ radius:[15,15,15,15]
width: 50 }
height: 50 FluRectangle{
color:"#f7630c" width: 50
radius:[0,15,0,0] height: 50
} color:"#ffeb3b"
FluRectangle{ radius:[15,0,0,0]
width: 50 }
height: 50 FluRectangle{
color:"#e71123" width: 50
radius:[0,0,15,0] height: 50
} color:"#f7630c"
FluRectangle{ radius:[0,15,0,0]
width: 50 }
height: 50 FluRectangle{
color:"#b4009e" width: 50
radius:[0,0,0,15] height: 50
} color:"#e71123"
FluRectangle{ radius:[0,0,15,0]
width: 50 }
height: 50 FluRectangle{
color:"#a8d5ba" width: 50
radius:[15,15,15,15] height: 50
borderWidth: 3 color:"#b4009e"
borderColor: "#5b8a72" radius:[0,0,0,15]
} }
FluRectangle{ FluRectangle{
width: 50 width: 50
height: 50 height: 50
color:"#dbe2ef" color:"#a8d5ba"
radius:[15,0,0,0] radius:[15,15,15,15]
borderWidth: 2 borderWidth: 3
borderColor: "#3f72af" borderColor: "#5b8a72"
} }
FluRectangle{ FluRectangle{
width: 50 width: 50
height: 50 height: 50
color:"#dbe2ef" color:"#dbe2ef"
borderWidth: 2 radius:[15,0,0,0]
borderColor: "#3f72af" borderWidth: 2
borderStyle: Qt.DashLine borderColor: "#3f72af"
dashPattern: [4,2] }
} }
} }
} }
@ -86,8 +84,6 @@ FluScrollablePage{
radius: [25,25,25,25] radius: [25,25,25,25]
borderWidth: 2 borderWidth: 2
borderColor: "#000000" borderColor: "#000000"
borderStyle: Qt.DashLine
dashPattern: [4,2]
width: 50 width: 50
height: 50 height: 50
}' }'

View File

@ -17,42 +17,20 @@ FluScrollablePage{
{title:qsTr("Other Actions"),description: qsTr("Click to see other actions."),target:()=>btn_more} {title:qsTr("Other Actions"),description: qsTr("Click to see other actions."),target:()=>btn_more}
] ]
} }
FluTour{
id:tour_custom_indicator
steps:[
{title:qsTr("Upload File"),description: qsTr("Put your files here."),target:()=>btn_upload},
{title:qsTr("Save"),description: qsTr("Save your changes."),target:()=>btn_save},
{title:qsTr("Other Actions"),description: qsTr("Click to see other actions."),target:()=>btn_more}
]
indicator: Component{
FluText {
text: "%1 / %2".arg(current + 1).arg(total)
}
}
}
FluFrame{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 130 Layout.preferredHeight: 130
padding: 10 padding: 10
Row{ FluFilledButton{
anchors{ anchors{
top: parent.top top: parent.top
topMargin: 14 topMargin: 14
} }
spacing: 20 text: qsTr("Begin Tour")
FluFilledButton{ onClicked: {
text: qsTr("Begin Tour") tour.open()
onClicked: {
tour.open()
}
}
FluFilledButton{
text: qsTr("Begin Tour with custom indicator")
onClicked: {
tour_custom_indicator.open()
}
} }
} }

View File

@ -19,9 +19,6 @@ FluWindow {
Component.onCompleted: { Component.onCompleted: {
window.stayTop = true window.stayTop = true
} }
Component.onDestruction: {
FluRouter.exit()
}
onInitArgument: onInitArgument:
(argument)=>{ (argument)=>{

View File

@ -6,14 +6,10 @@ FluRectangle::FluRectangle(QQuickItem *parent) : QQuickPaintedItem(parent) {
radius({0, 0, 0, 0}); radius({0, 0, 0, 0});
borderWidth(0); borderWidth(0);
borderColor(Qt::black); borderColor(Qt::black);
borderStyle(Qt::SolidLine);
dashPattern({});
connect(this, &FluRectangle::colorChanged, this, [=] { update(); }); connect(this, &FluRectangle::colorChanged, this, [=] { update(); });
connect(this, &FluRectangle::radiusChanged, this, [=] { update(); }); connect(this, &FluRectangle::radiusChanged, this, [=] { update(); });
connect(this, &FluRectangle::borderWidthChanged, this, [=] { update(); }); connect(this, &FluRectangle::borderWidthChanged, this, [=] { update(); });
connect(this, &FluRectangle::borderColorChanged, this, [=] { update(); }); connect(this, &FluRectangle::borderColorChanged, this, [=] { update(); });
connect(this, &FluRectangle::borderStyleChanged, this, [=] { update(); });
connect(this, &FluRectangle::dashPatternChanged, this, [=] { update(); });
} }
bool FluRectangle::borderValid() const { bool FluRectangle::borderValid() const {
@ -25,8 +21,8 @@ void FluRectangle::paint(QPainter *painter) {
painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHint(QPainter::Antialiasing);
QRectF rect = boundingRect(); QRectF rect = boundingRect();
bool drawBorder = borderValid(); bool valid = borderValid();
if (drawBorder) { if (valid) {
// 绘制边框时画笔的宽度从路径向两侧扩充 // 绘制边框时画笔的宽度从路径向两侧扩充
// 因此实际绘制的矩形应向内侧收缩边框宽度的一半,避免边框裁剪导致不完整 // 因此实际绘制的矩形应向内侧收缩边框宽度的一半,避免边框裁剪导致不完整
qreal halfBorderWidth = _borderWidth / 2.0; qreal halfBorderWidth = _borderWidth / 2.0;
@ -58,12 +54,8 @@ void FluRectangle::paint(QPainter *painter) {
painter->fillPath(path, _color); painter->fillPath(path, _color);
// 绘制边框 // 绘制边框
if (drawBorder) { if (valid) {
QPen pen(_borderColor, _borderWidth, _borderStyle); painter->strokePath(path, QPen(_borderColor, _borderWidth));
if (_borderStyle == Qt::DashLine || _borderStyle == Qt::CustomDashLine) {
pen.setDashPattern(_dashPattern);
}
painter->strokePath(path, pen);
} }
painter->restore(); painter->restore();

View File

@ -14,8 +14,6 @@ class FluRectangle : public QQuickPaintedItem {
Q_PROPERTY_AUTO(QList<int>, radius) Q_PROPERTY_AUTO(QList<int>, radius)
Q_PROPERTY_AUTO(qreal, borderWidth) Q_PROPERTY_AUTO(qreal, borderWidth)
Q_PROPERTY_AUTO(QColor, borderColor) Q_PROPERTY_AUTO(QColor, borderColor)
Q_PROPERTY_AUTO(Qt::PenStyle, borderStyle)
Q_PROPERTY_AUTO(QVector<qreal>, dashPattern)
QML_NAMED_ELEMENT(FluRectangle) QML_NAMED_ELEMENT(FluRectangle)
public: public:
explicit FluRectangle(QQuickItem *parent = nullptr); explicit FluRectangle(QQuickItem *parent = nullptr);

View File

@ -7,10 +7,8 @@ import FluentUI 1.0
Popup{ Popup{
property var steps : [] property var steps : []
property int targetMargins: 5 property int targetMargins: 5
property int targetRadius: 2
property Component nextButton: com_next_button property Component nextButton: com_next_button
property Component prevButton: com_prev_button property Component prevButton: com_prev_button
property Component indicator: com_indicator
property int index : 0 property int index : 0
property string finishText: qsTr("Finish") property string finishText: qsTr("Finish")
property string nextText: qsTr("Next") property string nextText: qsTr("Next")
@ -24,12 +22,12 @@ Popup{
contentItem: Item{} contentItem: Item{}
onVisibleChanged: { onVisibleChanged: {
if(visible){ if(visible){
d.animationEnabled = false
control.index = 0 control.index = 0
d.updatePos()
d.animationEnabled = true
} }
} }
onIndexChanged: {
canvas.requestPaint()
}
Component{ Component{
id: com_next_button id: com_next_button
FluFilledButton{ FluFilledButton{
@ -52,32 +50,10 @@ Popup{
} }
} }
} }
Component{
id: com_indicator
Row{
spacing: 10
Repeater{
model: total
delegate: Rectangle{
width: 8
height: 8
radius: 4
scale: current === index ? 1.2 : 1
color:{
if(current === index){
return FluTheme.primaryColor
}
return FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
}
}
}
}
}
Item{ Item{
id:d id:d
property var window: Window.window property var window: Window.window
property point pos: Qt.point(0,0) property point pos: Qt.point(0,0)
property bool animationEnabled: true
property var step: steps[index] property var step: steps[index]
property var target: { property var target: {
if(steps[index]){ if(steps[index]){
@ -97,22 +73,15 @@ Popup{
} }
return control.width return control.width
} }
function updatePos(){
if(d.target && d.window){
d.pos = d.target.mapToGlobal(0,0)
d.pos = Qt.point(d.pos.x-d.window.x,d.pos.y-d.window.y)
}
}
onTargetChanged: {
updatePos()
}
} }
Connections{ Connections{
target: d.window target: d.window
function onWidthChanged(){ function onWidthChanged(){
canvas.requestPaint()
timer_delay.restart() timer_delay.restart()
} }
function onHeightChanged(){ function onHeightChanged(){
canvas.requestPaint()
timer_delay.restart() timer_delay.restart()
} }
} }
@ -120,128 +89,39 @@ Popup{
id: timer_delay id: timer_delay
interval: 200 interval: 200
onTriggered: { onTriggered: {
d.updatePos() canvas.requestPaint()
} }
} }
Item{ Canvas{
id: targetRect id: canvas
x: d.pos.x - control.targetMargins
y: d.pos.y - control.targetMargins
width: d.target ? d.target.width + control.targetMargins * 2 : 0
height: d.target ? d.target.height + control.targetMargins * 2 : 0
Behavior on x {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on y {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on width {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on height {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
}
Shape {
anchors.fill: parent anchors.fill: parent
layer.enabled: true onPaint: {
layer.samples: 4 d.pos = d.target.mapToGlobal(0,0)
layer.smooth: true d.pos = Qt.point(d.pos.x-d.window.x,d.pos.y-d.window.y)
ShapePath { var ctx = canvas.getContext("2d")
fillColor: "#88000000" ctx.clearRect(0, 0, canvasSize.width, canvasSize.height)
strokeWidth: 0 ctx.save()
strokeColor: "transparent" ctx.fillStyle = "#88000000"
ctx.fillRect(0, 0, canvasSize.width, canvasSize.height)
// draw background ctx.globalCompositeOperation = 'destination-out'
PathMove { ctx.fillStyle = 'black'
x: 0 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)
y: 0 drawRoundedRect(rect,2,ctx)
} ctx.restore()
PathLine { }
x: control.width function drawRoundedRect(rect, r, ctx) {
y: 0 ctx.beginPath();
} ctx.moveTo(rect.x + r, rect.y);
PathLine { ctx.lineTo(rect.x + rect.width - r, rect.y);
x: control.width ctx.arcTo(rect.x + rect.width, rect.y, rect.x + rect.width, rect.y + r, r);
y: control.height ctx.lineTo(rect.x + rect.width, rect.y + rect.height - r);
} ctx.arcTo(rect.x + rect.width, rect.y + rect.height, rect.x + rect.width - r, rect.y + rect.height, r);
PathLine { ctx.lineTo(rect.x + r, rect.y + rect.height);
x: 0 ctx.arcTo(rect.x, rect.y + rect.height, rect.x, rect.y + rect.height - r, r);
y: control.height ctx.lineTo(rect.x, rect.y + r);
} ctx.arcTo(rect.x, rect.y, rect.x + r, rect.y, r);
PathLine { ctx.closePath();
x: 0 ctx.fill()
y: 0
}
// draw highlight
PathMove {
x: targetRect.x + control.targetRadius
y: targetRect.y
}
PathLine {
x: targetRect.x + targetRect.width - control.targetRadius
y: targetRect.y
}
PathArc {
x: targetRect.x + targetRect.width
y: targetRect.y + control.targetRadius
radiusX: control.targetRadius
radiusY: control.targetRadius
useLargeArc: false
direction: PathArc.Clockwise
}
PathLine {
x: targetRect.x + targetRect.width
y: targetRect.y + targetRect.height - control.targetRadius
}
PathArc {
x: targetRect.x + targetRect.width - control.targetRadius
y: targetRect.y + targetRect.height
radiusX: control.targetRadius
radiusY: control.targetRadius
useLargeArc: false
direction: PathArc.Clockwise
}
PathLine {
x: targetRect.x + control.targetRadius
y: targetRect.y + targetRect.height
}
PathArc {
x: targetRect.x
y: targetRect.y + targetRect.height - control.targetRadius
radiusX: control.targetRadius
radiusY: control.targetRadius
useLargeArc: false
direction: PathArc.Clockwise
}
PathLine {
x: targetRect.x
y: targetRect.y + control.targetRadius
}
PathArc {
x: targetRect.x + control.targetRadius
y: targetRect.y
radiusX: control.targetRadius
radiusY: control.targetRadius
useLargeArc: false
direction: PathArc.Clockwise
}
} }
} }
FluFrame{ FluFrame{
@ -271,18 +151,6 @@ Popup{
return 0 return 0
} }
border.width: 0 border.width: 0
Behavior on x {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on y {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
FluShadow{ FluShadow{
radius: 5 radius: 5
} }
@ -325,21 +193,10 @@ Popup{
leftMargin: 15 leftMargin: 15
} }
} }
FluLoader{
readonly property int total: steps.length
readonly property int current: control.index
sourceComponent: control.indicator
anchors{
bottom: parent.bottom
left: parent.left
bottomMargin: 15
leftMargin: 15
}
}
FluLoader{ FluLoader{
id: loader_next id: loader_next
property bool isEnd: control.index === steps.length-1 property bool isEnd: control.index === steps.length-1
sourceComponent: control.nextButton sourceComponent: com_next_button
anchors{ anchors{
top: text_desc.bottom top: text_desc.bottom
topMargin: 10 topMargin: 10
@ -350,7 +207,7 @@ Popup{
FluLoader{ FluLoader{
id: loader_prev id: loader_prev
visible: control.index !== 0 visible: control.index !== 0
sourceComponent: control.prevButton sourceComponent: com_prev_button
anchors{ anchors{
right: loader_next.left right: loader_next.left
top: loader_next.top top: loader_next.top
@ -389,17 +246,5 @@ Popup{
} }
return 0 return 0
} }
Behavior on x {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on y {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
} }
} }

View File

@ -233,8 +233,6 @@ Module {
Property { name: "radius"; type: "QList<int>" } Property { name: "radius"; type: "QList<int>" }
Property { name: "borderWidth"; type: "double" } Property { name: "borderWidth"; type: "double" }
Property { name: "borderColor"; type: "QColor" } Property { name: "borderColor"; type: "QColor" }
Property { name: "borderStyle"; type: "Qt::PenStyle" }
Property { name: "dashPattern"; type: "QVector<qreal>" }
} }
Component { Component {
name: "FluSheetType" name: "FluSheetType"
@ -4330,10 +4328,8 @@ Module {
defaultProperty: "contentData" defaultProperty: "contentData"
Property { name: "steps"; type: "QVariant" } Property { name: "steps"; type: "QVariant" }
Property { name: "targetMargins"; type: "int" } Property { name: "targetMargins"; type: "int" }
Property { name: "targetRadius"; type: "int" }
Property { name: "nextButton"; type: "QQmlComponent"; isPointer: true } Property { name: "nextButton"; type: "QQmlComponent"; isPointer: true }
Property { name: "prevButton"; type: "QQmlComponent"; isPointer: true } Property { name: "prevButton"; type: "QQmlComponent"; isPointer: true }
Property { name: "indicator"; type: "QQmlComponent"; isPointer: true }
Property { name: "index"; type: "int" } Property { name: "index"; type: "int" }
Property { name: "finishText"; type: "string" } Property { name: "finishText"; type: "string" }
Property { name: "nextText"; type: "string" } Property { name: "nextText"; type: "string" }

View File

@ -7,10 +7,8 @@ import FluentUI
Popup{ Popup{
property var steps : [] property var steps : []
property int targetMargins: 5 property int targetMargins: 5
property int targetRadius: 2
property Component nextButton: com_next_button property Component nextButton: com_next_button
property Component prevButton: com_prev_button property Component prevButton: com_prev_button
property Component indicator: com_indicator
property int index : 0 property int index : 0
property string finishText: qsTr("Finish") property string finishText: qsTr("Finish")
property string nextText: qsTr("Next") property string nextText: qsTr("Next")
@ -24,12 +22,12 @@ Popup{
contentItem: Item{} contentItem: Item{}
onVisibleChanged: { onVisibleChanged: {
if(visible){ if(visible){
d.animationEnabled = false
control.index = 0 control.index = 0
d.updatePos()
d.animationEnabled = true
} }
} }
onIndexChanged: {
canvas.requestPaint()
}
Component{ Component{
id: com_next_button id: com_next_button
FluFilledButton{ FluFilledButton{
@ -52,32 +50,10 @@ Popup{
} }
} }
} }
Component{
id: com_indicator
Row{
spacing: 10
Repeater{
model: total
delegate: Rectangle{
width: 8
height: 8
radius: 4
scale: current === index ? 1.2 : 1
color:{
if(current === index){
return FluTheme.primaryColor
}
return FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
}
}
}
}
}
Item{ Item{
id:d id:d
property var window: Window.window property var window: Window.window
property point pos: Qt.point(0,0) property point pos: Qt.point(0,0)
property bool animationEnabled: true
property var step: steps[index] property var step: steps[index]
property var target: { property var target: {
if(steps[index]){ if(steps[index]){
@ -97,22 +73,15 @@ Popup{
} }
return control.width return control.width
} }
function updatePos(){
if(d.target && d.window){
d.pos = d.target.mapToGlobal(0,0)
d.pos = Qt.point(d.pos.x-d.window.x,d.pos.y-d.window.y)
}
}
onTargetChanged: {
updatePos()
}
} }
Connections{ Connections{
target: d.window target: d.window
function onWidthChanged(){ function onWidthChanged(){
canvas.requestPaint()
timer_delay.restart() timer_delay.restart()
} }
function onHeightChanged(){ function onHeightChanged(){
canvas.requestPaint()
timer_delay.restart() timer_delay.restart()
} }
} }
@ -120,128 +89,39 @@ Popup{
id: timer_delay id: timer_delay
interval: 200 interval: 200
onTriggered: { onTriggered: {
d.updatePos() canvas.requestPaint()
} }
} }
Item{ Canvas{
id: targetRect id: canvas
x: d.pos.x - control.targetMargins
y: d.pos.y - control.targetMargins
width: d.target ? d.target.width + control.targetMargins * 2 : 0
height: d.target ? d.target.height + control.targetMargins * 2 : 0
Behavior on x {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on y {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on width {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on height {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
}
Shape {
anchors.fill: parent anchors.fill: parent
layer.enabled: true onPaint: {
layer.samples: 4 d.pos = d.target.mapToGlobal(0,0)
layer.smooth: true d.pos = Qt.point(d.pos.x-d.window.x,d.pos.y-d.window.y)
ShapePath { var ctx = canvas.getContext("2d")
fillColor: "#88000000" ctx.clearRect(0, 0, canvasSize.width, canvasSize.height)
strokeWidth: 0 ctx.save()
strokeColor: "transparent" ctx.fillStyle = "#88000000"
ctx.fillRect(0, 0, canvasSize.width, canvasSize.height)
// draw background ctx.globalCompositeOperation = 'destination-out'
PathMove { ctx.fillStyle = 'black'
x: 0 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)
y: 0 drawRoundedRect(rect,2,ctx)
} ctx.restore()
PathLine { }
x: control.width function drawRoundedRect(rect, r, ctx) {
y: 0 ctx.beginPath();
} ctx.moveTo(rect.x + r, rect.y);
PathLine { ctx.lineTo(rect.x + rect.width - r, rect.y);
x: control.width ctx.arcTo(rect.x + rect.width, rect.y, rect.x + rect.width, rect.y + r, r);
y: control.height ctx.lineTo(rect.x + rect.width, rect.y + rect.height - r);
} ctx.arcTo(rect.x + rect.width, rect.y + rect.height, rect.x + rect.width - r, rect.y + rect.height, r);
PathLine { ctx.lineTo(rect.x + r, rect.y + rect.height);
x: 0 ctx.arcTo(rect.x, rect.y + rect.height, rect.x, rect.y + rect.height - r, r);
y: control.height ctx.lineTo(rect.x, rect.y + r);
} ctx.arcTo(rect.x, rect.y, rect.x + r, rect.y, r);
PathLine { ctx.closePath();
x: 0 ctx.fill()
y: 0
}
// draw highlight
PathMove {
x: targetRect.x + control.targetRadius
y: targetRect.y
}
PathLine {
x: targetRect.x + targetRect.width - control.targetRadius
y: targetRect.y
}
PathArc {
x: targetRect.x + targetRect.width
y: targetRect.y + control.targetRadius
radiusX: control.targetRadius
radiusY: control.targetRadius
useLargeArc: false
direction: PathArc.Clockwise
}
PathLine {
x: targetRect.x + targetRect.width
y: targetRect.y + targetRect.height - control.targetRadius
}
PathArc {
x: targetRect.x + targetRect.width - control.targetRadius
y: targetRect.y + targetRect.height
radiusX: control.targetRadius
radiusY: control.targetRadius
useLargeArc: false
direction: PathArc.Clockwise
}
PathLine {
x: targetRect.x + control.targetRadius
y: targetRect.y + targetRect.height
}
PathArc {
x: targetRect.x
y: targetRect.y + targetRect.height - control.targetRadius
radiusX: control.targetRadius
radiusY: control.targetRadius
useLargeArc: false
direction: PathArc.Clockwise
}
PathLine {
x: targetRect.x
y: targetRect.y + control.targetRadius
}
PathArc {
x: targetRect.x + control.targetRadius
y: targetRect.y
radiusX: control.targetRadius
radiusY: control.targetRadius
useLargeArc: false
direction: PathArc.Clockwise
}
} }
} }
FluFrame{ FluFrame{
@ -271,18 +151,6 @@ Popup{
return 0 return 0
} }
border.width: 0 border.width: 0
Behavior on x {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on y {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
FluShadow{ FluShadow{
radius: 5 radius: 5
} }
@ -325,21 +193,10 @@ Popup{
leftMargin: 15 leftMargin: 15
} }
} }
FluLoader{
readonly property int total: steps.length
readonly property int current: control.index
sourceComponent: control.indicator
anchors{
bottom: parent.bottom
left: parent.left
bottomMargin: 15
leftMargin: 15
}
}
FluLoader{ FluLoader{
id: loader_next id: loader_next
property bool isEnd: control.index === steps.length-1 property bool isEnd: control.index === steps.length-1
sourceComponent: control.nextButton sourceComponent: com_next_button
anchors{ anchors{
top: text_desc.bottom top: text_desc.bottom
topMargin: 10 topMargin: 10
@ -350,7 +207,7 @@ Popup{
FluLoader{ FluLoader{
id: loader_prev id: loader_prev
visible: control.index !== 0 visible: control.index !== 0
sourceComponent: control.prevButton sourceComponent: com_prev_button
anchors{ anchors{
right: loader_next.left right: loader_next.left
top: loader_next.top top: loader_next.top
@ -389,17 +246,5 @@ Popup{
} }
return 0 return 0
} }
Behavior on x {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
Behavior on y {
enabled: d.animationEnabled && FluTheme.animationEnabled
NumberAnimation {
duration: 167
}
}
} }
} }