Hi everyone,

Directly to the matter !,

- i have an application that have a parent class and two child classes
- i have a queue of QUrl's (retrived from a table)
- according to the url scheme i call one of the two classes method (with the same name, overriden !)

Qt Code:
  1. if(url.scheme() == ...){
  2. Parent* p = new ChildA;
  3. p.DoSomething(url);
  4. }
  5. else if (url.scheme() == ...){
  6. Parent* p = new ChildB;
  7. p.DoSomething(url);
  8. }
To copy to clipboard, switch view to plain text mode 

- at the end of the DoSomething(url) i delete the QUrl from the table,

What i want to do : having a max of 10 thread (for example), to do 10 DoSomething(url) at the same time, and at the end of one DoSomething(url) i call another do something on another thread with a newer url while the queue is not empty !

so how i can do that ?
another question
: i use a QSqlDatabase on DoSomething(), can i use the same connection as a global variable or i have to create a new connection on each thread ?

Thanks in advance , have a good day

PS : i use Qt4, qtcreator as an IDE on linux