void TracingItem::clearCursor(void) { // immediately clear any current visible selections for (int index = 0; index < my.selections.size(); index++) { QwtPlotDirectPainter directPainter; directPainter.drawSeries(my.pointCurve, index, index); } my.selections.clear(); my.selectionInfo.clear(); }
void TracingItem::updateCursor(const QPointF &, int index) { Q_ASSERT(index <= my.points.size()); Q_ASSERT(index <= (int)my.pointCurve->dataSize()); my.selections.append(my.points.at(index)); my.selectionInfo.append(my.events.at(index).description()); // required for immediate chart update after selection QBrush pointBrush = my.pointSymbol->brush(); my.pointSymbol->setBrush(my.selectionSymbol->brush()); QwtPlotDirectPainter directPainter; directPainter.drawSeries(my.pointCurve, index, index); my.pointSymbol->setBrush(pointBrush); }
// Hightlight the selected point void CanvasPicker::showCursor( bool showIt ) { if ( !d_selectedCurve ) return; QwtSymbol *symbol = const_cast<QwtSymbol *>( d_selectedCurve->symbol() ); const QBrush brush = symbol->brush(); if ( showIt ) symbol->setBrush( symbol->brush().color().dark( 180 ) ); QwtPlotDirectPainter directPainter; directPainter.drawSeries( d_selectedCurve, d_selectedPoint, d_selectedPoint ); if ( showIt ) symbol->setBrush( brush ); // reset brush }