Hi QCustomPlot community.

I have used QCustomPlot for a very long time, and it has been a pleasure to play with this masterpiece of code in my projects. So, first I would like to thanks developers who maintain QCustomPlot as an OpenSource project.

My current usage of QCustomPlot displays a collection of FFT from large real time data acquisitions coming from Neutron detectors.
The FFT results are simply hosted in the same QCustomPlot instance and displayed with different graphs, using the same axis and same scales. Each graph uses a different color and shape to differentiate visually.

The user controls the visibility of graphs outside QCustomPlot, from a QListView where configuration of data to collect can be set. Users can show/hide a graph using the dedicated checkbox. All works fine except one functionality : when a user changes the focus of one entry in the list-view, this must raise the current selected graph on the front of the plot. I record a screen-cast  of the problem here :

https://drive.google.com/file/d/1JvXjMc6AviKKPrErTX2TgIwMZseDvEFT/view?usp=sharing

I already implemented this kind of functionality in the past with other projects using the graph selection feature. This worked as I remember, a few years ago with the older QCustomPlot 1.x. Now with the version 2.x, the graph selection API has changed and this feature looks broken.

My code to change the current selected graph on the plot is managed by this slot:

void AnalysisView::slotPsdSelectionChanged(int id)
{
    for (int i = 0 ; i < m_curves->graphCount() ; i++)
    {
        QCPGraph* const graph = m_curves->graph(i);

        if (graph)
        {

            if (i == (id - 1))
            {
                graph->setSelection(QCPDataSelection(QCPDataRange()));
            }
            else
            {
                graph->setSelection(QCPDataSelection());
            }
        }
    }

    slotRefresh();
}

This slot is called by a signal emitted from the list-view when the user changes the focus of one entry on the list. The slot is well called, the corresponding graph is well found on the plot, and the selection is changed to try to raise on the front the relevant curve. But this doest work.

Perhaps I'm wrong to process this feature with QCustomPlot v 2.x. Any guidance is welcome...

Best regards.