Hello Uwe,
sorry but I can´t get it running. I set a pen to the curve with setPen() but only the color changes.
I tried it with my application and then with the oscilloscope example. Only when I do a replot() the pen uses the penWidth which I want to have.
This is the code from the example where I set a new pen.
// d_curve->setPen( canvas()->palette().color( QPalette::WindowText ) );
d_curve
->setRenderHint
( QwtPlotItem::RenderAntialiased,
true );
d_curve
->setPaintAttribute
( QwtPlotCurve::ClipPolygons,
false );
d_curve->setData( new CurveData() );
d_curve->attach( this );
p.setColor(Qt::red);
p.setWidthF(5);
d_curve->setPen(p);
d_curve = new QwtPlotCurve();
d_curve->setStyle( QwtPlotCurve::Lines );
// d_curve->setPen( canvas()->palette().color( QPalette::WindowText ) );
d_curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
d_curve->setPaintAttribute( QwtPlotCurve::ClipPolygons, false );
d_curve->setData( new CurveData() );
d_curve->attach( this );
QPen p;
p.setColor(Qt::red);
p.setWidthF(5);
d_curve->setPen(p);
To copy to clipboard, switch view to plain text mode
and only when I do a replot after drawSeries() the line have a width of 5.
void Plot::updateCurve()
{
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->values().lock();
const int numPoints = data->size();
if ( numPoints > d_paintedPoints )
{
const bool doClip = !canvas()->testAttribute( Qt::WA_PaintOnScreen );
if ( doClip )
{
/*
Depending on the platform setting a clip might be an important
performance issue. F.e. for Qt Embedded this reduces the
part of the backing store that has to be copied out - maybe
to an unaccelerated frame buffer device.
*/
const QwtScaleMap xMap
= canvasMap
( d_curve
->xAxis
() );
const QwtScaleMap yMap
= canvasMap
( d_curve
->yAxis
() );
QRectF br
= qwtBoundingRect
( *data,
d_paintedPoints - 1, numPoints - 1 );
d_directPainter->setClipRegion( clipRect );
}
d_directPainter->drawSeries( d_curve,
d_paintedPoints - 1, numPoints - 1 );
d_paintedPoints = numPoints;
}
data->values().unlock();
[COLOR="#FF0000"]replot();[/COLOR]
}
void Plot::updateCurve()
{
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->values().lock();
const int numPoints = data->size();
if ( numPoints > d_paintedPoints )
{
const bool doClip = !canvas()->testAttribute( Qt::WA_PaintOnScreen );
if ( doClip )
{
/*
Depending on the platform setting a clip might be an important
performance issue. F.e. for Qt Embedded this reduces the
part of the backing store that has to be copied out - maybe
to an unaccelerated frame buffer device.
*/
const QwtScaleMap xMap = canvasMap( d_curve->xAxis() );
const QwtScaleMap yMap = canvasMap( d_curve->yAxis() );
QRectF br = qwtBoundingRect( *data,
d_paintedPoints - 1, numPoints - 1 );
const QRect clipRect = QwtScaleMap::transform( xMap, yMap, br ).toRect();
d_directPainter->setClipRegion( clipRect );
}
d_directPainter->drawSeries( d_curve,
d_paintedPoints - 1, numPoints - 1 );
d_paintedPoints = numPoints;
}
data->values().unlock();
[COLOR="#FF0000"]replot();[/COLOR]
}
To copy to clipboard, switch view to plain text mode
Can you tell me what I do wrong???
Andre
Bookmarks