qt - Sorting a model has no immediate effect -
i implemented sort
in qabstracttablemodel
subclass. sorting works view doesn't change until hover on table (i.e. not header). how can fix this? @ first thought have emit signal couldn't find appropriate one.
i use following code sort model in project:
void mymodel::organize() { if (!cache_ || cache_->empty()) return; beginresetmodel(); // (a) std::stable_sort(cache_->begin(), cache_->end(), comparerow); endresetmodel(); // (b) } // end:(mymodel::organize)
line (a) tells model i'm going re-organize data, line (b) tells model i'm finished, please refresh associated views.
you may emit datachanged(index, index);
signal.
Comments
Post a Comment