1

I want to display a set of ordered items 1:N according to their ordering, as they arrive arbitrary, for example suppose the following items arrived in the following order:

#1,#2,#10 then the Qtableview should display them in the correct order without empty rows for the yet to arrive elements:

+------+
-  #1  -
-  #2  -
-  #10 -
+------+

if then #5 arrived the qtableview updates it's view to the following:

+------+
-  #1  -
-  #2  -
-  #5  -
-  #10 -
+------+

and so on.

How can I achieve such behavior with the best performance (without reordering and redrawing the entire data each time an item arrives)?

sam
  • 11
  • 1
  • 3
    You probably want to look at [`QSortFilterProxyModel`](http://doc.qt.io/qt-5/qsortfilterproxymodel.html). – G.M. Aug 14 '18 at 16:30

1 Answers1

1

You should inherit from QSortFilterProxyModel and possible redefine virtual function lessThan http://doc.qt.io/qt-5/qsortfilterproxymodel.html#lessThan

Yuriy Rusinov
  • 61
  • 2
  • 5