Question

I implemented my own QHeaderView extending from QHeaderView.

After I set sorting enabled on the QTableWidget that uses this view, I still cannot sort. For what it is wroth, the table is initially sorted by the first column. If I do not set the horizontal header to my custom class, sorting is performed.

The only overloaded methods are the constructor (forces horizontal) and sizeHint().

Was it helpful?

Solution

I had to call

setClickable(true); 

in the constructor. Now sorting is possible again.

For Qt5:

setSectionsClickable(true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top