Hi all,

i need some help regarding the following issue. I have a QwtPlot with some functionalities on right mouse click.

Qt Code:
  1. void Sys_Plot_Wid::contextMenuEvent(QContextMenuEvent *event)
  2. {
  3. QMenu contextMenu(this);
  4. contextMenu.addAction(printAct);
  5. contextMenu.addAction(printPDFAct);
  6. contextMenu.addAction(saveasAct);
  7. contextMenu.addAction(zoomAct);
  8. contextMenu.addAction(showGridAct);
  9. contextMenu.exec(event->globalPos());
  10. }
To copy to clipboard, switch view to plain text mode 

I want to be able to enable or disable my zoomer with a checkable action. I can enable the zoom by clicking my action but as i uncheck the action, the zoomer is still enabled. Can someone tell me what am i doing wrong?

Action is declared in my ctor like:
Qt Code:
  1. this->zoomAct->setCheckable(true);
  2. this->zoomAct->setChecked(false);
To copy to clipboard, switch view to plain text mode 

I connect the action with:
Qt Code:
  1. QObject::connect(this->zoomAct, SIGNAL(toggled(bool)), this, SLOT(enableZoomMode(bool)));
To copy to clipboard, switch view to plain text mode 

And the enableZoomMode function looks like:
Qt Code:
  1. void Sys_Plot_Wid::enableZoomMode(bool on)
  2. {
  3. QwtPlotMagnifier *plotMagnifier = new QwtPlotMagnifier(this->canvas());
  4. QwtPlotPanner *plotPanner = new QwtPlotPanner(this->canvas());
  5. QwtPlotZoomer *plotZoomer = new QwtPlotZoomer(this->canvas(), true);
  6. QwtPlotPicker *picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPicker::PointSelection | QwtPicker::DragSelection,
  7. QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, this->canvas());
  8.  
  9. plotMagnifier->setMouseButton(Qt::MidButton);
  10. plotMagnifier->setEnabled(on);
  11. plotPanner->setMouseButton(Qt::LeftButton);
  12. plotPanner->setEnabled(on);
  13. plotZoomer->setMousePattern(0, Qt::LeftButton, Qt::ControlModifier);
  14. plotZoomer->setMousePattern(1, Qt::MidButton);
  15. plotZoomer->setMousePattern(2, Qt::NoButton);
  16. plotZoomer->setEnabled(on);
  17. picker->setRubberBandPen(QColor(Qt::darkCyan));
  18. picker->setRubberBand(QwtPicker::CrossRubberBand);
  19. picker->setEnabled(!on);
  20.  
  21. this->replot();
  22. }
To copy to clipboard, switch view to plain text mode 

Thanks for your replies.