I have been asked to update an old piece of software that used to work correctly. It was previously compiled with QT4 and an older version of QCustomPlot (not sure off hand what version), but now I am using QT5 and QCustomPlot v2.0.0 (hash: 36e8702). I am having a problem compiling the code that should otherwise be working now. When compiling i receive this error:
src/plotWidget.cpp|104|error: ‘class QCPGraph’ has no member named ‘setSelected’|
I have a series of QCPGraph's that are being plotted on the same axis. There is also a legend that can lists all graphs. I had previously written a function that would be connected to the selectionChangedByUSer() signal. The idea was that if you select a graph in the plot window you would also select the legend item, and if you select a legend item it would select the graph.
In the current documentation there is:
Q_SLOT void setSelection (QCPDataSelection selection)
but it is not clear how to use this function.
Bottom line question: how can I adapt my old code to work with the new QCustomPlot framework?
Thanks for the help!
connect(plot, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged())); void plotWidget::selectionChanged() { ... // synchronize selection of graphs with selection of corresponding legend items: for (int i=0; i<plot->graphCount(); ++i) { QCPGraph *graph = plot->graph(i); QCPPlottableLegendItem *item = plot->legend->itemWithPlottable(graph); if (item->selected() || graph->selected()) { item->setSelected(true); [b]graph->setSelected(true); <= THIS IS THE OFFENDING LINE[/b] } } }