-
Bug
-
Resolution: Done
-
P2: Important
-
4.5.0
-
None
-
0d51611fa524091ddca3c6c11edb0eae8ffe3b02
The problem is that when you have a QTableWidget table that contains one or more rows with multiple column spans and you try to delete or insert a row before the row with the column span, the table will fail to shift the spanned row up (if deleting a row) or down (if inserting a new row). The contents of the row
will get shifted correctly, but not the column span. Qt3 did not have this problem.
Here is some code that shows the problem:
#include <QtGui/QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
int ROWS = 10;
int COLS = 10;
//create empty 10x10 table
QTableWidget table(ROWS, COLS);
for (int i=0; i<ROWS; i++)
//set multiple column span and text for row #5 (i.e., row index = 4)
int row = 4;
int col = 0;
int ROWSPAN = 1;
table.setSpan(row, col, ROWSPAN, COLS);
table.item(row, col)->setText("This is a multiple column span ...");
//Delete first row to unveil the problem.
//After deleting the first row, row #4 (and not row #5) should contain the multiple column span.
table.removeRow(0);
table.show();
return app.exec();
}
Expected to see:
I expected to see row #4 (not row #5) displayed as a multiple column span row.
Got instead:
Instead I got a table with row #5 displayed as a multiple column span row.
The problem is that the QTableWidget class does not account for a change in
the number of rows, when it happens above a row that contains a multiple
column span. The text of the spanned row gets shifted correctly, but not the
column span itself.
- replaces
-
QTBUG-4315 QTableView: Insert and remove rows or columns does shift spans.
-
- Closed
-