[Solved] QTableView selectionChanged event question
-
Hi,
I'm using a QTableView and have a function which is called when the selectionChanged event occurs. However, I'm not sure it is triggered when I'd expect (it seems a bit strange). Specifically:
As each row is selected (I'm using row selection) the selectionChanged event is triggered, as expected.
What I can't understand is that the event does not get triggered when, for example, the table is sorted by pressing a column header. In this case, the current row is deselected, but the selectionChanged event is not triggered.
Am I wrong to think point 2 above should trigger the selectionChanged event? The selection has changed because nothing is now selected and it was before the sort?
For information I'm using Qt 5.3.0.
Thanks.
-
Hi,
Please forget this question. It's because the selection model is being reset. The documentation does state "Also note that this signal will not be emitted when the item model is reset". I'd missed that part!
Thanks.
-
Hi,
Nice you found out and thanks for sharing !
Please, update the thread title prepending [solved] so other forum users may know a solution has been found :)