PDA

View Full Version : Deleting a row in QTable having custom widgets



madhu
10th January 2007, 07:48
I am trying to delete rows is table (Qt-3.1). The rows initially seem to be deleted, but when i add new rows, old rows show up somewhere in between, thus not being deleted properly. I am inheriting Qtable, with support for large table. Also one of the column in all rows has custom widget.
I am calling removeRow(row).

The re-implemented functions are :

void Table::resizeData( int ) {}

QTableItem* Table::item( int r, int c ) const {
//printf("accessing item at : %d %d \n", r, c);
return contents.find( indexOf( r, c ) );
}
void Table::setItem( int r, int c, QTableItem *i ) {
contents.replace( indexOf( r, c ), i );
}
void Table::clearCell( int r, int c ) {
contents.remove( indexOf( r, c ) );
}
void Table::insertWidget( int r, int c, QWidget *w ) {
widgets.replace( indexOf( r, c ), w );
}
QWidget* Table::cellWidget( int r, int c ) const {
return widgets.find( indexOf( r, c ) );
}
void Table::clearCellWidget( int r, int c ) {
widgets.remove( indexOf( r, c ) );
}


Do we need to handle removal of rows specially for large tables or what else could be the problem ?


Regards,

Madhu

wysota
18th January 2007, 11:55
Hard to say, the size of the table shouldn't matter. Could you post a minimal compilable example reproducing the problem?