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?
-
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?