diff --git a/examples/pyplugin/qcustomplot_example.py b/examples/pyplugin/qcustomplot_example.py index fb4ca9ca08cd2aedb410b97a4ee501c0c37df731..ff412be596a04f103f2f86db66adec86494665da 100644 --- a/examples/pyplugin/qcustomplot_example.py +++ b/examples/pyplugin/qcustomplot_example.py @@ -24,6 +24,7 @@ class Plot (QtGui.QWidget): self.qcp.setInteraction(2, True) # iRangeZoom self.qcp.setAutoAddPlottableToLegend(True) self.qcp.legend().setVisible(True) + self.qcp.connect (Qt.SIGNAL("mouseDoubleClick(QMouseEvent*)"), self.doubleClick) # The timer user refresh the interface self.timer = Qt.QTimer(self) @@ -31,6 +32,11 @@ class Plot (QtGui.QWidget): self.timer.setInterval(100) self.timer.connect(Qt.SIGNAL("timeout()"), self._step) + def doubleClick (self, event): + x = self.qcp.xAxis().pixelToCoord (event.posF().x()) + y = self.qcp.yAxis().pixelToCoord (event.posF().y()) + print("You double-clicked at ({0}, {1})".format(x, y)) + def makeCurves(self): self.qcp.clearGraphs() self.legends = [ "sin", "cos" ]