Hi,
Iam having a problem with the usage of QScrollView and QPainter.
Iam using Qt 3.3.4 on a solaris machine. My application requires
to parse a log file and generate graph from it. The problem is that
the drawContents method is drawing the graph more than once because
of which the graph is overwriting from the top once it has reached
the area that has been set using resizeContents.
I have also set the size based on the size of the file.
But nothing has changed. Iam sending you the part of the code:
void drawContents
(QPainter *p,
int cx,
int cy,
int cw,
int ch
) {
//opens the file for reading
//TextStream is created for reading
while(!stream.atEnd())
{
//Each line is read
//parsing is done
//Graph is drawn
}
//file is closed
resizeContents(7000,gy);
//lines are drawn vertically to avoid erasing
}
void drawContents(QPainter *p,int cx,int cy,int cw,int ch)
{
//opens the file for reading
//TextStream is created for reading
while(!stream.atEnd())
{
//Each line is read
//parsing is done
//Graph is drawn
}
//file is closed
resizeContents(7000,gy);
//lines are drawn vertically to avoid erasing
}
To copy to clipboard, switch view to plain text mode
Note:: In the above program, gy is declared as "int" holds the y-coordinate
till where the line is to be drawn.It is incremented by 20 each time in the
loop.
I have tried other options like resizing the contents before the drawContents , even in this case also the behaviour the same.
So, Kindly help me out from this problem because of which my application
got struck.
Thanks in advance.
with regards,
Saida
Bookmarks