Maybe you should read the documentation for QWidget::geometry(), especially this part:

Warning: Calling setGeometry() inside resizeEvent() or moveEvent() can lead to infinite recursion.

See the Window Geometry documentation for an overview of geometry issues with windows.