1

I have written code for my graph and it works fine, but when I need to resize it, problems start.

Resize event doesn't fit my QGraphicScene to QGraphicsView, but same code in paint event works fine.

I can't use paint event, 'cause it makes recursive painting in symbian(It works fine in desktop).

Resize event works fine if I resize window after first run, but I wan't to fit scene in my view from first run to end of program.

Here is pics of resizeEvent:

enter image description here

and paintEvent:

enter image description here

Both event's have same code inside.

Thanks in advance.

Rokker
  • 73
  • 6
  • 2
    Correct me if I am wrong, but `paintEvent` is called right after `resizeEvent`, so why don't you let the paint stuff in the `paintEvent` and just change members that need to be adapted to the new size in the `resizeEvent` ... you should not paint anything in the `resizeEvent` anyway ... Can you explain your "I can't use paint event, 'cause it makes recursive painting in symbian" ? – Thomas Vincent Jul 11 '11 at 17:44
  • 1
    Recursive paint event is a bug in any supported platform. Are you sure you are not calling something in your paint event that caused the widget to update itself? Resize event is REALLY not the place to paint. – Stephen Chu Jul 11 '11 at 18:36
  • does calling the resizeEvent() of the super class first solve the problem? – pokey909 Jul 11 '11 at 22:15
  • Thank you for all your comments. I know that paint event is the place to do painting, but recursive painting in symbian platform is 'causing memory problem. I have to check my paint event code again, but it seems to me that symbian calls paintevent all the time. – Rokker Jul 12 '11 at 09:39
  • Without a code sample, I doubt we can offer much more advice. – Caleb Huitt - cjhuitt Jul 21 '11 at 17:29
  • I manged to get my graph working. I just used paint event with some boolean arguments to prevent recursive painting. It's quite ugly code but works better than I expected. – Rokker Aug 05 '11 at 10:30

0 Answers0