Important: Please read the Qt Code of Conduct -

Issue with QHeaderView visual/logical indexes

  • A couple of weeks ago I read this "blog entry": about QHeaderView and the meaning of visual and logical indexes. Because there is something in the post that I don't understand I posted a comment but I got no answer so I've decided to post here asking for help.

    The post presents the following QHeaderView sample:

    sect names A B C D E
    visualIndex 0 1 2 3 4
    logicalIndex 0 1 2 3 4

    then move some sections and get:

    sect names B C A D E
    visualIndex 0 1 2 3 4
    logicalIndex 1 2 0 3 4

    and then says that for the B section we have:

    • logicalIndex(0) -> 1
    • logicalIndexAt(0) -> 1
    • visualIndexAt(0) -> 1 (shouldn't it be 0, accordingly to the previous table?)

    So it seems that section B has two different visual indexes at the same time, 0 and 1. Maybe it is a typo (that one can find again in the last example of the blog) or maybe I'm misunderstanding the visualIndexAt() function.

    Could someone clarify things to me, please?

    Thanks in advance.

  • To me, visualIndexAt(0) should indeed be 0.

  • OK, thanks for your help.

Log in to reply