开发者

Qt + QTextEdit content into QDomDocument

I'm having QTextEdit widget with large (XML) content in it, so I take the content us开发者_如何转开发ing:

document = textEdit->document();

How do I set it into a QDomDocument?


Try this...

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

It isn't tested. But hope it will work.. Check it out..

Edit: Alternatively give

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

This is a better one when compared to the previous.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜