I think you're mixing things up here. It sounds like you want to resize your widget, but resizeEvent() is what get's called when the widget is resized, not what you call to do the resizing (since that would cause infinite recursion). Does the following basically sum up the logic of what you want to do?
QRect r
= yourLayout.
geometry();
yourWidget.resize(r.width(), r.height());
QRect r = yourLayout.geometry();
yourWidget.resize(r.width(), r.height());
To copy to clipboard, switch view to plain text mode
With regards to the painter code that you mention, it says the following in QWidget's resizeEvent() documentation: "The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler."
I apologize if this isn't helpful or, God forbid, leads you further astray. As a newbie perhaps I should just keep my mouth shut but maybe someone will correct me and I'll learn too. :P
edit: By the way, why ARE you trying to resize a widget based on the layout? Usually a widget is resized by the user directly (as in dragging a window's borders around) or by the layout manager in response to such direct action, or as more widgets are added to the layout. The fact that layouts don't have size/resize/resizeEvent methods is not accidental. I think that most of the time you're not supposed to be concerned with a layout's size...
Bookmarks