Hello @ everyone her,

I am currently implementing a representation of some measurement values in a 2d-plane.
There is a huge amount of items (one pixel long QLineF 's) in the scene (up to 1 million) and a few graphs consisting of about 100 - 200 QLineF ' s.

Qt Code:
  1. bool myGraph::insertGraphIntoScene(QList <QPointF> &list, QColor col)
  2. {
  3. if(list.size() == 0)
  4. return false;
  5.  
  6. else if(list.size() <2)
  7. {
  8. if(myLineGroupGraph == NULL)
  9. myLineGroupGraph = new QGraphicsItemGroup();
  10.  
  11. QPointF p = list.at(0);
  12. QGraphicsLineItem * line = new QGraphicsLineItem(p.x(),p.y(),p.x(),p.y());
  13. line->setPen(col);
  14.  
  15. // get the line that crosses y-axis
  16. if(p.x() == center.x())
  17. lineThroughYAxis = line;
  18.  
  19.  
  20. myLineGroupGraph->addToGroup(line);
  21. scene.addItem(myLineGroupGraph);
  22. }
  23.  
  24. else
  25. {
  26. if(myLineGroupGraph == NULL)
  27. myLineGroupGraph = new QGraphicsItemGroup();
  28. int i = 0;
  29. QPointF p1,p2;
  30. while(list.size() > i+2)
  31. {
  32. p1 = list.at(i);
  33. p2 = list.at(i+1);
  34.  
  35. line = new QGraphicsLineItem(p1.x(),p1.y(),p2.x(),p2.y());
  36. line->setPen(col);
  37. myLineGroupGraph->addToGroup(line);
  38. i++;
  39. }
  40.  
  41. scene.addItem(myLineGroupGraph);
  42. }
  43. return true;
  44. }
To copy to clipboard, switch view to plain text mode 


Now as seen in my code I have grouped all lines the curve consists of into myLineGroupGraph. Since I need to be able to click onto the curve and drag it up and down along the y axis, I am looking for a fast way to do so.

By calling

Qt Code:
  1. myLineGroupGraph->moveBy(...,...);
To copy to clipboard, switch view to plain text mode 
I can move the itemgroup up and down but it takes ages.

the viewportupdate is set to QGraphicsView::SmartViewportUpdate
I have tried QGraphicsView::FullViewportUpdate too.

Got any idea how to optimize implementation of the curve so the dragging gets faster?