mirror of
https://github.com/jaredtao/TaoQuick.git
synced 2025-01-17 20:12:54 +08:00
[CusCallLater] add
This commit is contained in:
parent
890f563df1
commit
ce5f511ec2
28
src/TaoQuick/Qml/Basic/CusCallLater.qml
Normal file
28
src/TaoQuick/Qml/Basic/CusCallLater.qml
Normal 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)
|
||||
}
|
||||
|
||||
}
|
@ -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>
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user