Note thatComputeDesiredSize()is meant as an aide to the developer. It is NOT meant to be very robust in many cases. If your widget is simulating a bouncing ball, you should just return a reasonable size; e.g. 160x160. Let the programmer set up a reasonable rule of resizing the bouncy ball simulation.