Gnats 4702: SCT: Reproducible
crash while entering slot data
(same as Gnats 4698, but for the SCT).
Fixed in 5.1 Builds and 4.0.9 (future) Prerel on 2-17-2009 [Phil]
GNATS 4702 RECORD ... 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(); Also, new private Qt "slot"
void cellLineEdit_destroyed (QObject*); // private Qt "slot"
.. Removes obj from cwSlist<QWidget*> _deadCellWidgets, if it's there. Files: QtSCT/SctQTable.hpp
QtSCT/SctQTable.cpp ---