PDA

View Full Version : Qt4 Table Item Spanning



billyp
18th December 2008, 17:27
I am attempting to span table items for the first time and I am having some interesting results.

The code:

table->setColumnCount(1);
table->setRowCount(32);

QTableWidgetItem *newItem = new QTableWidgetItem("Label",0);

table->setItem(0,0, newItem);
table->setSpan(0,0,16,0);

The result:

I end up with what is close to what I would expect. The table has one large item spanning from rows 0 - 16 with the text "Label" in the vertical center. However, I also have the same text in what would be the original table item before the spanning took place. Results in two text tables, one in the (0,0) position and one near the (0,8) position.

Is this a known issue? Am I doing something wrong? Any help would be greatly appreciated.

-Bill

d_stranz
20th December 2008, 17:11
Try setSpan( 0, 0, 16, 1 );

I think the "rowSpan" and "columnSpan" arguments are counts, not cell indexes. It isn't clear from the documentation.

David