i have qtablewidget in main window class. unable find functionality undo text change specified cell. want is:
void mycellundofunc(int row, int col) { table->item(row, col)->undo(); //table qtablewidget }
the problem there no such undo(). question is, can there workaround problem using maybe foo-doo combination of signal's & slot's?
thanks!
ps: please not suggest use model/view framework because have used qtablewidget extensively in application. sorry same.
maybe should use the
void qtablewidgetitem::setdata ( int role, const qvariant & value ) [virtual]
using qt::userrole able specify last value. in method u can access set value data()-method. thing have keep old value up-to-date.
before set new value of qtablewidgetitem
tw->setdata(qt::userrole, tw->text())
and on undo u retrieve data with
tw->settext(tw->data(qt::userrole).tostring())
where "tw" current qtablewidgetitem using contextmenu-event, clicked-event or whatever u want. subclass qtablewidgetitem , handle whole thing internally in class, creating undo()-method, storing old value, etc.
Comments
Post a Comment