如何使用c++; 我用Qt4.4.3用C++。我想实现一个对象,并将其作为函数的返回值传递。我使用它的方式与QdomeElement对象相同,包括:
在以这种方式插入7个其他节点并从函数返回后,我注意到使用返回的QDomDocumentFragment调用节点并没有插入任何新的子节点。在使用函数中的以下代码进行调试后,我意识到没有节点实际插入到rootnode中:如何使用c++; 我用Qt4.4.3用C++。我想实现一个对象,并将其作为函数的返回值传递。我使用它的方式与QdomeElement对象相同,包括:,c++,qt,C++,Qt,在以这种方式插入7个其他节点并从函数返回后,我注意到使用返回的QDomDocumentFragment调用节点并没有插入任何新的子节点。在使用函数中的以下代码进行调试后,我意识到没有节点实际插入到rootnode中: QMessageBox::information(this->owner, QObject::tr("Debug"), QObject::tr("Node has children: ")+QString::number(rootnode.childNodes().size(
QMessageBox::information(this->owner, QObject::tr("Debug"), QObject::tr("Node has children: ")+QString::number(rootnode.childNodes().size()));
打印的消息是“节点有子节点:0”。我错过了什么?好的,对不起,浪费了大家的时间。。看起来我需要使用以下方法创建文档片段:
QDomDocumentFragment rootnode = doc.createDocumentFragment();
QDomDocumentFragment rootnode = doc.createDocumentFragment();