QCustomPlot Discussion and Comments

error with setInteractionsReturn to overview

Hi all, I'm new to QCustomplot, and I'm encountering a strange error.

I downloaded the examples and I can compile the "interactions" example without a problem. There we have the line

ui->customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
                                  QCP::iSelectLegend | QCP::iSelectPlottables);

However, when in my code I use

plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes);

I get the error
reference to type 'const QCP::Interactions' (aka 'const QFlags<QCP::Interaction>') could not bind to an rvalue of type 'int'

This is happening with the same compiler (of course), and with the same settings in the .pro file.

Any idea of what may cause this? Thanks


Ok, I solved the problem. For some reason, which I don't understand, I need an explicit conversion

plot->setInteractions((QCP::Interaction)(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes));