Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge two cells of a qtable row?

Tags:

c++

qt

I have created a table using qtablewidget. I would like to selectively merge cells of some rows. Is there any built-in function for that(sorry, I couldn't find one)? Otherwise, please specify how it can be done. Thanks

like image 261
rwik Avatar asked Jun 28 '11 10:06

rwik


2 Answers

You could use the setSpan function of QTableView (which QTableWidget inherits) to achieve something like that for rows and columns.

That is, unless you're looking to really just merge individual cells. I'm not sure that can be achieved with setSpan, but have a look at it anyway.

like image 73
Bart Avatar answered Sep 19 '22 10:09

Bart


Try QTableWidget::setSpan(int row, int column, int rowSpan, int columnSpan);

But in some versions it doesn't work.

like image 30
red1ynx Avatar answered Sep 20 '22 10:09

red1ynx