Unsolved QCustomPlot plot clicked problem
-
I want to receive an information that plot was clicked using QCustomPlot. I tried this:
connect(ui->customPlot, SIGNAL(plottableClicked(QCPAbstractPlottable*,int,QMouseEvent*)), this, SLOT(plotClicked(QCPAbstractPlottable*,int,QMouseEvent*)));
but it did not work. The problem is that when I click on a plot, the slot is not executing.
-
Assuming the signal and slot is all working, it is probably a typing error in your connect statement. You can check the return value of connect. It will tell, if there is a problem with the connection. Also you should see an error message on the terminal output (or the application output window, when started in creator).
You could use also functor-based connect. This would show you already during compile time typing issues.Furthermore, QCustumPlot is a library based on Qt and you need to contact the publisher of the library for details there.
-
You should try qDebug() "con1:"<< connect(ui->customPlot, xxx)
and see if it says true.
The syntax seems valid
http://www.qcustomplot.com/documentation/classQCustomPlot.htmlAlso check that whatever class, the "this" is , has Q_OBJECT macro. in the .h file.
-
connect returns true. This class has Q_OBJECT macro in the .h file.
-
@michalt38
Ok, maybe it just dont emit the signal.
You could try
http://www.qcustomplot.com/index.php/demos/interactionexample
and see if their
connect(ui->customPlot, SIGNAL(plottableClick(QCPAbstractPlottable*,int,QMouseEvent*)), this, SLOT(graphClicked(QCPAbstractPlottable*,int)));
fires. -
No, it doesn't.
-
@michalt38
Well maybe there is something with our installation of it. Normally the samples works.Have you tried their forum ? ( if any)
-
I found another way: I used signal mousePressed and ckeck if the plot is select by selected() function.