生手上路:求高手帮忙解决! QT:想在一个线程的run()函数中调用一个对话框,但是每当程序跑的对话框的show()函数便报错

新手上路:求高手帮忙解决!!!! QT:想在一个线程的run()函数中调用一个对话框,但是每当程序跑的对话框的show()函数便报错
本帖最后由 ayaxiaoxin 于 2013-04-02 18:52:59 编辑
程序部分代码如下
void Thread::run()
{
        ThreadDlg *myDlg = new ThreadDlg; \\ThreadDlg是我自己定义的
                                            QDialog的子类

        connect(myDlg->successBtn,SIGNAL(clicked()),\
            this,SLOT(successSlot()));

        myDlg->show(); //每次跑到这里就报错!!!!!!!!!!!!
}

提示错误如下:
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
blueTeeth: ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
程序异常终止。
qt thread

------解决方案--------------------
线程内不可以直接调用UI中的控件,可以用信号和槽。
可以看一下:http://www.qtcn.org/bbs/read-htm-tid-53416.html