[Interest] how to block run function of QRunnable class

K. Frank kfrank29.c at gmail.com
Tue Mar 19 14:57:57 CET 2013


Hello Tony!

I have something of a side question, below.

On Tue, Mar 19, 2013 at 2:09 AM, Tony Rietwyk <tony at rightsoft.com.au> wrote:
> Hi Ken,
> ...
> // Hack to get around Qt strictness...
>
> class TSleepThread: public QThread
> {
> public:
>       static void sleep(unsigned long secs) { QThread::sleep(secs); };
>       static void msleep(unsigned long msecs) { QThread::msleep(msecs); };
>       static void usleep(unsigned long usecs) { QThread::usleep(usecs); };
> };
> ...

I've done this "hack" before to unprotect QThread::sleep.  But for the
life of me I cannot figure out why QThread:: sleep is protected (or, at
least, why there isn't some other unprotected static sleep somewhere).

A cross-platform sleep (in a cross-platform framework, at that).  What's
not to like?

But seriously, does anyone know what the motivation for making sleep
protected might have been?

> ...
> Regards,
> Tony


Thanks.


K. Frank



More information about the Interest mailing list