我有struct functionStruct
和QVector<functionStruct>
。我正在做以下..
当我点击按钮时,插槽会调用此功能。
当我点击第一次打印“somedoc”(预期) 但是当我点击第二次(以及之后)时,它没有打印任何内容(成员为空)
int s = 0;
void foo()
{
if(!s) {
functionStruct *newp = new functionStruct;
functionStruct old = function_list.at(0);
newp->function_string.append(old.function_string);
newp->start = old.start;
newp->function_doc = "somedoc";
function_list.replace(0,*newp);
s = 1;
}
qDebug() << "pd0 contents " << function_list.at(0).function_doc
}