문제

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().

도움이 되었습니까?

해결책

I had to call

setClickable(true); 

in the constructor. Now sorting is possible again.

For Qt5:

setSectionsClickable(true);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top