I am using a QTableWidget. On the cellChanged()-signal I add or update a row in a sqlite database. After executing my SQL statements i want to add a button/CellWidget to an item in this row. As this is the change of a cell, it, of course, changes the content of the item and creates a loop.
How do i avoid this loop?
You have an other approach at your disposal. Using a mutex variable (a boolean for instance) that controls if you should add/update a row in your sql database, you can ignore the signal emited after executing SQL statements. The mutex variable can then be released after you added the button to the row.
This approach is probably cheaper than disconnecting/connecting the signal/slot arround your automatic update action. If the signal is often triggered, this might be the solution.