Unsolved QTableWidget select previous row
-
Hi all,
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.Any help?
-
@panch said in QTableWidget select previous row:
The user can click each row and edit data representing this particular row.
If the user does not save the data after editingHow does it not save it? How are you implementing the editor?
-
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.