Hacker News new | ask | show | jobs
by onsclom 1065 days ago
Fair gotcha, yeah honestly I find QML to be super intuitive in the same way Svelte is super intuitive. It feels like two framework authors in very different worlds came to a similar conclusion.

> Regarding the timer, so in your Svelte code a new timer is being created each time?

`setTimeout`[1] isn't even a Svelte thing, it's a JavaScript API that QML would have access to if it was real JavaScript ;).

[1] https://developer.mozilla.org/en-US/docs/Web/API/setTimeout

1 comments

I understand, but it's not quite necessary if Qt could add some better functionality exposing C++ code in QML. Luckily, someone created a cool library that allows you to create singleShot timer in QML as follows:[1] `lqtUtils.singleShot(5000, () => console.log("Hello!"))`

[1] https://stackoverflow.com/a/75288105/5865379

I also used his library to share ENUMs between QWidgets (C++) and QML.