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. Set correct minimum height of QTableView
Qt 6.11 is out! See what's new in the release blog

Set correct minimum height of QTableView

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.0k 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I have an instance of QTableView, I want to adjust the minimum height to show 4 rows when its displayed.
    QTableView.png

    As you can see from the above pic, it doesn't show anything like 4 rows. I've tried:

    QFontMetrics fntMetrics(mptvSDrecs->fontMetics());
    mptvSDrecs->setMinimumHeight((mscuint16Rows + 1) * fntMetrics.height());
    

    Where in the about mscuint16Rows is defined as

    const quint16 MyClass::mscuint16Rows = 4;
    

    And mptvSDrecs is an instance of QTableView.

    However the displayed table view is just enough to display the header row and 1 data row.

    Kind Regards,
    Sy

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You can get the rowHeight for every for from https://doc.qt.io/qt-5/qtableview.html#rowHeight

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        @Christian-Ehrlicher , thank you, will try that now.

        Kind Regards,
        Sy

        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