I am trying to solve the sorting issue and found this answer:
This arrow indicates that the first column is being sorted by default. When you're going to insert num==1
at the 2nd row, the first step is to insert it on column 1:
1 2
1 0 0
2 1 _ <-- inserting num==1 at column 1
3 _ _
4 _ _
5 _ _
6 _ _
7 _ _
8 _ _
9 _ _
. _ _
. _ _
. _ _
99 _ _
100 _ _
As the num==1
is inserted at column 1, and the sorting is enabled by default, the column 1 is sorted instantly after it's done:
1 2
1 1 _ <-- auto sorting is enabled on column 1. Rows are swapped.
2 0 0
3 _ _
4 _ _
5 _ _
6 _ _
7 _ _
8 _ _
9 _ _
. _ _
. _ _
. _ _
99 _ _
100 _ _
And now, we will insert num==1
on the next column:
1 2
1 1 _
2 0 1 <-- See here? The value 0 was overwritten
3 _ _
4 _ _
5 _ _
6 _ _
7 _ _
8 _ _
9 _ _
. _ _
. _ _
. _ _
99 _ _
100 _ _
This pattern repeats until we reach the bottom of the rows:
1 2
1 100 _
2 99 _
3 98 _
4 97 _
5 96 _
6 96 _
7 95 _
8 94 _
9 93 _
. .. _
. .. _
. .. _
99 1 _
100 0 100
So, everything is working "exactly as planned". Not by you maybe, but to PyQt5, this is what it though you wanted to do when you enabled column sorting before inserting items on the table.