Trolltech Home | Qt4-preview-feedback Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt4-preview-feedback Archive, April 2007
QApplication::sleep() missing


Message 1 in thread

Hi,
as I said for Qt3, a sleep function for QApplication would be really nice. 
Sometimes it is really needed to force the whole application to sleep.

A small example: removing files on windows... I think you all know the 
message "Cannot remove folder, folder not empty"? On this OS, you have to try 
to remove the file until no error message appears, and a sleep between 
attempts seems to better than to try to remove in each cycle...
The same thing with renaming.

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx


Message 2 in thread

Hello,

On Thursday 19 April 2007 09:36, J. Preiss wrote:
> as I said for Qt3, a sleep function for QApplication would be really nice.
> Sometimes it is really needed to force the whole application to sleep.
>
> A small example: removing files on windows... I think you all know the
> message "Cannot remove folder, folder not empty"? On this OS, you have to
> try to remove the file until no error message appears, and a sleep between
> attempts seems to better than to try to remove in each cycle...
> The same thing with renaming.

I suggest using a QTimer. Sleeping is dangerous, because your application 
won't be redrawn, the entire process will just seem dead for a while.

FYI: QTestLib has qWait and qSleep. The implementation is quite small, so you 
can rip it out and put in your project.

Best regards,
Harald

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx


Message 3 in thread

On Friday 20 April 2007 17:02:51 Harald Fernengel wrote:
> Hello,
>
> On Thursday 19 April 2007 09:36, J. Preiss wrote:
> > as I said for Qt3, a sleep function for QApplication would be really
> > nice. Sometimes it is really needed to force the whole application to
> > sleep.
> >
> > A small example: removing files on windows... I think you all know the
> > message "Cannot remove folder, folder not empty"? On this OS, you have to
> > try to remove the file until no error message appears, and a sleep
> > between attempts seems to better than to try to remove in each cycle...
> > The same thing with renaming.
>
> I suggest using a QTimer. Sleeping is dangerous, because your application
> won't be redrawn, the entire process will just seem dead for a while.

With a QTimer, I have to use a slot, which does not work... I have to wait 
until a file is correctly remove, for example. My cases are only 
millisecond-things.
We have one interface, where I have to write a file and wait for another file 
for the answer. Now would it be useul to have a sleep command between two 
seacrhes for the answer. And no, using a slot is *not possible*!

> FYI: QTestLib has qWait and qSleep. The implementation is quite small, so
> you can rip it out and put in your project.
Yes, I now. Its one #ifdef with one Sleep and one msleep or usleep. Maybe I'll 
pack it in my own library... :-(

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx


Message 4 in thread

On Friday 20 April 2007 18:29:30 J. Preiss wrote:
> On Friday 20 April 2007 17:02:51 Harald Fernengel wrote:
> > FYI: QTestLib has qWait and qSleep. The implementation is quite small, so
> > you can rip it out and put in your project.
>
> Yes, I now. Its one #ifdef with one Sleep and one msleep or usleep. Maybe
> I'll pack it in my own library... :-(

Alternatively, you could subclass QThread to make the msleep() function public 
access (instead of just protected).

-- 
 [ signature omitted ]