QXRD  0.11.16
qxrddetectorimageplot.cpp
Go to the documentation of this file.
2 #include <QMenu>
3 #include <QContextMenuEvent>
4 
6  : QxrdImagePlot(parent)
7 {
8 }
9 
11 {
12  QxrdImagePlot::init(settings);
13 }
14 
15 void QxrdDetectorImagePlot::contextMenuEvent(QContextMenuEvent *event)
16 {
18 
19  if (set) {
20  QwtScaleMap xMap = canvasMap(QwtPlot::xBottom);
21  QwtScaleMap yMap = canvasMap(QwtPlot::yLeft);
22 
23  QWidget *canv = canvas();
24 
25  QPoint evlocal = canv->mapFromParent(event->pos());
26 
27  double x = xMap.invTransform(evlocal.x());
28  double y = yMap.invTransform(evlocal.y());
29 
30  QMenu plotMenu;
31 
32  QAction *auSc = plotMenu.addAction("Autoscale");
33  QAction *prGr = plotMenu.addAction("Print Graph...");
34 
35  QAction *lgSc = plotMenu.addAction("Log Intensity Scale?");
36  lgSc->setCheckable(true);
37  lgSc->setChecked(set->get_DisplayLog());
38 
39  QAction *shMk = plotMenu.addAction("Show Mask?");
40  shMk->setCheckable(true);
41  shMk->setChecked(set->get_MaskShown());
42 
43  QAction *shRoi = plotMenu.addAction("Show ROI Outlines?");
44  shRoi->setCheckable(true);
45  shRoi->setChecked(set->get_DisplayROI());
46  QAction *mvRoi = plotMenu.addAction(tr("Move selected ROI centers to (%1,%2)").arg(x).arg(y));
47  plotMenu.addSeparator();
48 
49  QAction *zap = plotMenu.addAction(tr("Zap (replace with avg of neighboring values) pixel [%1,%2]").arg((int)x).arg(int(y)));
50 
51  QAction *action = plotMenu.exec(event->globalPos());
52 
53  if (action == auSc) {
54  autoScale();
55  } else if (action == prGr) {
56  printGraph();
57  } else if (action == lgSc) {
59  } else if (action == shMk) {
61  } else if (action == shRoi) {
62  toggleShowROI();
63  } else if (action == mvRoi) {
65  } else if (action == zap) {
66  zapPixel(qRound(x), qRound(y));
67  }
68  }
69 }
void moveSelectedROICenter(double x, double y)
void toggleLogDisplay()
QWeakPointer< QxrdImagePlotSettings > QxrdImagePlotSettingsWPtr
QxrdImagePlotSettingsWPtr m_ImagePlotSettings
void zapPixel(int x, int y)
void init(QxrdImagePlotSettingsWPtr settings)
void printGraph()
Definition: qcepplot.cpp:199
void init(QxrdImagePlotSettingsWPtr settings)
QxrdDetectorImagePlot(QWidget *parent=0)
QSharedPointer< QxrdImagePlotSettings > QxrdImagePlotSettingsPtr
void contextMenuEvent(QContextMenuEvent *event)