我有一个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
}