[Qt-interest] drawing polyline with QPainterPath

Jan janusius at gmx.net
Tue Jun 2 11:22:28 CEST 2009


Hi,

> if ( !m_fillPath )
> {
>     path.moveTo( pPrime.at( 0 ) );
>     for ( int i = 1; i < pPrime.size(); ++i )
>         path.lineTo( pPrime.at( i ) );
> }

I tried this before (which did not work i.e. it's still an area).
I am still trying to understand/work with the second part .-)

Thank you
Jan

> else
> {
>     // We need to construct a closed path
>     QPointF zero( 0.0, 0.0 );
>     QPointF zeroPrime = m_coordSystem->mapToPrimed( zero );
>     path.moveTo( pPrime.at( 0 ).x(), zeroPrime.y() );
>     for ( int i = 0; i < pPrime.size(); ++i )
>         path.lineTo( pPrime.at( i ) );
>     path.lineTo( pPrime.last().x(), zeroPrime.y() );
>     path.closeSubpath();
> }
> 
> then later I simply call QPainter::drawPath(). You can ignore my m_coordSystem 
> object it simply transforms my data set into a more convenient coordinate 
> system.
> 
> HTH,
> 
> Sean
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 



More information about the Qt-interest-old mailing list