2010-11-28 129 views

回答

3

容易。發出一個信號。因爲你不能在一個QThread的做貴的東西只是給你的信息作爲你的信號

信號decalaration在你的QThread參數:

signals: 
void write2SysStatus(QString theMessage); 

從QThread的發射信號:

emit write2SysStatus(msgCatMap['F']+tr("Failed to start logging this mission's data because index is invalid: %1 (1 based)").arg(iMsn+1)); 

QMainWindow中的插槽聲明/定義:

public slots: 
void eWriteLine (QString theMessage){ 
    //this is where you use you message box. 
} 

連接插槽和信號:

connect(pFPSengine, SIGNAL(write2SysStatus(QString)), this,SLOT(eWriteLine(QString))); 
+1

太好了,非常感謝! – 2010-11-29 16:53:41