Milano
Milano

Reputation: 18705

Detect item changed - QtTableWidget

Is it possible to detect a situation when user changes cell value in QtTableWidget manually? I used table.itemChanged.connect(func) but I think that itemChanged detects all changes so I'm unable to refill the table in function func.

When user change QtTableWidget item value, the program runs method (func) which refills whole table. The problem is that table.itemchanged detects all changes so it returns error: RuntimeError: maximum recursion depth exceeded while calling a Python object because func generates many itemChanged signals.

Upvotes: 0

Views: 409

Answers (1)

user3443369
user3443369

Reputation: 41

You can block signals in your func.

func(...)
{
...
table.blockSignals(true);
// do your change here
table.blockSignals(false);
...
}

Or use the newer QSignalBlocker.

Upvotes: 2

Related Questions