16,216
社区成员
发帖
与我相关
我的任务
分享
NetThread::NetThread()
{
tran_task = 0;
task_counter = 0;
image_buf = new char [1024*20];
update_check_timer = new QTimer(this);
connect(update_check_timer, SIGNAL(timeout()), this, SLOT(update_check())); //时间显示
}
NetThread::~NetThread()
{
delete image_buf;
}
void NetThread::update_check()
{。。。。。。
[/quote]
你这儿的NetThread是QThread的派生类?
如果是的话,不光你的QTimer不在次线程中,你的槽函数也不会在次线程中执行。[/quote]
肯定是啊!
网上看到 “m_timer = new QTimer()放到run()里“ 试了下真的解决啦[/quote]
实际上,不是的话,会更简单。[/quote]
为啥是QThread的派生类,QTimer不在次线程中,你的槽函数也不会在次线程中执行???NetThread::NetThread()
{
tran_task = 0;
task_counter = 0;
image_buf = new char [1024*20];
update_check_timer = new QTimer(this);
connect(update_check_timer, SIGNAL(timeout()), this, SLOT(update_check())); //时间显示
}
NetThread::~NetThread()
{
delete image_buf;
}
void NetThread::update_check()
{。。。。。。
[/quote]
你这儿的NetThread是QThread的派生类?
如果是的话,不光你的QTimer不在次线程中,你的槽函数也不会在次线程中执行。[/quote]
肯定是啊!
网上看到 “m_timer = new QTimer()放到run()里“ 试了下真的解决啦[/quote]
实际上,不是的话,会更简单。NetThread::NetThread()
{
tran_task = 0;
task_counter = 0;
image_buf = new char [1024*20];
update_check_timer = new QTimer(this);
connect(update_check_timer, SIGNAL(timeout()), this, SLOT(update_check())); //时间显示
}
NetThread::~NetThread()
{
delete image_buf;
}
void NetThread::update_check()
{。。。。。。
[/quote]
你这儿的NetThread是QThread的派生类?
如果是的话,不光你的QTimer不在次线程中,你的槽函数也不会在次线程中执行。[/quote]
肯定是啊!
网上看到 “m_timer = new QTimer()放到run()里“ 试了下真的解决啦NetThread::NetThread()
{
tran_task = 0;
task_counter = 0;
image_buf = new char [1024*20];
update_check_timer = new QTimer(this);
connect(update_check_timer, SIGNAL(timeout()), this, SLOT(update_check())); //时间显示
}
NetThread::~NetThread()
{
delete image_buf;
}
void NetThread::update_check()
{。。。。。。
[/quote]
你这儿的NetThread是QThread的派生类?
如果是的话,不光你的QTimer不在次线程中,你的槽函数也不会在次线程中执行。NetThread::NetThread()
{
tran_task = 0;
task_counter = 0;
image_buf = new char [1024*20];
update_check_timer = new QTimer(this);
connect(update_check_timer, SIGNAL(timeout()), this, SLOT(update_check())); //时间显示
}
NetThread::~NetThread()
{
delete image_buf;
}
void NetThread::update_check()
{。。。。。。