Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTableWidget select previous row
panch last edited by panch
I have a question regarding a QTableWidget which has been populated on runtime. The user can click each row and edit data representing this particular row.
If the user does not save the data after editing, and selects another row - then the user is prompted if he is sure he wants to discard the changes and change selection.
If he selects NO - then the previous row should be highlighted again - but I cannot make this work.
I have tried reacting on the slot currentItemChanged, and in this one call the following:
ui.tableInstructions->BlockSignals(true); ui.tableInstructions->setItemSelected(current, false); ui.tableInstructions->setItemSelected(previous, true); ui.tableInstructions->BlockSignals(false);
Since when you enter the function, the current one is the one that you DONT want to change to - you want to keep the previous one the current selection.
No matter what I do, I cannot get the previous row highlighted.
VRonin last edited by
The user can click each row and edit data representing this particular row.
If the user does not save the data after editing
How does it not save it? How are you implementing the editor?
panch last edited by
I have a save-button that the user has to press if he wants to save the changes. I'm not using a model view.