So I am adding data using the following code to a QCPGraph

void addData(QVector<double> *time,Qvector<double> *val){
    qcpGraphObj.addData(*time,*val);
}

Now if I do the following

QVector<double > time,val
addData(&time,&val);
time.clear();
val.clear();
qcustomplotObj.replot();

The above code doesnt add the data/update the UI components why?