QTableWidget: how to stretch columns?
-
wrote on 29 Apr 2014, 08:07 last edited by
Hi, I'd like to know how to stretch a QTableWidget's columns from the designer? thanks.
-
wrote on 29 Apr 2014, 10:01 last edited by
please help.
-
wrote on 29 Apr 2014, 17:04 last edited by
QListWidget doesn't have columns afaik (TextMode). Are you talking about IconMode ? What exactly you want to resize ?
-
wrote on 4 May 2014, 18:09 last edited by
[quote author="zeljko" date="1398791061"]QListWidget doesn't have columns afaik (TextMode). Are you talking about IconMode ? What exactly you want to resize ?[/quote]
Sorry, I was wrong about the QListWidget: it's in reality about QTableWidget.
so how to do that? -
wrote on 5 May 2014, 05:36 last edited by
Slots: QTableView::resizeColumnToContents(int: column); and
QTableView::resizeColumnsToContents();
is what you are searching for. Don't know if it's possible directly from designer (but since they're slots it should be), but in code it is. -
wrote on 5 May 2014, 08:14 last edited by
I found that you can change all columns by going to tableWidget : QTableWidget -> Header -> horizontalHeaderDefaultSectionSize. However, I did not find a QDesigner way of changing a single column width.
-
wrote on 5 May 2014, 08:34 last edited by
Hi kaisbs,
There is way to stretch the column in QTableWidget in Designer also.
Steps as,- Open the Qt designer.
- Select QTableWidget item which you already placed on your form.
- See the property box at right hand side.
- Scroll down to QTable Widget
- Under Header section you will find options to resize it as,
- horizontalHeaderDefaultSectionSize increase as you want & try it out
- horizontalHeaderStretchLastSection make it true so your empty space after last column will be filled by stretched last column.
Do your own tryouts on that there are plenty of option to do.
Thanks
Prashant Moglaikar
7/7