1

I'm taking my first steps writing an QML/javascript application for Ubuntu touch using qt creator.

Currently there i dont think there's too much documentation on this topic.

Can anyone point me out a good/clean way to work on multiple threads in this circumstance?

3
  • Why do you need multithreading control for your UI? What's your final purpose? As mentioned by @Deadron below, if you need to perform really heavy tasks you can use a WorkerScript, but it would be an advanced feature; not something for one who's "taking his first steps" in QML. Commented Mar 7, 2013 at 17:46
  • @_TheHuge_ I´m not new to mobile development in general and know that the last thing i wanna do is blocking the ui thread with non ui related code i`m running. For now its a metronome i want to do that ticks reliable in certain amounts of time. I dont know if the worker is the thing for that but running on main thread would mean goodbye responsive ui. Except that: Why do i have to explain myself about my intensions!? (Dont need an answer for this one!) Commented Mar 8, 2013 at 10:06
  • 1
    I'm sorry if my questions seemed annoying. My point is this: QML is a language for UI, and you should use it just to define your application UI. Therefore there is no need (except for few peculiar cases) to manage threads for doing non-UI related tasks. Commented Mar 8, 2013 at 13:27

1 Answer 1

6

QML is not really designed with the intention of working within more than one thread. The origional intention was that any threading should be handled by the layer existing in C++. However, if you do really need acces to threads to perform things like calculations, and you are unable/unwilling to write code at the C++ level, there is the WorkerScript QML element that may be able to provide the funcionality you want.

https://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-workerscript.html

Its worth note that depending on what you are trying to do this may or may not be entirely appropriate to use.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.