1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-01-17 20:12:54 +08:00

[CusCallLater] add

This commit is contained in:
jared 2022-03-24 10:20:26 +08:00
parent 890f563df1
commit ce5f511ec2
3 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,28 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Item {
Component {
id: timerComp
Timer {
id: timer
repeat: false
property var _cb: function() {}
onTriggered: {
console.log("trigger")
_cb()
destroy(parent)
}
function setTimeout(callback, delayTime) {
_cb = callback;
interval = delayTime;
console.log("setTimeout", interval)
start();
}
}
}
function callLate(callback, delayTime) {
var timerObj = timerComp.createObject()
timerObj.setTimeout(callback, delayTime)
}
}

View File

@ -4,6 +4,7 @@
<file>Qml/CusConfig.qml</file>
<file>Qml/Basic/BasicText.qml</file>
<file>Qml/Basic/BasicTooltip.qml</file>
<file>Qml/Basic/CusCallLater.qml</file>
<file>Qml/Basic/MoveArea.qml</file>
<file>Qml/Basic/RoundRectangle.qml</file>
<file>Qml/Basic/RoundRectangleShape.qml</file>

View File

@ -1,6 +1,7 @@
module TaoQuick
BasicText 1.0 Qml/Basic/BasicText.qml
BasicTooltip 1.0 Qml/Basic/BasicTooltip.qml
CusCallLater 1.0 Qml/Basic/CusCallLater.qml
MoveArea 1.0 Qml/Basic/MoveArea.qml
RoundRectangle 1.0 Qml/Basic/RoundRectangle.qml
RoundRectangleShape 1.0 Qml/Basic/RoundRectangleShape.qml