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. QTableView reduce row height not working
Forum Updated to NodeBB v4.3 + New Features

QTableView reduce row height not working

Scheduled Pinned Locked Moved Solved General and Desktop
qtableviewrow heigth
4 Posts 3 Posters 1.4k 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.
  • gde23G Offline
    gde23G Offline
    gde23
    wrote on last edited by
    #1

    Hello,
    I've a QTableView and I have set the Fontsize for the items to be really small, eg 5pt.
    Now I also want to shrink the row height, however it is not working.
    I can increase it but not decrease. Seems like there is some lower limit somewhere.

    What I've tried is

    • setRowHeight(); for all rows

    • resizeRowToContents(); for all rows

    • settings vertical header spacing
      verticalHeader()->setDefaultSectionSize(5);
      verticalHeader()->sectionResizeMode(QHeaderView::Fixed);

    • setting sizeHint for the items.

    None of those methods is working. What am I missing?

    JonBJ 1 Reply Last reply
    0
    • gde23G gde23

      Hello,
      I've a QTableView and I have set the Fontsize for the items to be really small, eg 5pt.
      Now I also want to shrink the row height, however it is not working.
      I can increase it but not decrease. Seems like there is some lower limit somewhere.

      What I've tried is

      • setRowHeight(); for all rows

      • resizeRowToContents(); for all rows

      • settings vertical header spacing
        verticalHeader()->setDefaultSectionSize(5);
        verticalHeader()->sectionResizeMode(QHeaderView::Fixed);

      • setting sizeHint for the items.

      None of those methods is working. What am I missing?

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

      @gde23
      I think you have to set verticalHeader()->setMinimumSectionSize(int size), https://doc.qt.io/qt-5/qheaderview.html#minimumSectionSize-prop.

      mrjjM 1 Reply Last reply
      3
      • JonBJ JonB

        @gde23
        I think you have to set verticalHeader()->setMinimumSectionSize(int size), https://doc.qt.io/qt-5/qheaderview.html#minimumSectionSize-prop.

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @JonB
        That is correct as it won't go smaller than this value.

        1 Reply Last reply
        2
        • gde23G Offline
          gde23G Offline
          gde23
          wrote on last edited by
          #4

          thanks a lot,
          that did the trick :)

          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