PDA

View Full Version : Table cell merge/join



larry104
16th June 2006, 03:40
Hi,
is there a way in qt4 to merge/join table cells?
Thanks.

wysota
16th June 2006, 09:40
AFAIK it is planned but not available yet (see QAbstractItemModel::span()).

larry104
16th June 2006, 19:18
Thanks for the info - Is there a way of changing the border color for the table cells so that I can simulate merged cells?
Thanks.

wysota
16th June 2006, 19:47
You can turn off grid drawing in the table and draw the grid using delegates/tablewidgetitems.

larry104
16th June 2006, 23:27
I see "bool showGrid () const" to control the grid but, it's not quite clear to me how to draw the lines per cell using QItemDelegate. Do you have by any chance an example?
Thanks a lot.

larry104
16th June 2006, 23:34
Never mind - I found a similar thread http://www.qtcentre.org/forum/f-qt-programming-2/t-highlighting-the-border-of-cell-in-table-1215.html
I will try that first.
Thanks again for all the help.

wysota
16th June 2006, 23:35
An example... hmm... You can look at model-view examples (custom delegate) bundled with Qt. A quickstart is to inherit QItemDelegate and reimplement its paint() method and draw a frame you need around the cell before calling QItemDelegate::paint() to do the rest.