2010-05-30 60 views

回答

1

嘗試......

QDomDocument *xmlDocument = new QDomDocument(); 
QString error; 
int errorLine = 0; 
int errorColumn = 0; 
bool docStatus = xmlDocument->setContent(textEdit->toPlainText()->toAscii(),&error,&errorLine,&errorColumn); 

它沒有進行測試。但希望它會工作。檢查出來..

編輯: 或者給

bool docStatus = xmlDocument->setContent(textEdit->toPlainText(),&error,&errorLine,&errorColumn); 

相比前時,這是一個更好的。

+0

error:'class QTextEdit'has no member named'toAscii' – kaycee 2010-05-30 13:07:43

+0

oops ...它有點誤解。我編輯我的答案太.. – liaK 2010-05-30 13:11:07

+0

我認爲你不必轉換爲Byte數組的所有,即toAscii()..嘗試給xmlDocument-> setContent(textEdit-> toPlainText(),&錯誤,&errorLine,&errorColumn); ..對不起我無法自己測試..檢查並讓我知道.. – liaK 2010-05-30 13:24:17