rewt
12th November 2009, 16:44
I "hacked" the qt4/demos/spreadsheet example and put together a program that loads a specific form of a table from file. I got rid of all editing support, and use merely the functionality for highlighting by clicking with the mouse on items in the table. I use this as selection mechanism, and then have other functions read the selected items to do other processing. All of this works nicely, except when I then try to remove the currently loaded table and replace it by another one. It crashes when I call clearContents(), either directly or by emmiting a signal that is connected to the slot clearContents() in the existing base QTableWidget (inherited from some other Qt class).
This problem only occurs if I have actually selected an item in the table.
Using a file selection dialogue, I can load one table from file and display it, then load another one and display and so on. For each new load, clearContents() is called and then the new table is loaded. This works, but only if I never touch the table, never bring any of the items to highlight. Otherwise, as soon as clearContents() is called, the application crashes with segmentation fault.
Most likely I made a mistake somewhere but the question is where too look?
This problem only occurs if I have actually selected an item in the table.
Using a file selection dialogue, I can load one table from file and display it, then load another one and display and so on. For each new load, clearContents() is called and then the new table is loaded. This works, but only if I never touch the table, never bring any of the items to highlight. Otherwise, as soon as clearContents() is called, the application crashes with segmentation fault.
Most likely I made a mistake somewhere but the question is where too look?