PDA

View Full Version : QwtPlot cursor (like Audacity)



Alekon
5th November 2014, 04:25
Hi all,

I need cursor conception on a QwtPlot. The cursor is not a mouse cursor, but a part of plotted area across one axis. Looks like this 10733.

The cursor consists from marker on a scale (green triangle) and vertical rectangle on plotting area.

For instance, plotting data have ranve [0, 10] on X-axis, and the cursor has position 1 and width 2, i.e. [1,2). There will be vertical rectangle orthogonal X-axis and marker (green triangle) on X-axis scale located at 1.

How is the best way to implement this?

Thanks.

Uwe
6th November 2014, 08:41
Drawing the marker on the scale could be done by deriving from QwtScaleDraw.

For the rectangle over the plot area you could implement it as QwtWidgetOverlay or as QwtPlotItem - depends on the use case of your application. Using an overlay is often the better solution for interactive elements like cursors or rubber bands. F.e QwtPlotPicker or QwtPlotZoomer use a widget overlay.

Uwe