How to check an existance of a chart?
-
-
How can i check the existance of chart_olstr[0] for removing the series.
Because if chart_olstr[0] is not exist my app crash``` chart_olstr[0]->removeSeries(seri[i]); chart_olstr[0]->legend()->hide(); chart_olstr[0]->update(); seri[i]->clear();
@firsnur96 said in How to check an existance of a chart?:
Because if
chart_olstr[0]
is not exist my app crashIs
chart_olstr
an array or list or whatever? So check its length/count or whether it is empty before attempting to address element #0 in it.... -
@firsnur96 said in How to check an existance of a chart?:
Because if
chart_olstr[0]
is not exist my app crashIs
chart_olstr
an array or list or whatever? So check its length/count or whether it is empty before attempting to address element #0 in it.... -
@JonB yes it is an array.
I cannot found any function like isEmpy, how should i check its lenght@firsnur96
Look at the documentation for whatever actual type you mean by "array".If it is a C-array, it won't have any varying length/count. But then you know its size/what elements you put in, or you are maintaining your own count variable.
-
@JonB yes it is an array.
I cannot found any function like isEmpy, how should i check its lenghtWhat kind of array?
QVector
?QList
?
What aboutchart_olstr.size()
?Or just check element 0:
chart_olstr[0] != nullptr