View Full Version : callback to gui from thread...

18th October 2009, 18:54
Hi, I'am begginer in Qt!

I try to create template class for my projects, it will be do work in non gui thread (such as load file from www, get response from db and etc.)

My class has some specification:
- its must have 3 callback function (signals) using in gui thread
on_begin(QVariant data) // singal catched in gui form
on_progress(QVariant data) // singal catched in gui form
on_end(QVariant data) // singal catched in gui form

- and thread function. Here will be main work, for example loading file from www
on_work(QVariant data) //calling direct in thread run method!

Have you any ideas about it? How to make it?

PS: Sorry for grammatic errors!

18th October 2009, 20:52
Well, as long as your application, or at least the part of it you specified in the points is all Qt, then you don't really need to use pure C++ callbacks, as you can use signals and slots, which makes things much easier.

Make sure you read QThread documentation, and that you understand what thread affinity is, and what implications it has in Qt.

However, I don't understand what is your question?
You have the specification for your application - what it is you have problem with exactly?

Ask specific questions about specific issues, it will be easier to help you then.