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.
精彩评论