[Interest] how to block run function of QRunnable class
André Somers
andre at familiesomers.nl
Tue Mar 19 15:11:03 CET 2013
Op 19-3-2013 14:57, K. Frank schreef:
> 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?
I'm not sure, probably to discourage its usage. Anyway, in Qt 5, there
now are static public member functions sleep and usleep in QThread.
André
--
You like Qt?
I am looking for collegues to join me at i-Optics!
More information about the Interest
mailing list