label->setMinimumWidth( QFontMetrics( label->font() ).width( "widest string that label should contain" ) );
C++ (Qt)void QWidget::adjustSize()