Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. drag-and-drop columns.
Forum Updated to NodeBB v4.3 + New Features

drag-and-drop columns.

Scheduled Pinned Locked Moved Unsolved General and Desktop
21 Posts 5 Posters 2.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NevezN Nevez

    @JonB said in drag-and-drop columns.:

    I would expect that after hiding a column the column(s) to the right would have visual indexes one less than the model indexes they show.

    Unfortunately, I tested it, it does not decrease.

    @JonB said in drag-and-drop columns.:

    normally the visual index is the same as the model index, but once you hide a column they will differ.

    No, as I said, when we hide the column, the visual index numbers still do not change (unless we move the columns). So the model index is the same as the visual index.

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #21

    @Nevez
    OK, I've had a search. This was covered in the https://uvesway.wordpress.com/2013/01/08/qheaderview-sections-visualindex-vs-logicalindex/ reference @mrjj gave you, did you read it?

    Visual indexes tell us the current position that a given section occupies in the header.

    However there is a detail one has to be aware of: hiding/showing a given section (calling QHeaderView.hideSection method) does NOT change its visual index as one could expect.

    So it's perfectly clear: visual indexes are for when you re-order the view columns, but if you only hide a column it (and subsequent columns) still retain their index into the header columns.

    As I say, I haven't used visual indexes/hiding of columns. But if there is not some better way you would need to write code to map from on-screen-visible columns to underlying column numbers by taking into account which column(s) are hidden where. Which is just some code to write.

    1 Reply Last reply
    1

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved