Set the resize mode of the header to "Stretch".
Set the resize mode of the header to "Stretch".
Gopala Krishna (10th March 2008), tituslup (10th September 2009), tpf80 (4th October 2009), ucntcme (9th January 2008)
Thanks. Wish that was an option in Designer.![]()
--
The Real Bill
Ok. Now how do i set a descent size for all the columns without those ellipses initially such that scrollbars are avoided to the best extent ?
Calling resizeColumnsToContents() and also setting wordWrap to false doesn't help me set initial size
Screen shot 1 : The actual result.
Screen shot 2 : The expected result.
The biggest difference between time and space is that you can't reuse time.
-- Merrick Furst
I don't think I understand what you mean. Would you care to explain?
What i mean to say is,
Now i am getting the dialog in 1st screen shot in which the last column text isn't shown fully (ellipses are shown in the end)
What i want to achieve is the dialog in 2nd screen shot, in which the viewport of the tableview is of proper size to fit all columns without ellipses.
How do i do that ? Calling resizeColumnsToContents still results in the first screen shot.
The biggest difference between time and space is that you can't reuse time.
-- Merrick Furst
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