[Interest] ´ð¸´: how to block run function of QRunnable class
Tony Rietwyk
tony at rightsoft.com.au
Tue Mar 19 07:09:35 CET 2013
Hi Ken,
Sorry for the confusion - deriving from both QRunnable and QThread is probably NOT a good idea - you don't want to create your own QThread - just access the static methods:
// 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); };
};
then in your QRunnable derived class:
...
TSleepThread::msleep( 20 );
...
Regards,
Tony
From: pengliang(??) [mailto:pengliang at founder.com]
Sent: Tuesday, 19 March 2013 4:46 PM
To: Tony Rietwyk; interest at qt-project.org
Subject: ??: [Interest]´ð¸´: how to block run function of QRunnable class
Hi
I have defined a class derived from Qrunnable and Qthread.
Now, i call sleep in run function, it worked perfect.
Thanks
Ken
_____
发件人: interest-bounces+pengliang=founder.com at qt-project.org [mailto:interest-bounces+pengliang=founder.com at qt-project.org] 代表 Tony Rietwyk
发送时间: 2013年3月19日 13:36
收件人: interest at qt-project.org
主题: Re: [Interest]´ð¸´: how to block run function of QRunnable class
Hi Ken,
In Qt 4, you have to define your own override of QThread and expose the protected static sleep methods. I'm don't know about Qt 5.
Tony
From: interest-bounces+tony=rightsoft.com.au at qt-project.org [mailto:interest-bounces+tony=rightsoft.com.au at qt-project.org] On Behalf Of pengliang(??)
Sent: Tuesday, 19 March 2013 4:22 PM
To: Amogh Kudari
Cc: Interest at qt-project.org
Subject: [Interest] 答复: how to block run function of QRunnable class
Hi
Thank you.
But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread.
Thanks
Ken
_____
发件人: Amogh Kudari [mailto:amogh.kudari5 at gmail.com]
发送时间: 2013年3月19日 11:53
收件人: pengliang(彭亮)
抄送: Interest at qt-project.org
主题: Re: [Interest] how to block run function of QRunnable class
Hi Pengliang,
I am not pretty sure but it may be possible as QThreadPoolThread is a friend class of Qrunnable class and
QThreadPoolThread is derived from QThread and QThread has the sleep method.
Hope this helps.
Regards,
Amogh.
On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) <pengliang at founder.com> wrote:
Hi all
I don’t know how to block run function several seconds of Qrunnable class.
Andybody know?
Thanks
Ken
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130319/c244b692/attachment.html>
More information about the Interest
mailing list