make sure you update also the widgets size() function that it return the actual size of your graph!

If that does not help, show us some minimal code reproducing your problem.