Hello,
I would like to code a specific behavior for right click:
* if it falls on a QCPCurve, I would like to show a specifc menu (QMenu on mouse position)
* only if not, display the "normal" context menu shown in reaction to curstomContextMenuRequest
My code looks like this:
class::class { // Constructor setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequest(const QPoint &), this, SLOT(myDefaultMenu(const QPoint &))); } void class::mousePressEvent(QMouseEvent * event) { // Reimplemented from base class if(event->button() & Qt::RightButton) { if(QCPCurve * curve = qobject_cast<QCPCurve *>(itemAt(event.pos())) { event.accept(); return; } } QCustomPlot::mousePressEvent(event); }
I see I enter up to event.accept()/return of "mousePresseEvent" function but customContextMenuRequest is thrown just after, I cannot manage to "block it". Could you help me ?
Thanks !