bool QDomDocument::setContent ( const QByteArray & data, bool namespaceProcessing, QString * errorMsg = 0, int * errorLine = 0, int * errorColumn = 0 )
this function’s first parameter is const QByteArray & data,then,following:
void LoadData(QString& str)
{
QString strPath = str;
strPath += "/contact.xml";
QFile file(strPath);
if(!file.open(QIODevice::ReadOnly))
{
return;
}
QDomDocument doc;
if(!doc.setContent(&file))
{
file.close();
return;
}
file.close();
...
}
Top code can work in my project but it was not created by me.I can’t understand &file,
what do you guys think about this question?
The are multiple versions of
QDomDocument::setContent. The above code is using:since QFile inherits QIODevice and
&filereturns a pointer to a QFile.