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
Forum Updated to NodeBB v4.3 + New Features

Set correct minimum height of QTableView

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 777 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.
  • S Offline
    S Offline
    SPlatten
    wrote on 2 Jun 2021, 07:37 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
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 2 Jun 2021, 07:40 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
      • S Offline
        S Offline
        SPlatten
        wrote on 2 Jun 2021, 07:40 last edited by
        #3

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

        Kind Regards,
        Sy

        1 Reply Last reply
        0

        1/3

        2 Jun 2021, 07:37

        • Login

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