FreeKill/Fk/ToastManager.qml
notify be03b04ef0
小修复&Qml美化 (#308)
- 修复了虚拟牌点数相加的bug
- 修复cleaner出错直接爆炸
- QML的代码将宽度控制到80以内
2024-01-25 03:23:29 +08:00

41 lines
734 B
QML

// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
// https://gist.github.com/jonmcclung/bae669101d17b103e94790341301c129
// modified some code
ListView {
function show(text, duration) {
if (duration === undefined) {
duration = 3000;
}
model.insert(0, {text: text, duration: duration});
}
id: root
clip: true
z: Infinity
spacing: 5
anchors.fill: parent
anchors.bottomMargin: 10
verticalLayoutDirection: ListView.BottomToTop
interactive: false
displaced: Transition {
NumberAnimation {
properties: "y"
easing.type: Easing.InOutQuad
}
}
delegate: Toast {
Component.onCompleted: {
show(text, duration);
}
}
model: ListModel {id: model}
}