setFixedSize(sizeHint());
or if you have a top layout:
layout->setSizeConstraint(QLayout::Fixed);

Regards