You mean you want the dialog to expand itself to fit its contents? It's not an easy thing to do as the table or its header doesn't report a minimum width that would fit its contents. You have to calculate the width yourself and that's the hardest part.
You may also use QHeaderView::setStretchLastColumn(false) and optionally change the resizeMode of columns to ReizeToContents. You'll get scrollbars though...
Bookmarks