2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
2022-03-27 06:49:41 +00:00
|
|
|
|
|
|
|
// copy from https://gist.github.com/jonmcclung/bae669101d17b103e94790341301c129
|
|
|
|
// and modified some code
|
|
|
|
ListView {
|
2022-04-30 07:27:56 +00:00
|
|
|
function show(text, duration) {
|
|
|
|
if (duration === undefined) {
|
|
|
|
duration = 3000;
|
2022-03-27 06:49:41 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
model.insert(0, {text: text, duration: duration});
|
|
|
|
}
|
2022-03-27 06:49:41 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
id: root
|
2023-06-16 15:53:44 +00:00
|
|
|
clip: true
|
2022-03-27 06:49:41 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
z: Infinity
|
|
|
|
spacing: 5
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.bottomMargin: 10
|
|
|
|
verticalLayoutDirection: ListView.BottomToTop
|
2022-03-27 06:49:41 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
interactive: false
|
2022-03-27 06:49:41 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
displaced: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
properties: "y"
|
|
|
|
easing.type: Easing.InOutQuad
|
2022-03-27 06:49:41 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2023-02-26 08:51:29 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
delegate: Toast {
|
|
|
|
Component.onCompleted: {
|
|
|
|
show(text, duration);
|
2022-03-27 06:49:41 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-03-27 06:49:41 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
model: ListModel {id: model}
|
2022-03-27 06:49:41 +00:00
|
|
|
}
|