Unsolved Switch selection mode
-
Hi, I have a QTableView, I'm using SelectRow, and I want single-row selection by default and multi-selection when the <ctrl> key is pressed.
What is the best practice for this?
Currently I manage that myself: I listen to the QTableView::clicked signal and check the keyboardModifiers, it seems awkword -
-
When should I switch the mode? What signal should I connect to?
Currently I turn the selection of other rows myself, is that logical??? -
@nnzz said in Switch selection mode:
Currently I manage that myself: I listen to the QTableView::clicked signal and check the keyboardModifiers, it seems awkword
Why ? :/ It already has Qt.
Why not use MultiSelection ? -
I only need multi selection when the <ctrl> key is pressed, otherwise I need single row.
I am currently using multi selection and checking the <ctrl> key state, in order to release previous selections, that seems weird -
That's what ExtendedSelection does. Take a look at the SelectionBehavior enum description.