Gnats 4698: Reproducible
crash while entering slot data
Filed and Fixed in 5.1 and 5.0.9 (future) on 2-12-2009.
GNATS 4698 RECORD ... SEE ALSO ERROR DIALOG BOX
This assertion error (crash) is avoidable by recoding Trolltech's recommended "hack" to make the cells of a Q3Table "itemless". The table does need to store ONE temporary cell widget: the QLineEdit used for incell editing. The "hack" solution uses an "auto-delete" enabled structure: Q3IntDict, with these implementations: Q3IntDict widgets; virtual void insertWidget (int r, int c, QWidget *w) { widgets.replace (indexOf (r,c), w); } virtual QWidget *cellWidget (int r, int c) const { return widgets.find (indexOf (r,c)); } virtual void clearCellWidget (int r, int c) { widgets.remove (indexOf (r,c)); } I recoded these methods to store a SINGLE cell widget along with indices for the cell in which it is active. To avoid the assertion error, the deletion of incell editor widgets needs to be deferred. Retired incell editor widgets are saved in a cwSlist, and are deleted when the dialog box is closed. int _singleInCellWidgetRow; int _singleInCellWidgetCol; QWidget* _singleInCellWidgetPtr; // ownership. cwSlist<QWidget*> _deadCellWidgets; // delete later virtual void insertWidget (int r, int c, QWidget*); virtual QWidget* cellWidget (int r, int c) const; virtual void clearCellWidget (int r, int c); void deleteDeadCellWidgets(); Files: Q3GUI/SlotQDlgLineEdit.cpp Q3GUI/SlotQDlgTable.cpp Q3GUI/SlotQDlgTable.hpp ---