QCustomPlot Discussion and Comments

selectionChanged overloaded signal not working Return to overview

I'm trying to bind to the selectionChanged event. My aim is to find out the value that was clicked in a graph (specifically the x axis value).

Binding to the first selectionChanged works -


    QObject::connect(
                graph,
                static_cast<void (QCPAbstractPlottable::*)(bool)> (&QCPAbstractPlottable::selectionChanged), 
                [](bool selected)
                {
                     cout << "this event DOES indeed fire"! << endl;
                }
            );



 QObject::connect(
                graph,
                static_cast<void (QCPAbstractPlottable::*)(const QCPDataSelection&)> (&QCPAbstractPlottable::selectionChanged),
                [](const QCPDataSelection &data)
                {
                    cout << "this event does NOT" << endl;
                }
            );


but binding to the second, which has the data I need, does not. Compiles, runs, but clicking on it does nothing. Not binding to the first does not change anything.

Appreciate any advice here.

Many thanks.

My mistake, please ignore.