mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-15 19:22:25 +08:00
be03b04ef0
- 修复了虚拟牌点数相加的bug - 修复cleaner出错直接爆炸 - QML的代码将宽度控制到80以内
58 lines
1019 B
QML
58 lines
1019 B
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
|
|
Rectangle {
|
|
function show(text, duration) {
|
|
message.text = text;
|
|
time = Math.max(duration, 2 * fadeTime);
|
|
animation.start();
|
|
}
|
|
|
|
id: root
|
|
|
|
readonly property real defaultTime: 3000
|
|
property real time: defaultTime
|
|
readonly property real fadeTime: 300
|
|
|
|
anchors.horizontalCenter: parent != null ? parent.horizontalCenter
|
|
: undefined
|
|
height: message.height + 20
|
|
width: message.width + 40
|
|
radius: 16
|
|
|
|
opacity: 0
|
|
|
|
Text {
|
|
id: message
|
|
horizontalAlignment: Text.AlignHCenter
|
|
anchors.centerIn: parent
|
|
}
|
|
|
|
SequentialAnimation on opacity {
|
|
id: animation
|
|
running: false
|
|
|
|
|
|
NumberAnimation {
|
|
to: .9
|
|
duration: fadeTime
|
|
}
|
|
|
|
PauseAnimation {
|
|
duration: time - 2 * fadeTime
|
|
}
|
|
|
|
NumberAnimation {
|
|
to: 0
|
|
duration: fadeTime
|
|
}
|
|
|
|
onRunningChanged: {
|
|
if (!running) {
|
|
toast.model.remove(index);
|
|
}
|
|
}
|
|
}
|
|
}
|