TorAn
26th October 2014, 01:03
I did not know about it until recently: QTreeView allows user to manually rearrange columns by dragging them around. So if I have treeview with three columns:
A B C
user can rearrange them to be, say
C A B
I found out that Qt correctly requests the data in this case, i.e first it requests data for column 0 in the "original" view and it changes to requesting data for column "2" in "rearranged" view
So far so good. What I don't understand is how I should manually call "dataChange" signal. I mean, when data that I display in column "A" is changed programmatically I am emitting "dataChange" signal with QModelIndex pointing to column 0 (zero), which is "A" in "orignal" view. Should I track rearrangment of the columns and switch to dataChange with QModelIndex pointing to column 1 ("A" in rearranged view) or keep doing what I do regardless of how user moves columns around?
Thanks.
A B C
user can rearrange them to be, say
C A B
I found out that Qt correctly requests the data in this case, i.e first it requests data for column 0 in the "original" view and it changes to requesting data for column "2" in "rearranged" view
So far so good. What I don't understand is how I should manually call "dataChange" signal. I mean, when data that I display in column "A" is changed programmatically I am emitting "dataChange" signal with QModelIndex pointing to column 0 (zero), which is "A" in "orignal" view. Should I track rearrangment of the columns and switch to dataChange with QModelIndex pointing to column 1 ("A" in rearranged view) or keep doing what I do regardless of how user moves columns around?
Thanks.