c++ - QTableWidget performance optimization -
i have qtablewidget can display huge number of elements (like, 20000 elements). displaying per se , scrolling , down works find, however, populating widget works extremely slowly. found out constructing qvector of elements (strings) displayed works fast, however, inserting elements qtablewidget slow. need implement filtration on elements, if user filters half of elements out wildcard, it's still necessary clean qtreewidget , insert 10000 elements (or hide 10000 elements equally slow). reasonably fast performance critical here because user can't wait several minutes every time presses button. valgrind doesn't apparently of resources eaten implicitly called functions, particularly qheaderview::sectionsize()
, qheaderview::issectionhidden()
migrate code model-view pattern.
- create model (subclass
qstandarditemmodel
) , place data there. - display data in
qtableview
, ensure ok - now, can use
qsortfiltermodel
model fast data-filtering, or can subclass qproxymodel more complex filters.
Comments
Post a Comment