I have following scenario:

My code invokes external function (some type of print) in the loop.
In each iteration, after variable amount of time (< 2 mins) it saves
the file in the specific directory or it may fail to print and I need to advance to the next loop cycle.

Logically it is like that:
Qt Code:
  1. while (1)
  2. {
  3. // waitfor returns true if file is found. If 3 minutes passed and file
  4. // is not found where it is supposed to be, do nothing
  5. if (waitfor (printfile(), 3))
  6. {
  7. // do something with the file
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 

Printfile should monitor the appearance of the file in a certain directory. If not found in 2 mins, proceed to the next loop.
I am perfectly capable of doing something with straight c++ or boost. I am interested in understanding
how it can be implemented using specialized Qt classes, like QFileSystemWatcher, QFuture or others.
In QFileSystemWatcher, for example, I don't see how can I do wait without putting some wait conditions in the slot;

Advise is greatly appreciated.

Thanks.