I have a qt object QTreeView and I want to switch tab positions. Basicly i have a filled TreeView. And the function
columnViewportPosition ( int column )
returns 0
for the first column and let's say 50
for the second. I want to switch them so that the are displayed in a different order, so that columnViewportPosition
would开发者_Python百科 return 50
for the first column and 0
for the second. How do i do that?
Found it out by myself. Its actually really easy.
If we just call the header()
function to get the QHeaderView, it has all the necessary functions.
For example the function swapSections
called with swapSections(1, 0)
will swap the first and second column.
精彩评论