Hi,

I fill a QTableWidget in scope:
Qt Code:
  1. {
  2. [...]
  3. wdg_check *wdgl_check = new wdg_check();
  4. ui.languages->setCellWidget( currentRow, 2, wdgl_check );
  5. QObject::connect( ui.languages->cellWidget(currentRow,2), SIGNAL(newSelection()), this, SLOT(page1_selection_change()) );
  6. [...]
  7. QTableWidgetItem *newItemC = new QTableWidgetItem( i.value()["ol"]+"-"+i.value()["fl"] );
  8. ui.languages->setItem( currentRow, 6, newItemC);
  9. }
  10. // ui.languages->sortItems( 6, Qt::AscendingOrder );
To copy to clipboard, switch view to plain text mode 

where ui.languages is a QTableWidget and i.value() a QMap<QString, QString>. wdg_check is a simple Widget with a QCheckbox, which emit the SIGNAL newSelection(), when the state of QCheckbox is changed. And wdg_check provides the function getStatus(), which returns wether the QCheckBox is checked or not (bool).

so I have defined the connection-slot as:
Qt Code:
  1. void dgl_newBin::page1_selection_change()
  2. {
  3. for (int i = 0; i < ui.languages->rowCount(); ++i)
  4. {
  5. bool state = static_cast<wdg_check*>(ui.languages->cellWidget(i,2))->getStatus();
  6. }
  7. // (I have all stuf deleted, which doesn't cause the Problem)
  8. }
To copy to clipboard, switch view to plain text mode 

Ok, if I run the application with that code, all works, but if I uncomment the line "ui.languages->sortItems( 6, Qt::AscendingOrder );" I get an segmentation fault at the line "bool state = static_cast<wdg_check*>(ui.languages->cellWidget(i,2))->getStatus();".

Why? Isn't ui.languages->cellWidget(i,2) valid after sorting?

Thanks,
Lykurg