PDA

View Full Version : How to club column header's title for the QTableWidget



kapoorsudhish
18th November 2009, 12:25
Hi,
I am using a QTableWidget where i have to set the name of 2 columns with the same name, ie column header for column 0 and 1 should be "Name". How can i club the header name for two or more columns???

thanks & regards
sudhish kapoor

caduel
18th November 2009, 15:39
what do you mean with "club"?

Lykurg
18th November 2009, 15:52
I think club has the meaning span, and there is no easy Qt way for that. You might want to have a look at HierarchicalHeaderView: http://qt-apps.org/content/show.php/HierarchicalHeaderView?content=103154

kapoorsudhish
19th November 2009, 05:09
by clubbing i mean two columns having the same column name like we can merge columns in the excel sheet attaching the screen shot for the same.

Lykurg
19th November 2009, 08:45
for the header there is no option. Is it inside the table use QTableView::setSpan().

kapoorsudhish
8th December 2009, 06:55
i am finding it confusing to use the setSpan() function, as to what should i pass to the function to achieve the attached image format. please help me in using the a above function.


thanks,
sudhish kapoor

yogeshgokul
8th December 2009, 07:38
by clubbing i mean two columns having the same column name like we can merge columns in the excel sheet attaching the screen shot for the same.
This is called merging cells not merging columns.
You can use QTextTable::mergeCells() (http://doc.trolltech.com/4.5/qtexttable.html#mergeCells) for that.

kapoorsudhish
8th December 2009, 08:29
Thanks for the response but i actually want to merge the columns like two columns having the same heading. i dont know which function to be used for sure i dont want to merge the cells but i want to merge the columns headers for two cells.

thanks,
sudhish kapoor

yogeshgokul
8th December 2009, 09:40
Thanks for the response but i actually want to merge the columns like two columns having the same heading. i dont know which function to be used for sure i dont want to merge the cells but i want to merge the columns headers for two cells.

thanks,
sudhish kapoor
Your screen shot and verbal requirement is contradictory. In image I cannot see any merged columns. Are you sure you want to achieve the screen shot thing? If yes then its merging cells.