PDA

View Full Version : How can i capture the cellChanged() signal ONLY WHEN user editing



vertusd
28th October 2010, 02:25
in QTableWidge,the itemChanged() or cellChanged() signal simply emits whenever a item or cell content changed, but i want save the item.text() only when user edited it ,not by setItem() method in program.coz i have write some code to add a new row into QTableWidget, after the new row added, the itemChanged() emitted row*col times, coz,the program called setItem() row*col time.

i was trying to find some signal like itemFocusOut() to ensure user side editing, but there is no signal like this ,only have itemEnter()

is there a better way to resolve this, currently when i update the table from dataSet, first disconnect itemChanged() then ,connect it again .

sry for my english

ChrisW67
28th October 2010, 04:15
QAbstractItemView::currentChanged() will tell you when the current cell changes as the user moves off it (although the program can trigger that also). QAbstractItemModel::dataChanged() can tell you when the data is actually changed in the model.