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. How do you place row labels (VerticalHeaderLabels) on RHS of QTableWidget?
Qt 6.11 is out! See what's new in the release blog

How do you place row labels (VerticalHeaderLabels) on RHS of QTableWidget?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.3k Views 1 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.
  • N Offline
    N Offline
    neuralgen
    wrote on last edited by
    #1

    Row labels for a QTableWidget always seem to go on left side of the table (e.g. calling setVerticalHeaderLabels). Is there some way to set them on right hand side instead? I would have thought setVerticalHeaderLabels would have a second argument for an enum to specify placement.

    VRoninV 1 Reply Last reply
    0
    • N neuralgen

      Row labels for a QTableWidget always seem to go on left side of the table (e.g. calling setVerticalHeaderLabels). Is there some way to set them on right hand side instead? I would have thought setVerticalHeaderLabels would have a second argument for an enum to specify placement.

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @neuralgen said in How do you place row labels (VerticalHeaderLabels) on RHS of QTableWidget?:

      I would have thought setVerticalHeaderLabels would have a second argument for an enum to specify placement.

      That's impossible as setVerticalHeaderLabels is a method of the model which has no idea how the data it holds is displayed.

      Shooting in the dark here but see if verticalHeader()->setOffset(100) has any effect

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      N 1 Reply Last reply
      0
      • VRoninV VRonin

        @neuralgen said in How do you place row labels (VerticalHeaderLabels) on RHS of QTableWidget?:

        I would have thought setVerticalHeaderLabels would have a second argument for an enum to specify placement.

        That's impossible as setVerticalHeaderLabels is a method of the model which has no idea how the data it holds is displayed.

        Shooting in the dark here but see if verticalHeader()->setOffset(100) has any effect

        N Offline
        N Offline
        neuralgen
        wrote on last edited by
        #3

        @VRonin Sorry, verticalHeader()->setOffset(100) has no apparent effect.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi and welcome to devnet,

          Why do you want to put them on the right side ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          N 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi and welcome to devnet,

            Why do you want to put them on the right side ?

            N Offline
            N Offline
            neuralgen
            wrote on last edited by
            #5

            @SGaist Table columns are years ; for example 2000-2017. It would be nice if row labels were near the more recent years instead of being at left and having to scan across a wide table. Reversing order of columns would be unnatural.

            1 Reply Last reply
            0

            • Login

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