i have qtablewidget
first column populated checkable items, needed overload items able sort them. sorting works expected when click on header of column (rows sorted - first there checked rows , not checked).
the problem occurs when run gui , not click on header of column sort table , this:
tablewidget.setsortingenabled(0); // check/uncheck checkable items here tablewidget.setsortingenabled(1);
in situation overridden __lt__
called 100+ times, not expect because didn't clicked on header of column sort. so, why __lt__
called? why compares checkable items if didn't clicked on header of column sort them?
please me, calling __lt__
consumes time when have 30+ rows.
from docs (c++ qt applies):
sortingenabled : bool
this property holds whether sorting enabled.
if property true, sorting enabled table. if property false, sorting not enabled. default value false.
note:. setting property true setsortingenabled() triggers call sortbycolumn() current sort section , order.
and if check docs of qheaderview (which queried widget know column sort by) can read:
int qheaderview::sortindicatorsection () const
returns logical index of section has sort indicator. default section 0.
see setsortindicator(), sortindicatororder(), , setsortindicatorshown().
and:
qt::sortorder qheaderview::sortindicatororder () const
returns order sort indicator. if no section has sort indicator return value of function undefined.
so should careful this
Comments
Post a Comment