Hello everyone,
i'm trying to let the user draw a curve on my plot canvas, to emit a signal after releasing the mouse and send the array of points to another method for further processing.
Right now my code looks like this:
(...)
self.
plotPicker.
setRubberBandPen(QPen(Qt.
green)) self.
plotPicker.
setTrackerPen(QPen(Qt.
cyan)) self.connect(self.plotPicker, SIGNAL('selected(const QwtArrayQwtDoublePoint &)'), self.onSelection)
def onSelection(self, points):
print 'i got triggered'
(...)
self.plotPicker = Qwt.QwtPlotPicker(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PolygonSelection, Qwt.QwtPlotPicker.PolygonRubberBand, Qwt.QwtPicker.AlwaysOn, plot.canvas())
self.plotPicker.setRubberBandPen(QPen(Qt.green))
self.plotPicker.setTrackerPen(QPen(Qt.cyan))
self.connect(self.plotPicker, SIGNAL('selected(const QwtArrayQwtDoublePoint &)'), self.onSelection)
def onSelection(self, points):
print 'i got triggered'
To copy to clipboard, switch view to plain text mode
This does not work, the method does not get triggered. If i replace QwtPicker.PolygonSelection with QwtPicker.PointSelection and change the SIGNAL accordingly it works just fine.
Where am i going wrong here? Thanks a lot in advance!
Bookmarks