i am doing a total re-write of a Qt3 program in Qt4
I am using Kubuntu 7.10 distro.
I have a QFrame area "frameA" that I want to use for my drawing (QpaintEvent ).
My Code:
Qt Code:
  1. void BaseForm::paintEvent ( QPaintEvent * event )
  2. {
  3. QString k, h;
  4. double angle;
  5. int n, xs, xe, ys, ye, xc, yc;
  6. bool ok;
  7. QPainter p ( this );
  8.  
  9. QPen pen;
  10. QFont f;
  11.  
  12. if ( paintSupportLines.count () > 0 )
  13. {
  14. f.setFamily ( "Courier" );
  15. f.setPointSize ( dwgScaleFactor );
  16. p.setFont ( f );
  17. pen.setBrush ( Qt::blue );
  18. p.setPen ( pen );
  19. p.setViewport ( viewportRect );
  20. p.setWindow ( windowRect );
  21.  
  22. if ( clearWindow == "erase" ) { p.eraseRect ( windowRect ); clearWindow = "cancel erase"; }
  23. else
  24. {
  25. for ( n = 0; n < paintSupportLines.count(); ++n )
  26. {
  27. p.setClipRect ( clippingRect );
  28. k = paintSupportLines[n];
  29. tempList = k.split ( "," );
  30. xs = tempList[0].toInt ( &ok );
  31. ys = tempList[1].toInt ( &ok );
  32. xe = tempList[2].toInt ( &ok );
  33. ye = tempList[3].toInt ( &ok );
  34. p.drawLine ( xs, ys, xe, ye );
To copy to clipboard, switch view to plain text mode 
etc. I can single step thru the program, all values seem correct.,
Since I want to have my graphics in the "frameA" area of the screen I thought maybe I should change line #7 to "QPainter p( frameA )". but this did not help.

The code samples in "The Book of Qt 4" uses separate classes for their "QPaintEvent"s
Do I have to do that?

I would appreciate some help as I am at a total loss.

thanks