QPainter::drawPolyline() takes an array of points and the number of points to draw so you can obtain what you want using this simple loop:

Qt Code:
  1. QVector<QPoint> points;
  2. // fillWithData(points);
  3. //...
  4. int start = 0;
  5. for(int i=0;i<points.size();i++){
  6. QPoint pt = points.at(i);
  7. if(pt.x()==-9 || pt.y()==-9){
  8. // draw from start to the current point
  9. if(start!=i){
  10. painter.drawPolyline(points.constData()+start, i-start);
  11. }
  12. start = i;
  13. }
  14. }
  15. if(start!=points.size()-1){
  16. painter.drawPolyline(points.constData()+start, points.size()-1-start);
  17. }
To copy to clipboard, switch view to plain text mode