PDA

View Full Version : How to discard initial data of QGraphicsView or QPainterPath's?



rajesh
13th August 2007, 15:14
I am displaying graph in a QGraphicsView using QPainterPath.
I am using QPainterPath's lineTo(x,y).
After displaying a huge data, I want to discard initial data(graph).
is there any way to discard initial(starting) data of QGraphicsView or QPainterPath's?
I am using Qt4.3.1 on windows.

marcel
13th August 2007, 15:24
If the root node of the graph is also the parent of all nodes( in the sense of QGraphicsItem parent-child relation) then you can call QGraphicsScene::removeItem.
It will remove the root and all children from the scene.

The responsibility to delete the item( deallocating the memory) is passed on to you.

rajesh
14th August 2007, 07:06
I dont want to remove full item, want to remove starting part of graph.

I am displaying digital wave signal by using QPainterPath. I want to display only 10ms data. when it cross 10 ms (say 11ms)data then I want to revove wave signal from begning(1ms data).

marcel
14th August 2007, 07:22
But that depends entirely on your data structure and graphics items design.
I can't give you a general method...

Regards

rajesh
14th August 2007, 07:56
m_pPainterPath.moveTo(0,0);
m_pPainterPath.lineTo(x,y);
m_pPainterPath.lineTo(x1,y1);
m_pPainterPath.lineTo(x2,y2);

after this can I delete like

m_pPainterPath.moveTo(0,0);
m_pPainterPath.removelineTo(x,y); --> is there any eqv function like removeline